stakater / Reloader

A Kubernetes controller to watch changes in ConfigMap and Secrets and do rolling upgrades on Pods with their associated Deployment, StatefulSet, DaemonSet and DeploymentConfig – [✩Star] if you're using it!
https://docs.stakater.com/reloader/
Apache License 2.0
7.47k stars 498 forks source link

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

Closed alexanderldavis closed 3 months ago

alexanderldavis commented 3 months ago

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.

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 3 months ago

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

github-actions[bot] commented 3 months ago

@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 commented 3 months ago

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

alexanderldavis commented 3 months ago

@MuneebAijaz resolved! Thank you