Skip to content
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

Closed
wants to merge 8 commits into from

Conversation

harsimar
Copy link
Member

@harsimar harsimar commented Nov 30, 2023

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.

@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. OpenTelemetry OpenTelemetry instrumentation labels Nov 30, 2023
Copy link

Thank you for your contribution @harsimar! We will review the pull request and get back to you soon.

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@harsimar harsimar changed the title Using the schema URL as the metric name for JMX metrics Using the jmx metric attribute as the metric name for JMX metrics Dec 1, 2023
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +156 to +164
// 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());
}
Copy link
Member

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

Suggested change
// 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());
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. OpenTelemetry OpenTelemetry instrumentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants