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

exporter/prometheusexporter: support Summary #2900

Conversation

odeke-em
Copy link
Member

@odeke-em odeke-em commented Apr 7, 2021

Allows Summary metrics to be exported to Prometheus.
To walk through this feature, I created an adaptation of a Brian Brazil
tutorial for DropWizard, to create a Java server at
https://github.com/odeke-em/bugs/tree/master/opentelemetry-collector/2661
and it uses DropWizard, and exports out JVM statistics with Prometheus where the
*gc_collection_seconds are of the summary kind when scraped by visiting
http://localhost:1234/metrics which produced

 # HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds.
 # TYPE jvm_gc_collection_seconds summary
 jvm_gc_collection_seconds_count{gc="G1 Young Generation",} 4.0
 jvm_gc_collection_seconds_sum{gc="G1 Young Generation",} 0.026
 jvm_gc_collection_seconds_count{gc="G1 Old Generation",} 0.0

and then roundtripped the collector to scrape those metrics and then
export them to Prometheus

VS

making Prometheus directly scrape that endpoint and then comparing
results.

Fixes #2661

@codecov
Copy link

codecov bot commented Apr 7, 2021

Codecov Report

Merging #2900 (1a89d7f) into main (5f3e4ec) will increase coverage by 0.00%.
The diff coverage is 88.23%.

❗ Current head 1a89d7f differs from pull request most recent head eaaf2ab. Consider uploading reports for the commit eaaf2ab to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2900   +/-   ##
=======================================
  Coverage   91.67%   91.67%           
=======================================
  Files         311      287   -24     
  Lines       15308    15284   -24     
=======================================
- Hits        14033    14011   -22     
  Misses        868      868           
+ Partials      407      405    -2     
Impacted Files Coverage Δ
exporter/prometheusexporter/collector.go 98.58% <85.71%> (-1.42%) ⬇️
exporter/prometheusexporter/accumulator.go 99.00% <90.00%> (-1.00%) ⬇️
service/application.go 77.34% <0.00%> (-0.89%) ⬇️
config/config.go 100.00% <0.00%> (ø)
config/exporter.go 100.00% <0.00%> (ø)
config/extension.go 100.00% <0.00%> (ø)
config/processor.go 100.00% <0.00%> (ø)
testutil/testutil.go 81.60% <0.00%> (ø)
receiver/scraperhelper/scraper.go 100.00% <0.00%> (ø)
service/internal/builder/builder.go 100.00% <0.00%> (ø)
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f3e4ec...eaaf2ab. Read the comment docs.

@odeke-em odeke-em force-pushed the prometheus-exporter-support-Summary-Metric branch from 720d235 to 5fa2c7d Compare April 7, 2021 23:43
@odeke-em odeke-em marked this pull request as ready for review April 8, 2021 06:45
@odeke-em odeke-em requested a review from a team April 8, 2021 06:45
@odeke-em odeke-em force-pushed the prometheus-exporter-support-Summary-Metric branch 2 times, most recently from e50e22c to d991f64 Compare April 9, 2021 00:36
@odeke-em
Copy link
Member Author

odeke-em commented Apr 9, 2021

Alright, ready for action, kindly cc-ing some reviewers @alolita @Aneurysm9 @rakyll @bogdandrutu @brian-brazil.

@odeke-em odeke-em requested a review from Aneurysm9 April 9, 2021 21:18
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

The description of the PR is incorrect the ignore of no sum is fixed.

@odeke-em odeke-em force-pushed the prometheus-exporter-support-Summary-Metric branch from c36b80c to 1a89d7f Compare April 12, 2021 20:54
@odeke-em
Copy link
Member Author

The description of the PR is incorrect the ignore of no sum is fixed.

@bogdandrutu sorry I don't follow what you mean, all I talked about was that now we export Summary through the prometheusexporter, where does "the ignore of no sum is fixed" relate? Thanks for the review too!

@bogdandrutu
Copy link
Member

@odeke-em please fix lint errors

Allows Summary metrics to be exported to Prometheus.
To walk through this feature, I created an adaptation of a Brian Brazil
tutorial for DropWizard, to create a Java server at
https://github.com/odeke-em/bugs/tree/master/opentelemetry-collector/2661
and it uses DropWizard, and exports out JVM statistics with Prometheus where the
*gc_collection_seconds are of the summary kind when scraped by visiting
http://localhost:1234/metrics which produced

```
 # HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds.
 # TYPE jvm_gc_collection_seconds summary
 jvm_gc_collection_seconds_count{gc="G1 Young Generation",} 4.0
 jvm_gc_collection_seconds_sum{gc="G1 Young Generation",} 0.026
 jvm_gc_collection_seconds_count{gc="G1 Old Generation",} 0.0
```

and then roundtripped the collector to scrape those metrics and then
export them to Prometheus

    VS

making Prometheus directly scrape that endpoint and then comparing
results.

Also added an end to end test to ensure that a mock DropWizard server
which produces JVM statistics can be scraped by the Prometheus receiver,
which will feed metrics to an active Prometheus exporter, and then we
scrape from the Prometheus exporter to ensure that the summary metrics
are written out and that they make sense.

    DropWizard -> Prometheus Receiver -> Prometheus Exporter -> HTTP scrape + Verify

Fixes open-telemetry#2661
@odeke-em odeke-em force-pushed the prometheus-exporter-support-Summary-Metric branch from 1a89d7f to eaaf2ab Compare April 13, 2021 00:22
@odeke-em
Copy link
Member Author

@bogdandrutu done, although the "lint" flagged legitimate Go code in 2 cases that don't make sense so might want to look at the false positives. Thank you for the reviews @Aneurysm9 and @bogdandrutu!

@bogdandrutu bogdandrutu merged commit 65feeb9 into open-telemetry:main Apr 13, 2021
@odeke-em odeke-em deleted the prometheus-exporter-support-Summary-Metric branch April 13, 2021 16:53
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
* Increase timeout to 10m for golangci-lint

* Add Makefile.common to workflow triggers

* Use --allow-parallel-runners for signalfx-agent lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PrometheusReceiver ignores Summary and Histogram Metrics that do not have _sum counter.
4 participants