APM Tips

Glossary

Cloud role name and instance

The two fields that say which service (cloud_RoleName) and which machine, container or instance (cloud_RoleInstance) sent a telemetry item; Application Map draws one node per role name.

Updated

Every Application Insights row carries cloud_RoleName and cloud_RoleInstance (AppRoleName and AppRoleInstance in a workspace). When two or more services send to the same resource, Microsoft says you’re required to set role names; without them Application Map shows one node, and the services’ requests, failures and percentiles blur together.

The OpenTelemetry distros for .NET, Node.js and Python take the role name from the service.namespace and service.name resource attributes, falling back to service.name alone, and the instance from service.instance.id. Set them through environment variables; OTEL_SERVICE_NAME wins over a name in OTEL_RESOURCE_ATTRIBUTES:

OTEL_SERVICE_NAME=checkout-api
OTEL_RESOURCE_ATTRIBUTES=service.instance.id=checkout-7f9c

With those two lines, the service’s rows arrive with cloud_RoleName checkout-api and cloud_RoleInstance checkout-7f9c.

The Java agent reads APPLICATIONINSIGHTS_ROLE_NAME and APPLICATIONINSIGHTS_ROLE_INSTANCE (or role.name and role.instance in its JSON file), and defaults to the resource name and the machine name. The classic .NET SDK sets telemetry.Context.Cloud.RoleName in a telemetry initializer.

Keep role names stable and few: one per deployable service, not one per version or per pod. The version belongs in application_Version, the host or pod name in the instance.

Sources, checked

  1. Configure Azure Monitor OpenTelemetry (cloud role name and instance)learn.microsoft.com · checked
  2. Enable Azure Monitor OpenTelemetry for .NET, Node.js, Python and Java applicationslearn.microsoft.com · checked
  3. Application Map in Azure Application Insightslearn.microsoft.com · checked

All glossary terms