feat: improve observability of collection failures in the metrics generator with error categorization#5936
Merged
javiermolinar merged 2 commits intomainfrom Nov 13, 2025
Conversation
| case errors.Is(err, tsdb.ErrInvalidSample), | ||
| errors.Is(err, tsdb.ErrInvalidExemplar): | ||
| return "invalid" | ||
| case errors.Is(err, storage.ErrOutOfOrderSample), |
Contributor
There was a problem hiding this comment.
sounds good but why group multiple error types with the same label?
Contributor
Author
There was a problem hiding this comment.
Mostly to have an actionable observability. Matching 1-1 the errors in Prometheus can end in cognitive overload, this also maintains forward compatibly. Also, this keeps the cardinality low. We can always go to the logs to know the exact error
| errors.Is(err, storage.ErrCTNewerThanSample): | ||
| return "out_of_order" | ||
| case errors.Is(err, storage.ErrDuplicateSampleForTimestamp), | ||
| errors.Is(err, storage.ErrDuplicateExemplar): |
Member
There was a problem hiding this comment.
nit: Exemplar seems like a fit for dedicated ErrType instead of being clubbed with duplicate_sample
Contributor
Author
There was a problem hiding this comment.
The idea is having behavioral categories, not type-based
carles-grafana
approved these changes
Nov 12, 2025
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.
What this PR does:
It improves the observability of collection errors in the metrics generator by categorize Prometheus errors. Right now the current metric lacks of proper detail.
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]