Repository navigation
Improvements to defaultLabels in metrics, and matching benchmarks - #683
Closed
jdmarshall wants to merge 4 commits into
Closed
jdmarshall wants to merge 4 commits into
jdmarshall wants to merge 4 commits into
Conversation
This was referenced Jul 7, 2025
jdmarshall
commented
Jul 7, 2025
jdmarshall
force-pushed
the
aggregation
branch
2 times, most recently
from
July 7, 2025 05:58
aa0e98e to
9422c24
Compare
This should help with further optimizations, especially for cluster.js
I believe I see some perf issues with default labels and I'd like to explore those. Increases code coverage by .6%, but branch coverage by 1.2% File | % Stmts | % Branch | % Funcs | % Lines | ---------------------------------|---------|----------|---------|---------| All files | 51.78 | 28.35 | 48.8 | 52.45 | All files | 52.36 | 29.55 | 49.14 | 53.05 | Relates to prometheus#676
…rmats. getMetricsAsJSON and getMetricsAsString use different mechanisms to merge in default labels. It turns out that the getMetricsAsJSON version is substantially faster. ... except in how it short circuits out of the inner loop. ✓ registry ➭ getMetricsAsJSON#2 x 4, 2 defaults is 21.55% faster. ✓ registry ➭ getMetricsAsJSON#2 x 2, 4 defaults is 22.69% faster. ✓ registry ➭ metrics#2 x 4, 2 defaults is 26.95% faster. ✓ registry ➭ metrics() 2 x 4, 2 defaults and openMetrics is 25.78% faster. ✓ registry ➭ metrics#2 x 2, 4 defaults is 25.53% faster. ✓ registry ➭ metrics() 2 x 2, 4 defaults and openMetrics is 26.98% faster.
Start all of the metrics but then only await them one at a time. This should help with prometheus#543 by introducing some pauses for other work to complete.
Contributor
Author
|
This contains the same code as in #687 |
This file contains hidden or 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
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.
This is about a 20% improvement in the getMetricsAs{String,JSON} functions, when defaultLabels are set.
Note that this PR shares some benchmark-only commits in common with #680
Additional benchmark suites boost code coverage #676
No breaking changes