Skip to content

Commit 8cf2d69

Browse files
authored
Merge pull request #184816 from trask/jmx
Metrics info available in log file
2 parents 74e5406 + c304e93 commit 8cf2d69

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

articles/azure-monitor/app/java-jmx-metrics-configuration.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,32 @@ Application Insights Java 3.x collects some of the JMX metrics by default, but i
1515

1616
## How do I collect additional JMX metrics?
1717

18-
JMX metrics collection can be configured by adding a ```"jmxMetrics"``` section to the applicationinsights.json file. You can specify the name of the metric the way you want it to appear in Azure portal in application insights resource. You have to define the object name and attribute for each of the metrics you want collected.
18+
JMX metrics collection can be configured by adding a ```"jmxMetrics"``` section to the applicationinsights.json file. You can specify the name of the metric the way you want it to appear in Azure portal in application insights resource. Object name and attribute are required for each of the metrics you want collected.
1919

2020
## How do I know what metrics are available to configure?
2121

22-
You nailed it - you must know the object names and the attributes, those properties are different for various libraries, frameworks, and application servers, and are often not well documented. To get the object names and attributes, you need to view the MBean tree. An MBean is a managed Java object, that can represent a device, an application, or a resource, and has a set of attributes.
22+
You nailed it - you must know the object names and the attributes, those properties are different for various libraries, frameworks, and application servers, and are often not well documented. Luckily, it's easy to find exactly what JMX metrics are supported for your particular environment.
2323

24-
To view the available metrics and browse through the available metrics, we recommend using [Java Mission Control](https://www.oracle.com/java/technologies/jdk-mission-control.html).
24+
To view the available metrics, set the self-diagnostics level to `DEBUG` in your `applicationinsights.json` configuration file, for example:
2525

26-
### How to navigate the Java Mission Control to get to the right metrics?
27-
28-
When you run the Java Mission Control tool, you'll have a selection of JVMs available on the left side, click on the relevant process under the 'JVM Browser' tab. Wait until JMC loads the dashboard for the process, select 'MBean Browser' tab on the bottom (see below). The JMC must be located in the same folder as the JVM and your process/app must be up and running.
29-
30-
![Screenshot of JMC MBean browser](media/java-ipa/jmx/jmc-mbean-browser.png)
26+
```json
27+
{
28+
"selfDiagnostics": {
29+
"level": "DEBUG"
30+
}
31+
}
32+
```
3133

32-
### How to get to the metrics I want, and the necessary attributes?
34+
The available JMX metrics, with the object names and attribute names will appear in the application insights log file.
3335

34-
The MBean browser opens the MBean tree with the list of categories that can be expanded. Selecting a category on the left opens the list of attributes on the right. Below is an example of a metric, its object name, and the attributes. The attributes may be nested, as in the example below.
36+
The output in the log file will look similar to the example below. In some cases the list can be quite extensive.
37+
> [!div class="mx-imgBorder"]
38+
> ![Screenshot of available JMX metrics in the log file](media/java-ipa/jmx/available-mbeans.png)
3539
36-
![Screenshot of JMC MBean tree](media/java-ipa/jmx/jmc-metric-sample.png)
3740

38-
### Configuration example
41+
## Configuration example
3942

40-
From the selection as shown in the image above, lets configure a few metrics. The first one is an example of a nested metric - `LastGcInfo` that has several properties, and we want to capture the `GcThreadCount`.
43+
Knowing what metrics are available, you can configure the agent to collect those. The first one is an example of a nested metric - `LastGcInfo` that has several properties, and we want to capture the `GcThreadCount`.
4144

4245
```json
4346
"jmxMetrics": [
@@ -59,7 +62,7 @@ From the selection as shown in the image above, lets configure a few metrics. Th
5962
],
6063
```
6164

62-
### Types of collected metrics and available configuration options?
65+
## Types of collected metrics and available configuration options?
6366

6467
We support numeric and boolean JMX metrics, while other types aren't supported and will be ignored.
6568

@@ -70,4 +73,5 @@ Currently, the wildcards and aggregated attributes aren't supported, that's why
7073

7174
As your application is running and the JMX metrics are collected, you can view them by going to Azure portal and navigate to your application insights resource. Under Metrics tab, select the dropdown as shown below to view the metrics.
7275

73-
![Screenshot of metrics in portal](media/java-ipa/jmx/jmx-portal.png)
76+
> [!div class="mx-imgBorder"]
77+
> ![Screenshot of metrics in portal](media/java-ipa/jmx/jmx-portal.png)
57.3 KB
Loading

0 commit comments

Comments
 (0)