-
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
Metric benchmark investigation #5544
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkOTELCounter-24 42491396 56.06 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 10961318 220.1 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 42471098 55.09 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 11157889 214.9 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 148504042 16.23 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 38502283 61.73 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 299598176 7.974 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 43538810 55.06 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 377620942 6.333 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 47813799 52.70 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 469475085 5.119 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 46523139 51.32 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 464676590 5.082 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 48377798 51.73 ns/op 16 B/op 1 allocs/op BenchmarkNoOpOTELCounter-24 1000000000 1.901 ns/op 0 B/op 0 allocs/op BenchmarkNoOpOTELCounterWithLabel-24 64543243 34.60 ns/op 16 B/op 1 allocs/op
BenchmarkOTELCounter-24 685085875 3.493 ns/op 0 B/op 0 allocs/op BenchmarkOTELCounterWithLabel-24 66929808 36.21 ns/op 16 B/op 1 allocs/op BenchmarkNoOpOTELCounter-24 1000000000 1.901 ns/op 0 B/op 0 allocs/op BenchmarkNoOpOTELCounterWithLabel-24 66596236 35.09 ns/op 16 B/op 1 allocs/op
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looking into #5542. Closing, as this is not meant to be merged.
My original local benchmark:
Exemplar collection accounts for ~50ns of the overhead (a1bead9), even though I believe we shouldn't be collecting exemplars by default, and we aren't doing tracing. This is probably a good area to optimize.
Attribute cardinality limiting seems to account for a very small (~2ns) portion of the overhead.
Lookup based on the attribute set accounts for ~40ns of the overhead for the no-attributes case, and the vast majority of the overhead for the with-attributes case. OTel would need to introduce bound instruments to remove this chunk of overhead.
Our counter increment function (with locking) accounts for ~8ns of the overhead. We use a simple lock and increment a counter value. Prometheus appears to have implemented some optimizations for this. Benchmarks without any measurement whatsoever:
The remaining overhead is from the API, and from the Options pattern which requires calling NewAddConfig. This would presumably be eliminated if instruments were already bound to attributes.