Application Map: Triage Distributed Applications

Application Map helps you spot performance bottlenecks or failure hotspots across all components of your distributed application. Each node on the map represents an application component or its dependencies; and has health KPI and alerts status. You can click through from any component to more detailed diagnostics, such as Application Insights events. If your app uses Azure services, you can also click through to Azure diagnostics, such as SQL Database Advisor recommendations.

What is a Component?

Components are independently deployable parts of your distributed/microservices application. Developers and operations teams have code-level visibility or access to telemetry generated by these application components.

  • Components are different from "observed" external dependencies such as SQL, EventHub etc. which your team/organization may not have access to (code or telemetry).
  • Components run on any number of server/role/container instances.
  • Components can be separate Application Insights instrumentation keys (even if subscriptions are different) or different roles reporting to a single Application Insights instrumentation key. The preview map experience shows the components regardless of how they are set up.

Composite Application Map

You can see the full application topology across multiple levels of related application components. Components could be different Application Insights resources, or different roles in a single resource. The app map finds components by following HTTP dependency calls made between servers with the Application Insights SDK installed.

This experience starts with progressive discovery of the components. When you first load the application map, a set of queries are triggered to discover the components related to this component. A button at the top-left corner will update with the number of components in your application as they are discovered.

On clicking "Update map components", the map is refreshed with all components discovered until that point. Depending on the complexity of your application, this may take a minute to load.

If all of the components are roles within a single Application Insights resource, then this discovery step is not required. The initial load for such an application will have all its components.

Application Map Screenshot

One of the key objectives with this experience is to be able to visualize complex topologies with hundreds of components.

Click on any component to see related insights and go to the performance and failure triage experience for that component.

Flyout

Investigate failures

Select investigate failures to launch the failures pane.

Screenshot of investigate failures button

Screenshot of failures experience

Investigate performance

To troubleshoot performance problems, select investigate performance.

Screenshot of investigate performance button

Screenshot of performance experience

Go to details

Select go to details to explore the end-to-end transaction experience, which can offer views done to the call stack level.

Screenshot of go-to-details button

Screenshot of end-to-end transaction details

View in Analytics

To query and investigate your applications data further, click view in analytics.

Screenshot of view in analytics button

Screenshot of analytics experience

Alerts

To view active alerts and the underlying rules that cause the alerts to be triggered, select alerts.

Screenshot of alerts button

Screenshot of analytics experience

Set cloud_RoleName

Application Map uses the cloud_RoleName property to identify the components on the map. The Application Insights SDK automatically adds the cloud_RoleName property to the telemetry emitted by components. For example, the SDK will add a web site name or service role name to the cloud_RoleName property. However, there are cases where you may want to override the default value. To override cloud_RoleName and change what gets displayed on the Application Map:

.NET

using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.Extensibility;

namespace CustomInitializer.Telemetry
{
    public class MyTelemetryInitializer : ITelemetryInitializer
    {
        public void Initialize(ITelemetry telemetry)
        {
            if (string.IsNullOrEmpty(telemetry.Context.Cloud.RoleName))
            {
                //set custom role name here
                telemetry.Context.Cloud.RoleName = "RoleName";
            }
        }
    }
}

Load your initializer

In ApplicationInsights.config:

    <ApplicationInsights>
      <TelemetryInitializers>
        <!-- Fully qualified type name, assembly name: -->
        <Add Type="CustomInitializer.Telemetry.MyTelemetryInitializer, CustomInitializer"/>
        ...
      </TelemetryInitializers>
    </ApplicationInsights>

An alternate method is to instantiate the initializer in code, for example in Global.aspx.cs:

 using Microsoft.ApplicationInsights.Extensibility;
 using CustomInitializer.Telemetry;

    protected void Application_Start()
    {
        // ...
        TelemetryConfiguration.Active.TelemetryInitializers.Add(new MyTelemetryInitializer());
    }

Node.js

var appInsights = require("applicationinsights");
appInsights.setup('INSTRUMENTATION_KEY').start();
appInsights.defaultClient.context.tags["ai.cloud.role"] = "your role name";
appInsights.defaultClient.context.tags["ai.cloud.roleInstance"] = "your role instance";

Alternate method for Node.js

var appInsights = require("applicationinsights");
appInsights.setup('INSTRUMENTATION_KEY').start();

appInsights.defaultClient.addTelemetryProcessor(envelope => {
    envelope.tags["ai.cloud.role"] = "your role name";
    envelope.tags["ai.cloud.roleInstance"] = "your role instance"
});

Java

If you use Spring Boot with the Application Insights Spring Boot starter, the only required change is to set your custom name for the application in the application.properties file.

spring.application.name=<name-of-app>

The Spring Boot starter will automatically assign cloudRoleName to the value you enter for the spring.application.name property.

For further information on Java correlation and how to configure cloudRoleName for non-SpringBoot applications checkout this section on correlation.

Client/browser-side JavaScript

appInsights.queue.push(() => {
appInsights.context.addTelemetryInitializer((envelope) => {
  envelope.tags["ai.cloud.role"] = "your role name";
  envelope.tags["ai.cloud.roleInstance"] = "your role instance";
});
});

For more information about how to override the cloud_RoleName property with telemetry initializers, see Add properties: ITelemetryInitializer.

Troubleshooting

If you're having trouble getting Application Map to work as expected, try these steps:

  1. Make sure you’re using an officially supported SDK. Unsupported/community SDKs might not support correlation.

    Refer to this article for a list of supported SDKs.

  2. Upgrade all components to the latest SDK version.

  3. If you’re using Azure Functions with C#, upgrade to Functions V2.

  4. Confirm cloud_RoleName is correctly configured.

Portal feedback

To provide feedback, use the portal feedback option.

MapLink-1 image

Next steps