-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
add option for resource attributes in metrics for prometheus exporter #4733
add option for resource attributes in metrics for prometheus exporter #4733
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4733 +/- ##
=====================================
Coverage 81.9% 81.9%
=====================================
Files 224 224
Lines 18116 18136 +20
=====================================
+ Hits 14847 14865 +18
- Misses 2982 2984 +2
Partials 287 287
|
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.
It looks good so far.
This PR adds the `WithResourceAsConstantLabels` option to the Prometheus exporter to allow users to configure resource attributes to be applied on every metric. Fixes open-telemetry#4732 Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
Co-authored-by: David Ashpole <dashpole@google.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
9b765b1
to
0237d61
Compare
Signed-off-by: Alex Boten <aboten@lightstep.com>
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.
With there being minimal change to the no-filter path I think this is gtg.
There is a cost to add these attributes in the filter path. Adding a service.name filter I got these results:
benchstat bench-no-filter.txt bench-with-filter.txt
name old time/op new time/op delta
Collect1-16 32.3µs ± 5% 33.4µs ± 3% +3.45% (p=0.002 n=10+10)
Collect10-16 93.2µs ± 3% 101.7µs ± 2% +9.04% (p=0.000 n=11+9)
Collect100-16 529µs ± 1% 613µs ± 4% +15.95% (p=0.000 n=9+10)
Collect1000-16 4.97ms ± 2% 5.64ms ± 5% +13.63% (p=0.000 n=11+10)
Collect10000-16 43.4ms ± 5% 50.3ms ± 7% +15.83% (p=0.000 n=11+9)
name old alloc/op new alloc/op delta
Collect1-16 35.5kB ± 0% 35.8kB ± 0% +0.74% (p=0.000 n=11+10)
Collect10-16 48.4kB ± 0% 51.1kB ± 0% +5.45% (p=0.000 n=11+10)
Collect100-16 193kB ± 0% 219kB ± 0% +13.70% (p=0.000 n=11+10)
Collect1000-16 1.57MB ± 0% 1.83MB ± 0% +16.85% (p=0.000 n=10+10)
Collect10000-16 15.1MB ± 0% 17.8MB ± 0% +17.57% (p=0.000 n=11+10)
name old allocs/op new allocs/op delta
Collect1-16 72.0 ± 0% 78.0 ± 0% +8.33% (p=0.000 n=11+10)
Collect10-16 407 ± 0% 467 ± 0% +14.74% (p=0.000 n=11+10)
Collect100-16 3.76k ± 0% 4.36k ± 0% +15.97% (p=0.000 n=11+10)
Collect1000-16 37.1k ± 0% 43.1k ± 0% +16.16% (p=0.000 n=11+10)
Collect10000-16 372k ± 0% 432k ± 0% +16.20% (p=0.000 n=11+10)
@MadVikingGod note that it is benchmarking only the first scrape of an endpoint (a single Collect for the exporter). Since the result is cached, it should have minimal impact on subsequent scrapes. |
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Signed-off-by: Alex Boten <aboten@lightstep.com>
This PR adds the
WithResourceAsConstantLabels
option to the Prometheus exporter to allow users to configure resource attributes to be applied on every metric.Fixes #4732