Skip to content

fix: improve Prometheus metrics naming conventions#1

Closed
the3mi wants to merge 1 commit into
masterfrom
fix/prometheus-metrics-naming-conventions
Closed

fix: improve Prometheus metrics naming conventions#1
the3mi wants to merge 1 commit into
masterfrom
fix/prometheus-metrics-naming-conventions

Conversation

@the3mi
Copy link
Copy Markdown
Collaborator

@the3mi the3mi commented Mar 6, 2026

Based on Prometheus best practices:

Changes

  1. Unix Timestamps - Changed openclaw_cron_job_last_run_age_seconds and openclaw_cron_job_next_run_in_seconds to 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_seconds

  2. Base Units - Changed openclaw_cron_job_last_duration_ms to openclaw_cron_job_last_duration_seconds (use seconds per Prometheus naming conventions)

  3. Gauge Naming - Removed _total suffix from:

    • openclaw_md_workspace_total_bytesopenclaw_md_workspace_bytes
    • openclaw_md_workspace_total_tokens_estimatedopenclaw_md_workspace_tokens_estimated

    (The _total suffix should only be used for counter metrics, not gauges)

  4. 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 (use openclaw_cron_job_last_run_at_seconds)
  • openclaw_cron_job_next_run_in_seconds → removed (use openclaw_cron_job_next_run_at_seconds)
  • openclaw_cron_job_last_duration_msopenclaw_cron_job_last_duration_seconds
  • openclaw_md_workspace_total_bytesopenclaw_md_workspace_bytes
  • openclaw_md_workspace_total_tokens_estimatedopenclaw_md_workspace_tokens_estimated

See Prometheus best practices:

- 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
@SammyLin SammyLin closed this Mar 6, 2026
@SammyLin SammyLin deleted the fix/prometheus-metrics-naming-conventions branch March 6, 2026 07:04
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