Blazor WASM, Application Insights

Application Insights: How to set the Cloud Role Name for Blazor Application

7 min read

  • October 24,2024
  • Rajesh Goel

 

Problem Overview

I recently integrated Application Insights with a Blazor application. While the setup was completed successfully, I observed that the application instance is not being populated in the 'Cloud Role Name' filter within the Transaction Search or displayed as a Node in the Application Map. This omission complicates the ability to leverage these filters for tracing and diagnostics.

Telemetry Initializers

Telemetry initializers provide a mechanism to intercept, modify, or filter telemetry data at runtime before it is transmitted from the client to Application Insights. Multiple initializers can be attached to the ApplicationInsights instance, and they are executed sequentially in the order they are registered, allowing for granular control over the telemetry pipeline.

Definition of CloudRole & CloudRoleInstance

[Description("Name of the role the application is a part of. Maps directly to the role name in Azure.")]
[MaxStringLength("256")]
string CloudRole = "ai.cloud.role"; 

[Description("Name of the instance where the application is running. Computer name for on-premises, instance name for Azure.")]
[MaxStringLength("256")]
string CloudRoleInstance = "ai.cloud.roleInstance";

Outcome

At Memetic Solutions, we use these notification permission concepts to keep applications user-friendly. By ensuring users control their settings, we create apps that are both intuitive and engaging, improving user satisfaction without disrupting their experience.