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

Refactor prometheus exporter to slightly improve performance #3351

Merged
merged 1 commit into from Oct 20, 2022

Conversation

dashpole
Copy link
Contributor

Depends on #3342

This removes the intermediary metricData struct for storing metrics, and instead directly constructs them and places them in the channel.

Before:

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/exporters/prometheus
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
BenchmarkCollect1-16        	   34020	     36013 ns/op	   34377 B/op	      37 allocs/op
BenchmarkCollect10-16       	   17280	     71593 ns/op	   43729 B/op	     223 allocs/op
BenchmarkCollect100-16      	    3484	    315440 ns/op	  141521 B/op	    2049 allocs/op
BenchmarkCollect1000-16     	     403	   3019380 ns/op	 1178601 B/op	   20133 allocs/op
BenchmarkCollect10000-16    	      37	  31071324 ns/op	11247557 B/op	  200570 allocs/op
PASS
ok  	go.opentelemetry.io/otel/exporters/prometheus	7.537s

After:

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/exporters/prometheus
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
BenchmarkCollect1-16        	   35424	     33992 ns/op	   34265 B/op	      34 allocs/op
BenchmarkCollect10-16       	   20886	     57156 ns/op	   42440 B/op	     198 allocs/op
BenchmarkCollect100-16      	    3814	    315079 ns/op	  129088 B/op	    1841 allocs/op
BenchmarkCollect1000-16     	     506	   2380297 ns/op	 1049404 B/op	   18121 allocs/op
BenchmarkCollect10000-16    	      45	  23002387 ns/op	 9850371 B/op	  180552 allocs/op
PASS
ok  	go.opentelemetry.io/otel/exporters/prometheus	7.234s

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Merging #3351 (15ab000) into main (587437b) will decrease coverage by 0.0%.
The diff coverage is 41.1%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3351     +/-   ##
=======================================
- Coverage   78.0%   77.9%   -0.1%     
=======================================
  Files        164     164             
  Lines      11363   11323     -40     
=======================================
- Hits        8865    8826     -39     
+ Misses      2301    2299      -2     
- Partials     197     198      +1     
Impacted Files Coverage Δ
exporters/prometheus/exporter.go 81.1% <41.1%> (-3.0%) ⬇️

@dashpole dashpole added pkg:exporter:prometheus Related to the Prometheus exporter package enhancement New feature or request Skip Changelog PRs that do not require a CHANGELOG.md entry labels Oct 18, 2022
@dashpole
Copy link
Contributor Author

This is tough to rebase. I'll wait until after #3352 as well

@dashpole
Copy link
Contributor Author

rebased now

Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

🎉

@MrAlias MrAlias merged commit 1133977 into open-telemetry:main Oct 20, 2022
@MrAlias MrAlias added this to the Metric v0.34.0 milestone Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:exporter:prometheus Related to the Prometheus exporter package Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants