A Java application configured to use Observability Provider = Azure Application Insights may emit JMX metrics.
While some metrics are collected by default, others have to be set explicitly.
Follow this document from Azure to configure additional JMX metrics to be displayed in the Metrics tab of your application insights resource in the Azure portal.
In the following example, the JSON detailed below was added as the value of the APPLICATIONINSIGHTS_CONFIGURATION_CONTENT Environment variable. The are other methods to configure runtime settings to Application Insights (see here for details on this topic).
"jmxMetrics": [
{
"name": "Demo - GC Collection Count",
"objectName": "java.lang:type=GarbageCollector,name=G1 Young Generation",
"attribute": "CollectionCount"
},
{
"name": "Demo - Thread Count",
"objectName": "java.lang:type=Threading",
"attribute": "ThreadCount"
}
],