Search code examples
javaazureazure-application-insightstelemetry

Azure Application Insights codeless agent does not show cloudRoleInstance and cloudRoleName in application map


I am using Azure Application Insights on my Java App, I added an ApplicationInsights.json file next to the JAR (Java codeless agent 3.0.0) but the roleName and roleInstance are not pushed to Aplication Insights.

    {
        "instrumentationSettings": {
            "connectionString": "InstrumentationKey=XXX..XXX"
        },
        "preview": {
            "roleName": "MYROLE",
            "roleInstance": "myinstance"
        }
    }

When I go to the Log tabs in the Azure portal, the roleInstance field on incoming data is still set to the machine name and the roleName is not among incoming data.

The JSON file can be read because it contains the InstrumentationKey of my Application Insights resource.


Solution

  • According to this (https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config) "preview" should be a part of "instrumentationSettings":

    {
      "instrumentationSettings": {
        "connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000",
        "preview": {
          "roleName": "my cloud role name"
        }
      }
    }