-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[translator/prometheus] Label translation breaks for labels with trailing __
#30760
Comments
Pinging code owners for pkg/translator/prometheus: @dashpole @bertysentry. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Interesting. So it is adding an extra underscore? |
I think it may be adding two extra. I can confirm in a bit. |
|
I really don't see how this is possible, given how the code works: replace every non-alphanumeric rune with an underscore. It's pretty basic. How can it append 2 extra underscore? |
I don't know either....I was stumped. The comment from
|
If someone can sanity check our implementation that would be great. Although I think @bertysentry just did. This may be worth of an issue against |
Well, now I am even more stumped. Minimal playground reproduction shows that it working as intended. |
@bertysentry can you reproduce this unit test in your local environment to verify? |
|
A coworker ran on OS: Amazon Linux 2 aarch64 5.10 Kernel
test results
diff
|
I tested this successfully in my environment (Go 1.21.6 on Windows): require.Equal(t, "test__", NormalizeLabel("test__"))
require.Equal(t, "__test__", NormalizeLabel("__test__")) Result:
|
I tried running the playground example linked above on my local machine and did not see the error. I am back to being stumped on why this is happening. |
Welp, sorry for wasting everyones time. The test was faulty and we didn't catch it.
Notice the two extra parens within the doublequote. Should be
|
"EVERYBODY, CALM DOWN!!" 😂 |
Component(s)
No response
What happened?
Description
Prometheus label normalization does not work properly for labels with trailing double underscores such as
__replica__
.Steps to Reproduce
Expected Result
Passing test
Actual Result
Collector version
latest
Environment information
Environment
Compiler(if manually compiled): (e.g., "go 14.2") go 1.21.6
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
I did a quick exploration of this and the root cause did not jump out. I suspect it could be an issue with Map() not performing as expected. See top comment inside function declaration.
The text was updated successfully, but these errors were encountered: