-
Notifications
You must be signed in to change notification settings - Fork 807
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
Add discarded samples per labelset metric #6464
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ben Ye <[email protected]>
pkg/ingester/ingester.go
Outdated
updateLabelSetCounter := func(matchedLabelSetLimits []validation.LimitsPerLabelSet, reason string) { | ||
for _, l := range matchedLabelSetLimits { | ||
if c, exists := labelSetCounters[l.Hash]; exists { | ||
c.reasonCounter[reason]++ | ||
} else { | ||
labelSetCounters[l.Hash] = &labelsCounter{ | ||
reasonCounter: map[string]int{ | ||
reason: 1, | ||
}, | ||
lbls: l.LabelSet, | ||
} | ||
} | ||
} | ||
} | ||
|
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.
Could this be a function of the (l *Limits)
struct?
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.
Made it a function of the struct
ok.. this is ok i guess as the new metric will only be available if the "per labelset limit" is configure. |
Signed-off-by: Ben Ye <[email protected]>
What this PR does:
Add
cortex_discarded_samples_per_labelset_total
metric to record samples discarded for each configured label set limit.The
labelSetTracker
added in #6443 was part of the distributor package. I refactored that and use the same data structure to track label set used by validate metrics.Note that not all discarded samples reason supports this per labelset metric. Certain reasons such as too many HA groups, ingestion rate exceeded just drops the whole push request instead of an individual series. So in order to get per labelset discarded samples we have to iterate over all series labels, which is possible to have performance impact so I didn't do that in this PR.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]