OpenClaw は公式のDocumentation Index
Fetch the complete documentation index at: https://docs2.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
diagnostics-prometheus Plugin を通じて診断メトリクスを公開できます。信頼済みの内部診断をリッスンし、Prometheus テキストエンドポイントを次でレンダリングします。
text/plain; version=0.0.4; charset=utf-8 です。
トレース、ログ、OTLP push、OpenTelemetry GenAI semantic attributes については、OpenTelemetry export を参照してください。
クイックスタート
diagnostics.enabled: true が必要です。これがない場合でも Plugin は HTTP ルートを登録しますが、診断イベントはエクスポーターに流れないため、レスポンスは空になります。エクスポートされるメトリクス
| メトリクス | 型 | ラベル |
|---|---|---|
openclaw_run_completed_total | カウンター | channel, model, outcome, provider, trigger |
openclaw_run_duration_seconds | ヒストグラム | channel, model, outcome, provider, trigger |
openclaw_model_call_total | カウンター | api, error_category, model, outcome, provider, transport |
openclaw_model_call_duration_seconds | ヒストグラム | api, error_category, model, outcome, provider, transport |
openclaw_model_tokens_total | カウンター | agent, channel, model, provider, token_type |
openclaw_gen_ai_client_token_usage | ヒストグラム | model, provider, token_type |
openclaw_model_cost_usd_total | カウンター | agent, channel, model, provider |
openclaw_tool_execution_total | カウンター | error_category, outcome, params_kind, tool |
openclaw_tool_execution_duration_seconds | ヒストグラム | error_category, outcome, params_kind, tool |
openclaw_harness_run_total | カウンター | channel, error_category, harness, model, outcome, phase, plugin, provider |
openclaw_harness_run_duration_seconds | ヒストグラム | channel, error_category, harness, model, outcome, phase, plugin, provider |
openclaw_message_processed_total | カウンター | channel, outcome, reason |
openclaw_message_processed_duration_seconds | ヒストグラム | channel, outcome, reason |
openclaw_message_delivery_started_total | カウンター | channel, delivery_kind |
openclaw_message_delivery_total | カウンター | channel, delivery_kind, error_category, outcome |
openclaw_message_delivery_duration_seconds | ヒストグラム | channel, delivery_kind, error_category, outcome |
openclaw_talk_event_total | カウンター | brain, event_type, mode, provider, transport |
openclaw_talk_event_duration_seconds | ヒストグラム | brain, event_type, mode, provider, transport |
openclaw_talk_audio_bytes | ヒストグラム | brain, event_type, mode, provider, transport |
openclaw_queue_lane_size | ゲージ | lane |
openclaw_queue_lane_wait_seconds | ヒストグラム | lane |
openclaw_session_state_total | カウンター | reason, state |
openclaw_session_queue_depth | ゲージ | state |
openclaw_session_recovery_total | カウンター | action, active_work_kind, state, status |
openclaw_session_recovery_age_seconds | ヒストグラム | action, active_work_kind, state, status |
openclaw_memory_bytes | ゲージ | kind |
openclaw_memory_rss_bytes | ヒストグラム | なし |
openclaw_memory_pressure_total | カウンター | level, reason |
openclaw_telemetry_exporter_total | カウンター | exporter, reason, signal, status |
openclaw_prometheus_series_dropped_total | カウンター | なし |
ラベルポリシー
Bounded, low-cardinality labels
Bounded, low-cardinality labels
Prometheus ラベルは、境界付きで低カーディナリティに保たれます。エクスポーターは
runId、sessionKey、sessionId、callId、toolCallId、メッセージ ID、チャット ID、プロバイダーリクエスト ID などの生の診断識別子を出力しません。ラベル値は秘匿化され、OpenClaw の低カーディナリティ文字ポリシーに一致する必要があります。ポリシーに合わない値は、メトリクスに応じて unknown、other、または none に置き換えられます。時系列の上限とオーバーフロー計上
時系列の上限とオーバーフロー計上
エクスポーターは、カウンター、ゲージ、ヒストグラムを合わせてメモリ内に保持する時系列を 2048 系列に制限します。その上限を超える新しい系列は破棄され、そのたびに
openclaw_prometheus_series_dropped_total が 1 増加します。このカウンターは、上流の属性が高カーディナリティ値を漏らしていることを示す強いシグナルとして監視してください。エクスポーターが上限を自動的に引き上げることはありません。増加している場合は、上限を無効化するのではなく原因を修正してください。Prometheus 出力に決して現れないもの
Prometheus 出力に決して現れないもの
- プロンプトテキスト、応答テキスト、ツール入力、ツール出力、システムプロンプト
- Talk の文字起こし、音声ペイロード、通話 ID、ルーム ID、ハンドオフトークン、ターン ID、生のセッション ID
- 生のプロバイダーリクエスト ID(該当する場合は、境界付きハッシュのみがスパンに含まれます。メトリクスには決して含まれません)
- セッションキーとセッション ID
- ホスト名、ファイルパス、シークレット値
PromQL レシピ
Prometheus エクスポートと OpenTelemetry エクスポートの選択
OpenClaw は両方のサーフェスを独立してサポートしています。どちらか一方、両方、またはどちらも実行しない構成が可能です。- diagnostics-prometheus
- diagnostics-otel
- プルモデル: Prometheus が
/api/diagnostics/prometheusをスクレイプします。 - 外部コレクターは不要です。
- 通常の Gateway 認証を通じて認証されます。
- サーフェスはメトリクスのみです(トレースやログはありません)。
- Prometheus + Grafana で既に標準化されているスタックに最適です。
トラブルシューティング
空のレスポンス本文
空のレスポンス本文
- config で
diagnostics.enabled: trueを確認します。 - Plugin が有効化され、
openclaw plugins list --enabledで読み込まれていることを確認します。 - いくらかのトラフィックを生成します。カウンターとヒストグラムは、少なくとも 1 つのイベントが発生した後にだけ行を出力します。
401 / 未認可
401 / 未認可
エンドポイントには Gateway オペレータースコープ(
auth: "gateway" と gatewayRuntimeScopeSurface: "trusted-operator")が必要です。他の Gateway オペレータールートで Prometheus が使用しているものと同じトークンまたはパスワードを使用してください。公開の未認証モードはありません。`openclaw_prometheus_series_dropped_total` が増加している
`openclaw_prometheus_series_dropped_total` が増加している
新しい属性が 2048 系列の上限を超えています。最近のメトリクスを調べ、予期せず高カーディナリティになっているラベルを見つけ、原因を修正してください。エクスポーターは、ラベルを黙って書き換えるのではなく、意図的に新しい系列を破棄します。
再起動後に Prometheus が古い系列を表示する
再起動後に Prometheus が古い系列を表示する
Plugin は状態をメモリ内にのみ保持します。Gateway の再起動後、カウンターはゼロにリセットされ、ゲージは次に報告された値から再開します。リセットを適切に扱うには、PromQL の
rate() と increase() を使用してください。関連
- 診断エクスポート — サポートバンドル用のローカル診断 zip
- ヘルスと準備状態 —
/healthzと/readyzプローブ - ロギング — ファイルベースのロギング
- OpenTelemetry エクスポート — トレース、メトリクス、ログ向けの OTLP プッシュ