We're trying out the app insights multi role preview as announced here:
https://azure.microsoft.com/en-us/blog/app-insights-microservices/
We've added the 2.4.0-beta3 packages for appinsights & appinsights.windowsserver as the app we're using is hosted on prem (IIS) currently.
Our cloud_rolename
seems to be undefined in our request telemetry. Is there anything further we need to do other than updating the packages?
We also found this:
AzureRoleEnvironmentTelemetryInitializer
updates the RoleName
and RoleInstance
properties of the Device context for all telemetry items with information extracted from the Azure runtime environment.
..though our Cloud_RoleInstance
property is being properly populated.
For ASP.NET apps, I had to assign Cloud.RoleName
using a custom ITelemetryInitializer
to assign ITelemetry.Context.Cloud.RoleName
property which will assign the proper context for a given request when using multi-component apps.
public class MultiComponentTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
{
var requestTelemetry = telemetry as RequestTelemetry;
if (requestTelemetry?.Context?.Cloud == null) return;
requestTelemetry.Context.Cloud.RoleName = "myapp-api";
}
}
This initializer only works on the server side APIs - I have not found the equivalent hook for the client JS SDK.