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

feat: add new opt-in metric of reloads by namespace #690

Merged

Conversation

alexanderldavis
Copy link
Contributor

Reloader currently keeps track of the number of successful and failed reloads. This is useful for general debugging, but in some cases it would also be useful to monitor reloads by namespace.

To implement this, I created a new metric (reload_executed_total_by_namespace) with success and namespace as attributes and disabled it by default, since the cardinality of the metric might get high if it is deployed in a cluster where Reloader manages resources in many namespaces. To keep the code changes minimal, I created a new Prometheus counter and have it increment per-namespace at the same time as the global counter, but I only register the counter if the opt-in flag is set.

I've tested these changes on a cluster I manage, and verified that by default it does not expose the new metric. When the environment variable is set, it looks like this:

image

I've also updated the Helm chart, docs, and README to reflect this new feature.

Copy link

github-actions bot commented Jun 14, 2024

@MuneebAijaz Image is available for testing. docker pull ghcr.io/stakater/docs/reloader:v1.0.112

Copy link

@alexanderldavis Image is available for testing. docker pull ghcr.io/stakater/docs/stakater/reloader:SNAPSHOT-PR-690-09d90532

Copy link

@alexanderldavis Yikes! You better fix it before anyone else finds out! Build has Failed!

Copy link

@alexanderldavis Yikes! You better fix it before anyone else finds out! Build has Failed!

Copy link

@alexanderldavis Image is available for testing. docker pull ghcr.io/stakater/docs/stakater/reloader:SNAPSHOT-PR-690-6cd458b8

Copy link

@alexanderldavis Images are available for testing. docker pull ghcr.io/stakater/reloader:SNAPSHOT-PR-690-6cd458b8\ndocker pull ghcr.io/stakater/reloader:SNAPSHOT-PR-690-UBI-6cd458b8

@MuneebAijaz
Copy link
Contributor

@alexanderldavis hi, can u pls take care of the unresolved comment, then we can merge this

@alexanderldavis
Copy link
Contributor Author

@MuneebAijaz resolved! Thank you

@MuneebAijaz MuneebAijaz merged commit 7f5ea8c into stakater:master Jun 21, 2024
10 checks passed
@alexanderldavis alexanderldavis deleted the enable_metrics_by_namespace branch June 23, 2024 22:09
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.

2 participants