-
Notifications
You must be signed in to change notification settings - Fork 839
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
Allow Prometheus exporter to add resource attributes to metric attributes #6179
Allow Prometheus exporter to add resource attributes to metric attributes #6179
Conversation
@jack-berg I need your help on 3 open issues before I can convert this to a normal PR:
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6179 +/- ##
============================================
+ Coverage 90.97% 91.04% +0.07%
- Complexity 5670 5686 +16
============================================
Files 620 621 +1
Lines 16535 16623 +88
Branches 1682 1698 +16
============================================
+ Hits 15042 15134 +92
+ Misses 1023 998 -25
- Partials 470 491 +21 ☔ View full report in Codecov by Sentry. |
@codeboten has been working on that. He's merged a number of PRs recently updating the prometheus model, and we're working on the resource attributes part in open-telemetry/opentelemetry-configuration#67.
Sorry can you elaborate on this? I think you're referring to specific rules around |
@jack-berg Ok, got it - the environment is lowered case, and the
|
|
No there shouldn't be. We normalize keys before reading as well. So if you set |
...ometheus/src/main/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServerBuilder.java
Outdated
Show resolved
Hide resolved
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Outdated
Show resolved
Hide resolved
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Outdated
Show resolved
Hide resolved
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Outdated
Show resolved
Hide resolved
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Outdated
Show resolved
Hide resolved
This is the code doing the normalization:
Where is the replacement of "-" to "." ? It's only replacing "_" to ".", no? |
@jack-berg All fixed. 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.
Couple of small additional comments. Thanks!
...ters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/PrometheusHttpServer.java
Outdated
Show resolved
Hide resolved
...rs/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/PrometheusMetricReader.java
Outdated
Show resolved
Hide resolved
exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/Predicates.java
Show resolved
Hide resolved
.../prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java
Outdated
Show resolved
Hide resolved
@jack-berg All comments have been fixed (aside from one). |
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.
Thanks!
FYI @open-telemetry/java-approvers I'm planning on merging this for the 1.35.0 release. |
@jack-berg i'm interested in this feature but I can't figure out how to use it. Are there docs? |
@Falmarri Currently the only way to use it is when you build the SDK manually completely. Then you can use the prometheus builder and set the predicate dictating which attributes to copy. |
Fixes #6108
This PR adds the ability to copy resource attributes to the labels of each data point, per a given regular expression.
Two new configurations have been introduced as part of this PR.