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

[CI] Always send a heartbeat metric #122708

Closed
wants to merge 3 commits into from
Closed

Conversation

Keenuts
Copy link
Contributor

@Keenuts Keenuts commented Jan 13, 2025

This script was setup to only upload metrics to Grafana when a new workflow was available.
If either the Grafana or github token becomes stale, no metrics would get recorded either.

We have alerting in place to detect a lack of update, but because we only uploaded metrics on new workflows, we could have normal cases were no data would get uploaded for a few hours (example, late night weekend).
For those reasons, the delay before alerting for no-data had to be set quite high.

By adding a fixed heartbeat in the uploaded metrics, we know we MUST receive at least 1 metric every 5 minutes, and can have a more reactive monitoring.

This script was setup to only upload metrics to Grafana when
a new workflow was available.
If either the Grafana or github token becomes stale, no metrics would
get recorded either.

We have alerting in place to detect a lack of update, but because we
only uploaded metrics on new workflows, we could have normal cases were
no data would get uploaded for a few hours (example, late night
weekend).
For those reasons, the delay before alerting for no-data had to be set
quite high.

By adding a fixed heartbeat in the uploaded metrics, we know we MUST
receive at least 1 metric every 5 minutes, and can have a more reactive
monitoring.

Signed-off-by: Nathan Gauër <[email protected]>
@Keenuts
Copy link
Contributor Author

Keenuts commented Jan 13, 2025

Tested locally by setting the 3 env variables, new metrics are showing in Grafana

$ export GRAFANA_METRICS_USERID=XXX
$ export GRAFANA_API_KEY=XXX
$ export GITHUB_TOKEN=XXX
$ python3 metrics.py
Uploaded 3 metrics

metrics

Copy link

github-actions bot commented Jan 13, 2025

✅ With the latest revision this PR passed the Python code formatter.

@Keenuts Keenuts closed this Jan 13, 2025
@Keenuts Keenuts deleted the metrics-heartbeat branch January 13, 2025 16:40
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.

1 participant