I have the same angular frontend deployed several times with different AppServices. I want to be able to distinguish them as each connects to a single AppService using the approach mentioned here: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-monitor-multi-role-apps.
So I assume I need to set the cloud_rolename clientside as well but I can't seem to find any reference on how to do this. My AppServices already show up using the cloud rolename.
To set a customer cloud_rolename you need to write a telemetryInitializer function and set an ai.device.roleName tag on each envelope.
For a full list of tags check ContextTagKeys.ts.
Thank you.
I've edited my code as such:
AppInsights.queue.push(() => {
AppInsights.context.addTelemetryInitializer((envelope: Microsoft.ApplicationInsights.IEnvelope) => {
envelope.tags['ai.device.roleName'] = "MyClientApp";
});
});
When analysing the page views I can now select the filter 'Cloud role name' which matches 'MyClientApp'.
And I know this is probably not the place for it :) but the application does not show up in the Application Map overview.
I'm glad to hear that it's working. Sorry, I can't help with the App Map, could you ask this question in the MSDN forum - https://social.msdn.microsoft.com/Forums/en-US/home?forum=ApplicationInsights,
Btw, thanks for sharing your code, I added the question to our FAQ section.
Ok thanks for all the info, I've created a question on the MSDN forum.
This seems no longer valid! :(
as per this issue https://github.com/microsoft/ApplicationInsights-JS/issues/523#issuecomment-333035326, the tag we should use is ai.cloud.role