-
Notifications
You must be signed in to change notification settings - Fork 836
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
fix: ensure the label names are sanitised #2121
Conversation
Sanitises the attribute names to match the naming convention enforced by Prometheus
Alternative way to fix this is to apply this check and when the diag level is DEBUG output a warning that the attribute is not meeting Prometheus requirements |
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 think sanitizing is fine. Better than dropping at least. We could add a debug
log but it would likely be quite chatty. We could add each bad label name to a Set
of names that have already been logged. Only log each bad name once.
Approving for now since I see no immediate concern.
Looks like your time mock failed |
Codecov Report
@@ Coverage Diff @@
## main #2121 +/- ##
==========================================
- Coverage 92.78% 92.74% -0.04%
==========================================
Files 140 140
Lines 4976 4979 +3
Branches 1028 1028
==========================================
+ Hits 4617 4618 +1
- Misses 359 361 +2
|
Yeah, that could work. I am happy to make a change later :) |
This likely won't be merged right away to ensure there is time for people to see it before merged but if it isn't merged by tomorrow I will merge it. If you have time to make the logging change before merge then great but if not it isn't blocking and can be done as follow up. |
packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
@weyert you have typo in variable name |
packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts
Outdated
Show resolved
Hide resolved
@obecny I fixed the typo. I want to merge this for 0.19 release if possible |
Sanitises the attribute names to match the naming convention enforced by
Prometheus
Which problem is this PR solving?
If you have a label name with
-
then Prometheus will fall over this issue with an error like:error while linting: text format parsing error in line 282: expected '=' after label name, found '-'
Short description of the changes
The change is to also sanitise the label name and not only the metric names