---
title: "OpenClaw Tracing"
description: "Send OpenClaw Gateway traces to the Judgment platform via OpenTelemetry."
sidebar:
  label: "OpenClaw"
seo:
  title: "OpenClaw Tracing with Judgment | Agent Framework Integration Docs"
  description: "Trace OpenClaw agent executions with Judgment, including tool calls, handoffs, spans, and behavior for production agent monitoring."
---

**OpenClaw integration** sends traces from your [OpenClaw Gateway](https://docs.openclaw.ai) to Judgment. OpenClaw's `diagnostics-otel` plugin exports traces over OTLP/HTTP, which Judgment ingests natively — no SDK code required.

## How It Works

OpenClaw emits structured diagnostics events for model runs, tool execution, message flow, and more. The `diagnostics-otel` plugin converts those events into OpenTelemetry spans and exports them over OTLP/HTTP (protobuf) to any compatible backend, including Judgment.

## Quickstart

1. ### Install the Plugin

    ```bash
    openclaw plugins install clawhub:@openclaw/diagnostics-otel
    ```

2. ### Set Judgment Credentials

    ```bash
    export JUDGMENT_API_KEY="<JUDGMENT_API_KEY>"
    export JUDGMENT_ORG_ID="<JUDGMENT_ORG_ID>"
    export JUDGMENT_PROJECT_ID="<JUDGMENT_PROJECT_ID>"
    ```

    > **Tip**
    >
    > To find `JUDGMENT_PROJECT_ID`, open the project in the Judgment app and copy
    > the project ID from the URL, or press `Ctrl-K` and search for the project ID
    > shortcut.

3. ### Configure the Gateway

    Point the `diagnostics-otel` plugin at Judgment's OTLP endpoint in your OpenClaw config:

    ```json5 title="openclaw.config.json5"
    {
      plugins: {
        allow: ["diagnostics-otel"],
        entries: {
          "diagnostics-otel": { enabled: true },
        },
      },
      diagnostics: {
        enabled: true,
        otel: {
          enabled: true,
          endpoint: "https://api.judgmentlabs.ai/otel",
          protocol: "http/protobuf",
          serviceName: "openclaw-gateway",
          headers: {
            "Authorization": "Bearer <JUDGMENT_API_KEY>",
            "X-Organization-Id": "<JUDGMENT_ORG_ID>",
            "X-Project-Id": "<JUDGMENT_PROJECT_ID>",
          },
          traces: true,
          metrics: false,
          logs: false,
        },
      },
    }
    ```

    > **Info**
    >
    > Judgment ingests **traces** from the OTLP endpoint. Set `metrics` and
    > `logs` to `false` unless you are also routing them to a separate collector.

4. ### Verify

    Make a chat completion call through the gateway and open your project in the
    [Judgment app](https://app.judgmentlabs.ai). Traces for model calls, tool
    execution, and harness lifecycle will appear within a few seconds.

## Environment Variable Override

Instead of hard-coding the endpoint in your config file, you can set these
environment variables. OpenClaw reads them at startup:

```bash
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.judgmentlabs.ai/otel"
export OTEL_SERVICE_NAME="openclaw-gateway"
```

Config-file values take precedence over environment variables when both are set.

## Content Capture

By default, OpenClaw exports only structural span metadata (model, provider,
token counts, duration) — no prompt or response text. To include content in
your Judgment traces, enable the relevant `captureContent` subkeys:

```json5 title="openclaw.config.json5"
{
  diagnostics: {
    otel: {
      captureContent: {
        inputMessages: true,
        outputMessages: true,
        toolInputs: true,
        toolOutputs: true,
      },
    },
  },
}
```

> **Warning**
>
> Enabling content capture sends prompt and response text to the OTLP endpoint.
> Only enable this when your data retention policy permits it.

## What's Captured

| Signal | Details |
| --- | --- |
| Model calls | Spans for every provider call with model name, token usage, cost, and duration. |
| Tool execution | Spans for tool invocations with tool name and source. |
| Harness lifecycle | Spans for agent run orchestration, context assembly, and skill usage. |
| Failover | Spans and attributes when the gateway fails over between providers. |

## Next Steps

- [Instrument your agent](/documentation/tracing/instrumentation) - Configure and verify Judgment tracing beyond this integration.
- [Monitor a behavior](/documentation/monitoring) - Monitor your AI applications in production with behavioral scoring.
- [Dual Export](/documentation/integrations/tracing-providers/dual-export) - Send traces to Judgment alongside your existing observability provider.
- [OpenClaw OpenTelemetry Docs](https://docs.openclaw.ai/gateway/opentelemetry) - Full reference for OpenClaw's `diagnostics-otel` plugin.
