-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the jmx metric attribute as the metric name for JMX metrics #37880
Conversation
Thank you for your contribution @harsimar! We will review the pull request and get back to you soon. |
API change check API changes are not detected in this pull request. |
.../src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/MetricDataMapper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// We emit jmx metrics via opentelemetry with an attribute that has the original name the customer set | ||
// in their applicationinsights.json file. We parse for that attribute here to report the intended | ||
// metric name to Breeze. | ||
String jmxMetricName = pointData.getAttributes().get(AttributeKey.stringKey("app_insights_internal_jmx_metric")); | ||
if (jmxMetricName != null) { | ||
pointBuilder.setName(jmxMetricName); | ||
} else { | ||
pointBuilder.setName(metricData.getName()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also extract constant for the AttributeKey
// We emit jmx metrics via opentelemetry with an attribute that has the original name the customer set | |
// in their applicationinsights.json file. We parse for that attribute here to report the intended | |
// metric name to Breeze. | |
String jmxMetricName = pointData.getAttributes().get(AttributeKey.stringKey("app_insights_internal_jmx_metric")); | |
if (jmxMetricName != null) { | |
pointBuilder.setName(jmxMetricName); | |
} else { | |
pointBuilder.setName(metricData.getName()); | |
} | |
// We emit some metrics via OpenTelemetry that have names which use characters that aren't | |
// supported in OpenTelemetry metric names, and so we put the real metric names into an attribute | |
// (where these characters are supported) and then pull the name back out when sending it to Breeze. | |
String metricName = pointData.getAttributes().get(AttributeKey.stringKey("applicationinsights_internal_metric_name")); | |
if (metricName != null) { | |
pointBuilder.setName(metricName); | |
} else { | |
pointBuilder.setName(metricData.getName()); | |
} |
ApplicationInsights team currently has a PR to emit JMX metrics via OTLP and Breeze: microsoft/ApplicationInsights-Java#3406. To emit JMX metrics with spaces in the name to Breeze, we use an attribute in the metric as the metric name that is reported to Breeze.