Skip to content

fix(inject): use more robust logic to convert annotation to metric label#15176

Open
sdickhoven wants to merge 5 commits intolinkerd:mainfrom
sdickhoven:BUG-fix-invalid-metric-label
Open

fix(inject): use more robust logic to convert annotation to metric label#15176
sdickhoven wants to merge 5 commits intolinkerd:mainfrom
sdickhoven:BUG-fix-invalid-metric-label

Conversation

@sdickhoven
Copy link
Copy Markdown

@sdickhoven sdickhoven commented Apr 15, 2026

this pr fixes #15175 by using a more robust method for removing the annotation prefix.

if the annotation does not have a prefix, the logic will still work because then no / character should be found which will cause strings.Index() to return -1... and since we're then adding 1, the string slice becomes [0:] which is valid and returns the entire string.

kudos to @MairtinHeartyEverQuote for troubleshooting this issue.

Fixes linkerd#15175

Signed-off-by: Simon Dickhoven <sdickhoven@everquote.com>
@sdickhoven sdickhoven requested a review from a team as a code owner April 15, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linkerd-proxy-injector produces prometheus metrics with invalid labels

3 participants