惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
L
LangChain Blog
博客园_首页
Recent Announcements
Recent Announcements
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
博客园 - 叶小钗
博客园 - 【当耐特】
The Cloudflare Blog
J
Java Code Geeks
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat(diagnostics-prometheus): add protected metrics expor...
vincentkoc · 2026-04-26 · via Recent Commits to openclaw:main

@@ -0,0 +1,89 @@

1+

---

2+

summary: "Expose OpenClaw diagnostics as Prometheus text metrics through the diagnostics-prometheus plugin"

3+

title: "Prometheus metrics"

4+

read_when:

5+

- You want Prometheus, Grafana, VictoriaMetrics, or another scraper to collect OpenClaw Gateway metrics

6+

- You need the Prometheus metric names and label policy for dashboards or alerts

7+

- You want metrics without running an OpenTelemetry collector

8+

---

9+10+

OpenClaw can expose diagnostics metrics through the bundled

11+

`diagnostics-prometheus` plugin. It listens to trusted internal diagnostics and

12+

renders a Prometheus text endpoint at:

13+14+

```text

15+

/api/diagnostics/prometheus

16+

```

17+18+

The route uses Gateway authentication. Do not expose it as a public

19+

unauthenticated `/metrics` endpoint.

20+21+

## Quick start

22+23+

```json5

24+

{

25+

plugins: {

26+

allow: ["diagnostics-prometheus"],

27+

entries: {

28+

"diagnostics-prometheus": { enabled: true },

29+

},

30+

},

31+

diagnostics: {

32+

enabled: true,

33+

},

34+

}

35+

```

36+37+

You can also enable the plugin from the CLI:

38+39+

```bash

40+

openclaw plugins enable diagnostics-prometheus

41+

```

42+43+

Then scrape the protected Gateway route with the same Gateway authentication you

44+

use for operator APIs.

45+46+

## Metrics exported

47+48+

| Metric | Type | Labels |

49+

| --------------------------------------------- | --------- | ----------------------------------------------------------------------------------------- |

50+

| `openclaw_run_completed_total` | counter | `channel`, `model`, `outcome`, `provider`, `trigger` |

51+

| `openclaw_run_duration_seconds` | histogram | `channel`, `model`, `outcome`, `provider`, `trigger` |

52+

| `openclaw_model_call_total` | counter | `api`, `error_category`, `model`, `outcome`, `provider`, `transport` |

53+

| `openclaw_model_call_duration_seconds` | histogram | `api`, `error_category`, `model`, `outcome`, `provider`, `transport` |

54+

| `openclaw_model_tokens_total` | counter | `agent`, `channel`, `model`, `provider`, `token_type` |

55+

| `openclaw_gen_ai_client_token_usage` | histogram | `model`, `provider`, `token_type` |

56+

| `openclaw_model_cost_usd_total` | counter | `agent`, `channel`, `model`, `provider` |

57+

| `openclaw_tool_execution_total` | counter | `error_category`, `outcome`, `params_kind`, `tool` |

58+

| `openclaw_tool_execution_duration_seconds` | histogram | `error_category`, `outcome`, `params_kind`, `tool` |

59+

| `openclaw_harness_run_total` | counter | `channel`, `error_category`, `harness`, `model`, `outcome`, `phase`, `plugin`, `provider` |

60+

| `openclaw_harness_run_duration_seconds` | histogram | `channel`, `error_category`, `harness`, `model`, `outcome`, `phase`, `plugin`, `provider` |

61+

| `openclaw_message_processed_total` | counter | `channel`, `outcome`, `reason` |

62+

| `openclaw_message_processed_duration_seconds` | histogram | `channel`, `outcome`, `reason` |

63+

| `openclaw_message_delivery_total` | counter | `channel`, `delivery_kind`, `error_category`, `outcome` |

64+

| `openclaw_message_delivery_duration_seconds` | histogram | `channel`, `delivery_kind`, `error_category`, `outcome` |

65+

| `openclaw_queue_lane_size` | gauge | `lane` |

66+

| `openclaw_queue_lane_wait_seconds` | histogram | `lane` |

67+

| `openclaw_session_state_total` | counter | `reason`, `state` |

68+

| `openclaw_session_queue_depth` | gauge | `state` |

69+

| `openclaw_memory_bytes` | gauge | `kind` |

70+

| `openclaw_memory_rss_bytes` | histogram | none |

71+

| `openclaw_memory_pressure_total` | counter | `level`, `reason` |

72+

| `openclaw_telemetry_exporter_total` | counter | `exporter`, `reason`, `signal`, `status` |

73+

| `openclaw_prometheus_series_dropped_total` | counter | none |

74+75+

## Label policy

76+77+

Prometheus labels stay bounded and low-cardinality. The exporter does not emit

78+

raw diagnostic identifiers such as `runId`, `sessionKey`, `sessionId`, `callId`,

79+

`toolCallId`, message IDs, chat IDs, or provider request IDs.

80+81+

Label values are redacted and must match OpenClaw's low-cardinality character

82+

policy. Values that fail the policy are replaced with `unknown`, `other`, or

83+

`none`, depending on the metric.

84+85+

The exporter caps retained time series in memory. If the cap is reached, new

86+

series are dropped and `openclaw_prometheus_series_dropped_total` increments.

87+88+

For full traces, logs, OTLP export, and OpenTelemetry GenAI semantic attributes,

89+

use [OpenTelemetry export](/gateway/opentelemetry).