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

Test and fix custom labels support in mixin #1697

Merged
merged 4 commits into from
Apr 19, 2022
Merged

Test and fix custom labels support in mixin #1697

merged 4 commits into from
Apr 19, 2022

Conversation

pracucci
Copy link
Collaborator

What this PR does

We just merged #1651 which adds support to customise the cluster label. We already had config options to customise the instance (eg. pod) and node labels.

However, are we relatively confident the labels customization is applied everywhere? It's very difficult to spot during code reviews, so I though if we could add any test. In this PR I'm proposing to introduce a basic test (in bash) checking if, after renaming cluster/instance/node labels, they're still used somewhere.

Thanks to these tests, I've spot several issues that I'm fixing in this PR too. In theory this PR should be a noop when mixin is compiled with default config, but you will see diff in operations/mimir-mixin-compiled/alerts.yaml. Reason is that fix these issues I changed the usage of hardcoded instance label with the configured one which is pod. At Grafana Labs, instance and pod labels can be used interchangeably, because they both identify the pod.

Which issue(s) this PR fixes or relates to

N/A

Checklist

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

@@ -1,10 +1,10 @@
{
prometheusAlerts+::
{ _config:: $._config + $._group_config } +
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved here so I can extend _config in alert-utils.libsonnet.

@pracucci pracucci marked this pull request as ready for review April 13, 2022 16:35
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Co-authored-by: Ursula Kallio <ursula.kallio@grafana.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Makefile Show resolved Hide resolved
Copy link
Contributor

@replay replay left a comment

Choose a reason for hiding this comment

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

This looks great, thanks! I just added some comments of minor importance

@pracucci
Copy link
Collaborator Author

I will wait next week before merging, both to give the opportunity to other engineers to review it and not deploy these alerts changes right before Easter.

@pracucci
Copy link
Collaborator Author

I double checked the compiled alerts, manually tested few alerts and changes LGTM. Going to merge it.

@pracucci pracucci merged commit 176c1c9 into main Apr 19, 2022
@pracucci pracucci deleted the add-mixin-tests branch April 19, 2022 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants