Skip to content
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 user label to ingested samples metrics #1533

Merged
merged 5 commits into from
Apr 5, 2022
Merged

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Mar 22, 2022

What this PR does

Add user label to ingested samples metrics:

  • cortex_ingester_ingested_samples_total
  • cortex_ingester_ingested_samples_failures_total

The motivation is that we need to be able to differentiate on the tenant when determining the percentage of samples getting dropped by our ingesters.

TODO:

  • Introduce recording rule for use from alerts
  • Determine if these changes are OK to introduce in Mimir 2.1.0 (i.e., are they breaking changes?)

Which issue(s) this PR fixes or relates to

Fixes #1531.

Checklist

  • Tests updated
  • [na] Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@aknuds1 aknuds1 added the enhancement New feature or request label Mar 22, 2022
@pracucci
Copy link
Collaborator

cortex_ingester_ingested_samples_total

This metric is used in several alerts. Adding a per-user label it will become high cardinality, and so such alerts more complex to evaluate. We should check if for some of such alerts we can use a different metric, or discuss alternative ideas (eg. add recording rule).

@aknuds1 aknuds1 force-pushed the feat/add-user-label branch 4 times, most recently from b9ac9c1 to f5b5d67 Compare March 24, 2022 09:10
@aknuds1 aknuds1 changed the title WIP: Add user label to ingested samples metrics Add user label to ingested samples metrics Mar 24, 2022
@aknuds1 aknuds1 marked this pull request as ready for review March 24, 2022 15:14
@aknuds1 aknuds1 requested a review from pracucci March 24, 2022 15:14
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM. Let's look at where these metrics are used and then we can merge.

@aknuds1 aknuds1 marked this pull request as draft March 24, 2022 16:26
@aknuds1
Copy link
Contributor Author

aknuds1 commented Mar 24, 2022

Note to self:

Marco suggests adding recording rule named cluster_job_instance:cortex_ingester_ingested_samples_total:rate1m:

sum by(cluster, job, instance) (rate(cortex_ingester_ingested_samples_total[1m]))

@aknuds1 aknuds1 force-pushed the feat/add-user-label branch 4 times, most recently from 26be470 to 38187ff Compare March 29, 2022 14:28
@aknuds1 aknuds1 marked this pull request as ready for review March 29, 2022 14:28
@aknuds1 aknuds1 force-pushed the feat/add-user-label branch 2 times, most recently from 211aa0e to 815b548 Compare March 29, 2022 14:45
@aknuds1 aknuds1 requested a review from pracucci March 29, 2022 14:46
@aknuds1
Copy link
Contributor Author

aknuds1 commented Mar 29, 2022

@pracucci with the help of @pstibrany I've crafted in total three rules, and converted relevant alerts to use them. PTAL when you have the time :)

operations/mimir-mixin/recording_rules.libsonnet Outdated Show resolved Hide resolved
operations/mimir-mixin/recording_rules.libsonnet Outdated Show resolved Hide resolved
operations/mimir-mixin/alerts/blocks.libsonnet Outdated Show resolved Hide resolved
operations/mimir-mixin/alerts/blocks.libsonnet Outdated Show resolved Hide resolved
operations/mimir-mixin/alerts/blocks.libsonnet Outdated Show resolved Hide resolved
operations/mimir-mixin/alerts/blocks.libsonnet Outdated Show resolved Hide resolved
@CLAassistant
Copy link

CLAassistant commented Mar 31, 2022

CLA assistant check
All committers have signed the CLA.

@pstibrany
Copy link
Member

Please rebase this PR on top of main to make all required test checks pass.

Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! The recording and alerting rules LGTM 👏

There's just a thing I would like you to check: why the compiled mixin .yaml files have been reformatted? I can't explain it. Could you try to change the make build-mixin target to run in the build-image (needs to be moved in the Makefile) and check if they're still reformatted?

@pracucci pracucci mentioned this pull request Apr 1, 2022
3 tasks
@pracucci
Copy link
Collaborator

pracucci commented Apr 1, 2022

There's just a thing I would like you to check: why the compiled mixin .yaml files have been reformatted? I can't explain it. Could you try to change the make build-mixin target to run in the build-image (needs to be moved in the Makefile) and check if they're still reformatted?

I answered my question (and fixed Makefile) in this PR:
#1606

Please rebase once merged. Thanks!

aknuds1 and others added 5 commits April 5, 2022 09:09
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aknuds1 aknuds1 merged commit adc4626 into main Apr 5, 2022
@aknuds1 aknuds1 deleted the feat/add-user-label branch April 5, 2022 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add user label to cortex_ingester_ingested_samples_failures_total and cortex_ingester_ingested_samples_total
4 participants