-
Notifications
You must be signed in to change notification settings - Fork 1.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
[prometheusremotewrite] fix: counter name check #2613
[prometheusremotewrite] fix: counter name check #2613
Conversation
fixes open-telemetry#2608 Ensure that the metric name is greater than the length of the counter suffix ("_total") before checking if it contains the counter suffix to prevent crashes for short (smaller or eq to the length of the suffix) metric names. The edge case where the metric name is "_total" is not handled (considered not to have the suffix), but should not occur IRL. Also fix the spelling of "delimiter". Signed-off-by: naseemkullah <naseem@transit.app>
42bb509
to
8bffb8e
Compare
Codecov Report
@@ Coverage Diff @@
## main #2613 +/- ##
==========================================
- Coverage 92.03% 92.03% -0.01%
==========================================
Files 273 273
Lines 15452 15450 -2
==========================================
- Hits 14221 14219 -2
- Misses 848 849 +1
+ Partials 383 382 -1
Continue to review full report at Codecov.
|
Signed-off-by: naseemkullah <naseem@transit.app>
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.
Would be good to have a test :)
Signed-off-by: naseemkullah <naseem@transit.app>
69e31e7
to
3bd2bd7
Compare
done, PTAL -> 3bd2bd7 |
fixes #2608
Ensure that the metric name is greater than the length of thecounter suffix ("_total") before checking if it contains the counter
suffix to prevent crashes for short (smaller or eq to the length of the
suffix) metric names.
The edge case where the metric name is "_total" is not handled (considerednot to have the suffix), but should not occur IRL.
edit: Use
strings.hasSuffix()
to check if metric name has the counter suffix ("_total")Also fix the spelling of "delimiter".
warning: this is one of my first PRs in Go 😅