-
Notifications
You must be signed in to change notification settings - Fork 900
add scope schema URL and attributes to prom attributes #7356
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7356 +/- ##
============================================
+ Coverage 89.77% 89.82% +0.05%
- Complexity 6982 6988 +6
============================================
Files 797 797
Lines 21160 21167 +7
Branches 2056 2057 +1
============================================
+ Hits 18996 19014 +18
+ Misses 1503 1494 -9
+ Partials 661 659 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Show resolved
Hide resolved
@zeitlinger, FYI. From open-telemetry/opentelemetry-go#5947 (comment):
|
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Show resolved
Hide resolved
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Outdated
Show resolved
Hide resolved
from that comment
|
This is just a heads-up that the spec change this PR addresses has already been approved and is about to be merged! So you're good to proceed. If removing the otel_scope_info metric is a breaking change for your SDK, you're empowered to decide how to roll this out! |
23d8e5b
to
a1328aa
Compare
This is not part of this PR - will discuss first how to address this |
Fixes #4223 Prototypes: - open-telemetry/opentelemetry-go#5947 - open-telemetry/opentelemetry-go#6770 - open-telemetry/opentelemetry-java#7356 - open-telemetry/opentelemetry-collector-contrib#40060 - open-telemetry/opentelemetry-collector-contrib#40004 ## Changes Currently (before this PR) [Prometheus and OpenMetrics Compatibility](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md) assumes that only scope name and scope version are identifying. However, with #4161 this is no longer true. Therefore, this PR updates the Prometheus and OpenMetrics Compatibility specification to add the scope name, version, schema URL, scope attributes to all metrics. This also removes the `otel_scope_info` as it looks that it won't be useful. See: #4223 (comment). This change important for Collector open-telemetry/opentelemetry-go#5846 (comment). It is also is necessary towards stabilization of OTel-Prom/OpenMetrics compatibility) and the Prometheus exporter. _Initially, I thought about [splitting it into a few PRs](#4223 (comment)). However, it looks like doing it in one PR would be a more complete approach (also there are not that many changes)._ --------- Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com> Co-authored-by: Carlos Alberto Cortez <calberto.cortez@gmail.com>
Fixes #4223 Prototypes: - open-telemetry/opentelemetry-go#5947 - open-telemetry/opentelemetry-go#6770 - open-telemetry/opentelemetry-java#7356 - open-telemetry/opentelemetry-collector-contrib#40060 - open-telemetry/opentelemetry-collector-contrib#40004 ## Changes Currently (before this PR) [Prometheus and OpenMetrics Compatibility](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md) assumes that only scope name and scope version are identifying. However, with #4161 this is no longer true. Therefore, this PR updates the Prometheus and OpenMetrics Compatibility specification to add the scope name, version, schema URL, scope attributes to all metrics. This also removes the `otel_scope_info` as it looks that it won't be useful. See: #4223 (comment). This change important for Collector open-telemetry/opentelemetry-go#5846 (comment). It is also is necessary towards stabilization of OTel-Prom/OpenMetrics compatibility) and the Prometheus exporter. _Initially, I thought about [splitting it into a few PRs](#4223 (comment)). However, it looks like doing it in one PR would be a more complete approach (also there are not that many changes)._ --------- Co-authored-by: Jade Guiton <jade.guiton@datadoghq.com> Co-authored-by: Carlos Alberto Cortez <calberto.cortez@gmail.com>
a1328aa
to
8cb8418
Compare
@jack-berg can you take a look? |
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.
Small suggestion, but this looks good. In practice, the scope attributes bit of this won't impact any users right now because we never landed the APIs to be able to associate attributes with meter, tracer, logger.
@@ -488,6 +490,14 @@ private Labels convertAttributes( | |||
if (scope.getVersion() != null) { | |||
labelNameToValue.putIfAbsent(OTEL_SCOPE_VERSION, scope.getVersion()); | |||
} | |||
String schemaUrl = scope.getSchemaUrl(); | |||
labelNameToValue.putIfAbsent(OTEL_SCOPE_SCHEMA_URL, schemaUrl == null ? "" : schemaUrl); |
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.
Why not:
labelNameToValue.putIfAbsent(OTEL_SCOPE_SCHEMA_URL, schemaUrl == null ? "" : schemaUrl); | |
if (schemaUrl != null) { | |
labelNameToValue.putIfAbsent(OTEL_SCOPE_SCHEMA_URL, schemaUrl); | |
} |
Reference implementation: open-telemetry/opentelemetry-go#5947
Towards open-telemetry/opentelemetry-specification#4223