# Set up OpenTelemetry metrics for OpenClaw

Canonical: https://cwyn.com/pages/openclaw-guide-first-opentelemetry-export.html
Last updated: 2026-11-23T07:48:51-05:00

OpenClaw operations guide

Short answer. Connect the OpenClaw Gateway to an OTLP/HTTP collector and confirm that a test turn produces a model token metric. Use an existing private collector that accepts OTLP over HTTP with protobuf. Note its base URL as seen by the Gateway.

Last updated November 23, 2026 · Published November 19, 2026

By CWYN · Reviewed November 19, 2026 against OpenClaw 2026.11.6

## 1. Choose a collector reachable from the Gateway

Use an existing private collector that accepts OTLP over HTTP with protobuf. Note its base URL as seen by the Gateway. The [export configuration reference](https://docs.openclaw.ai/gateway/opentelemetry/configuration) explains how OpenClaw appends the metrics path to that URL.

## 2. Install the diagnostics exporter

Run the install command on the Gateway host. If you maintain a plugin allowlist, add `diagnostics-otel` to the existing list. Keep the other plugin entries. The [exporter setup reference](https://docs.openclaw.ai/gateway/opentelemetry/setup) shows the required plugin settings.

```
openclaw plugins install @openclaw/diagnostics-otel
```

## 3. Enable metrics for the test

Use `openclaw config file` to locate the active config. Merge in these settings and replace the example collector address. This test enables metrics and leaves trace and log export off. Run [`openclaw config validate`](https://docs.openclaw.ai/cli/config) after saving.

```
{
  plugins: { entries: { "diagnostics-otel": { enabled: true } } },
  diagnostics: {
    enabled: true,
    otel: {
      enabled: true,
      endpoint: "http://otel-collector:4318",
      protocol: "http/protobuf",
      serviceName: "openclaw-gateway",
      metrics: true,
      traces: false,
      logs: false,
    },
  },
}
```

## 4. Run one Gateway-backed model turn

With the Gateway running, replace `<agent-id>` with your test agent’s ID and run the [agent command](https://docs.openclaw.ai/cli/agent). Use an agent and model that report token usage.

```
openclaw agent --agent <agent-id> --message "Reply with metrics test"
```

## 5. Verify the metric at the receiver

Allow the exporter to flush, then look in your collector or its backend for the [`openclaw.tokens`](https://docs.openclaw.ai/gateway/opentelemetry/model-calls-and-metrics) counter under the configured service. Check the provider and model attributes against the test agent. If nothing arrives, run `openclaw status --all` to inspect the Gateway’s redacted exporter health and confirm the collector accepts OTLP/HTTP.

[Get your free CWYN Score](https://cwyn.com/pages/score.html)

## Related guides

- [OpenClaw runaway API bill: find and stop the token spend](https://cwyn.com/pages/openclaw-guide-runaway-api-bills.html)
- [OpenClaw Gateway high CPU: diagnose event-loop lag and disconnects](https://cwyn.com/pages/openclaw-guide-gateway-high-cpu.html)
- [OpenClaw Gateway RAM keeps growing: measure memory pressure](https://cwyn.com/pages/openclaw-guide-gateway-memory-growth.html)

## Next steps

- [All 135 OpenClaw guides](https://cwyn.com/guides/openclaw/)
- [OpenClaw setup walkthrough](https://cwyn.com/setup/openclaw/)
- [CWYN Score](https://cwyn.com/pages/score.html)
- [OpenClaw Complete Setup Pack ($14.95)](https://cwyn.com/pages/pack-openclaw-complete-setup-pack.html)

### Review the model behind the test turn

Once the test metric arrives, use the cost checklist in the [OpenClaw Complete Setup Pack ($14.95)](https://cwyn.com/pages/pack-openclaw-complete-setup-pack.html), an optional paid kit, to review the model and scheduled jobs.
Kit details as of Nov 18, 2026

OpenClaw Complete Setup Pack $14.95

Start an OpenClaw workspace with editable instructions, local Gateway and tool presets, and checklists for pairing, memory, costs and rollback.
