-
Notifications
You must be signed in to change notification settings - Fork 797
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
Improve validation metrics for discarded samples and exemplars #6218
Improve validation metrics for discarded samples and exemplars #6218
Conversation
Signed-off-by: Ben Ye <[email protected]>
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.
Probably needs a test 😁
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.
Should we create a new metric for discarded histograms? Perhaps add a new label to this metric called type
like we do in
cortex/pkg/distributor/distributor.go
Line 636 in c6048fa
d.incomingSamples.WithLabelValues(userID, sampleMetricTypeHistogram).Add(float64(numHistogramSamples)) |
@CharlieTLe I think we can add that but it will be a big change. Probably all the DiscardedSamples code we need to separate float and native histogram samples. We can create a separate issue to discuss and track that. |
Signed-off-by: Ben Ye <[email protected]>
@friedrichg Updated unit tests |
pkg/distributor/distributor_test.go
Outdated
require.Equal(t, testutil.ToFloat64(ds[0].validateMetrics.DiscardedSamples.WithLabelValues(validation.DroppedByRelabelConfiguration, id)), float64(1)) | ||
require.Equal(t, testutil.ToFloat64(ds[0].validateMetrics.DiscardedExemplars.WithLabelValues(validation.DroppedByRelabelConfiguration, id)), float64(2)) | ||
require.Equal(t, testutil.ToFloat64(ds[0].receivedSamples.WithLabelValues(id, "float")), float64(1)) | ||
require.Equal(t, testutil.ToFloat64(ds[0].receivedSamples.WithLabelValues(id, "histogram")), float64(0)) |
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.
Should we test ingesting a native histogram and see it be discarded?
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.
Updated in latest commit
Signed-off-by: Ben Ye <[email protected]>
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.
Thanks!
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.
Thanks!
What this PR does:
In Distributor's validation logic, we currently update
DiscardedSamples
metric when there is no label.However, it doesn't count native histogram samples, only normal samples. It doesn't track discarded exemplars or track it in a wrong way https://github.com/cortexproject/cortex/blob/master/pkg/distributor/distributor.go#L898
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]