fix: improve Prometheus metrics naming conventions#1
Closed
the3mi wants to merge 1 commit into
Closed
Conversation
- Rename last_run_age_seconds/next_run_in_seconds to use Unix timestamps (last_run_at_seconds/next_run_at_seconds) - Rename last_duration_ms to last_duration_seconds (use base units) - Rename workspace_total_bytes to workspace_bytes (remove _total suffix from gauges) - Rename workspace_total_tokens_estimated to workspace_tokens_estimated - Update Grafana dashboard and documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on Prometheus best practices:
Changes
Unix Timestamps - Changed
openclaw_cron_job_last_run_age_secondsandopenclaw_cron_job_next_run_in_secondsto use Unix timestamps (last_run_at_seconds,next_run_at_seconds). Now you can compute age dynamically in PromQL:time() - openclaw_cron_job_last_run_timestamp_secondsBase Units - Changed
openclaw_cron_job_last_duration_mstoopenclaw_cron_job_last_duration_seconds(use seconds per Prometheus naming conventions)Gauge Naming - Removed
_totalsuffix from:openclaw_md_workspace_total_bytes→openclaw_md_workspace_bytesopenclaw_md_workspace_total_tokens_estimated→openclaw_md_workspace_tokens_estimated(The
_totalsuffix should only be used for counter metrics, not gauges)Updated Grafana dashboard and both English/Chinese README documentation
Breaking Changes
These metric names have changed - you'll need to update your Grafana dashboards:
openclaw_cron_job_last_run_age_seconds→ removed (useopenclaw_cron_job_last_run_at_seconds)openclaw_cron_job_next_run_in_seconds→ removed (useopenclaw_cron_job_next_run_at_seconds)openclaw_cron_job_last_duration_ms→openclaw_cron_job_last_duration_secondsopenclaw_md_workspace_total_bytes→openclaw_md_workspace_bytesopenclaw_md_workspace_total_tokens_estimated→openclaw_md_workspace_tokens_estimatedSee Prometheus best practices: