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.
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
Append unit to prometheus metric names #5400
Append unit to prometheus metric names #5400
Changes from 7 commits
5b28758
5e5661f
bccc044
cb3956b
d5e7c40
6e7b601
6c17344
0525969
6f20800
f2fea06
7568167
bab0e57
19a93fe
2937d84
ac96ab0
5d3488f
bf33ae0
0cd3aab
519ceb8
c4df7ef
7bf71a2
0f2c3c1
38ee5a8
cd89da8
c302e91
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What's the reason for these replacements? Prometheus does not seem to forbid double or trailing underscores in its spec; and it does not seem that the previous operations on the unit are likely to produce trailing or duplicated underscores.
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.
The spec linked in the PR description states -
Based on that I removed leading
_
, because the serializer was already adding it.But looking at this again, I think this would be confusing to do in the
PrometheusUnitHelper
. I will remove this, also the spec does not explicitly mention that the final unit name cannot have a trailing_
, so I think leading_
is fine. I will make changes.Also, the current name sanitizer does not seem to remove consecutive
_
, so based on spec this needs to be added as well.TL;DR
_
) without any additional cleaning up._
and then replacing consecutive_
with a single underscore.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.
I would like to mention here that while not explicitly stated in the spec, this is how opentelemetry-collector works, should we try to keep this in sync with how the collector works ?
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.
If you move this line below the next
if
you can probably get rid of thecleanUpString
method inPrometheusUnitsHelper
-- no need to perform sanitization twice after all. (And the performance will benefit from the cache inNameSanitizer
as well)