-
Notifications
You must be signed in to change notification settings - Fork 802
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
Adds new metric for dropped samples in ingester #4503
Adds new metric for dropped samples in ingester #4503
Conversation
6f29446
to
cba3971
Compare
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 for the PR; I think there are a number of unnecessary changes, or if they are necessary they should go in a different PR.
A good cross-check is to make sure all changes are explained in the commit message.
07b6257
to
740296a
Compare
@bboreham @alvinlin123 anything else I should be doing here? Can I have further feedback on the PR? |
c45ca83
to
9a28d7c
Compare
3c1a0b8
to
847d6c6
Compare
847d6c6
to
459dce2
Compare
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.
Sorry I let this languish for a while.
Insisting on __name__
is optional -
cortex/pkg/util/validation/limits.go
Line 137 in 4e9fc3a
f.BoolVar(&l.EnforceMetricName, "validation.enforce-metric-name", true, "Enforce every sample has a metric name.") |
so please don't add more checks for
__name__
. Just check whether any labels remain.
pkg/distributor/distributor.go
Outdated
@@ -637,6 +637,14 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co | |||
|
|||
if mrc := d.limits.MetricRelabelConfigs(userID); len(mrc) > 0 { | |||
l := relabel.Process(cortexpb.FromLabelAdaptersToLabels(ts.Labels), mrc...) | |||
if len(l) == 0 { | |||
// all labels are gone, therefore the __name__ label is not present, samples will 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.
remove mention of __name__
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.
Done.
pkg/distributor/distributor.go
Outdated
@@ -651,7 +659,12 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co | |||
removeLabel(labelName, &ts.Labels) | |||
} | |||
|
|||
if len(ts.Labels) == 0 { | |||
if len(ts.Labels) == 0 || wasNameLabelRemoved(ts.Labels) { |
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.
Don't look at __name__
.
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.
Sure thing, done.
I changed as suggested, I think this is finally good to go. Please let me know if I should do anything else. On my machine, linting and tests are passing. |
…ow of distributor Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
…rom other test runs Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
50d2281
to
c29bd27
Compare
@bboreham sorry for the endless ping, but I just want to make sure you get notifications. I implemented your last comments a while ago, checking back to see if this is good to go. |
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.
LGTM, thanks!
@alvinlin123 can you please recheck as well so we can merge this? I am going to do yet another rebase. |
* Adding test case for dropping metrics by name to understand better flow of distributor Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Adding test case and new metric for dropped samples Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Updating CHANGELOG with new changes Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Fixing linting problem on distributor file Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Reusing discarded samples metric from validate package Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Compare labelset with len() instead of comparing to nil Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Undoing unnecessary changes on tests and distributor Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Small rename on comment Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Fixing linting offenses Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Reseting validation dropped samples metric to avoid getting metrics from other test runs Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Resolving problems after rebase conflicts Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Registering counter for dropped metrics in test Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Checking if user label drop configuration did not drop __name__ label Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> * Do not check for name label, adding new test Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com> Signed-off-by: Alvin Lin <alvinlin@amazon.com>
What this PR does: As described in #3954, this PR adds a new metric
distributor_discarded_samples_total
to representthe number of dropped samples due to relabeling configuration.
Which issue(s) this PR fixes:
Fixes #3954
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]