[prometheusremotewrite] fix: counter name check #2613
Merged
bogdandrutu merged 3 commits intoopen-telemetry:mainfrom Mar 8, 2021
Merged
[prometheusremotewrite] fix: counter name check #2613bogdandrutu merged 3 commits intoopen-telemetry:mainfrom
bogdandrutu merged 3 commits intoopen-telemetry:mainfrom
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.
|
bogdandrutu
reviewed
Mar 6, 2021
bogdandrutu
reviewed
Mar 6, 2021
Signed-off-by: naseemkullah <naseem@transit.app>
bogdandrutu
approved these changes
Mar 8, 2021
bogdandrutu
approved these changes
Mar 8, 2021
Member
bogdandrutu
left a comment
There was a problem hiding this comment.
Would be good to have a test :)
Signed-off-by: naseemkullah <naseem@transit.app>
69e31e7 to
3bd2bd7
Compare
Member
Author
done, PTAL -> 3bd2bd7 |
This was referenced Mar 11, 2021
This was referenced Mar 15, 2021
hughesjj
pushed a commit
to hughesjj/opentelemetry-collector
that referenced
this pull request
Apr 27, 2023
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.
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 😅