Skip to main content
Moda ingests OpenClaw telemetry natively: spans exported by OpenClaw’s diagnostics-otel plugin are accepted on the ingestion API’s /v1/traces endpoint and grouped into conversations by OpenClaw session. The Moda SDK for Node.js ships helpers that generate the plugin configuration and the OTLP environment variables. The OpenClaw helpers are Node.js only — the Python SDK does not include them.

Prerequisites

  • Node.js 18 or later with moda-ai installed (npm install moda-ai)
  • An OpenClaw installation with the diagnostics-otel plugin available
  • A Moda API key, created at Settings → Ingestion keys (see Authentication)

Set up

1

Generate the telemetry configuration

Moda.getOpenClawTelemetryConfig() returns the configuration object OpenClaw’s diagnostics-otel plugin expects, pre-filled with Moda’s OTLP endpoint and your API key:
generate-config.ts
Output
Merge this object into your OpenClaw configuration.
2

Or generate environment variables for spawned processes

If you launch OpenClaw as a subprocess, Moda.getOpenClawEnvironment() returns the equivalent OTEL_* environment variables:
launch.ts
The returned map contains:
3

Verify

Run an OpenClaw session, then open Conversations in the dashboard. Within minutes you should see a conversation per OpenClaw session containing model usage and processed-message entries.
The ingestion API stores traces only — there are no /v1/metrics or /v1/logs endpoints. Set enableMetrics: false and enableLogs: false unless another OTLP backend consumes those signals.

Helper options

Both helpers accept the same options; getOpenClawEnvironment additionally accepts extraEnv. The helpers do not require Moda.init() to have run: they are the only part of the Node.js SDK that falls back to the MODA_API_KEY and MODA_BASE_URL environment variables. If no key can be resolved, they throw [Moda] MODA_API_KEY is required for OpenClaw telemetry helpers.

What Moda extracts from OpenClaw spans

Two OpenClaw span names are mapped into conversation data; other openclaw.* spans are ignored. Attributes read from those spans: When neither openclaw.sessionId nor openclaw.sessionKey is present, grouping falls back to the OTLP trace ID.

Trace your own OpenClaw operations

Moda.withOpenClawOperation() wraps gateway or CLI lifecycle work in a span named openclaw.<operation> with llm.vendor: openclaw. Conversation and user IDs come from the options, or from the ambient Moda context when omitted. Errors are recorded on the span and re-thrown.
operations.ts
Operation spans record timing and errors but do not create conversation messages. Message content comes from OpenClaw’s own openclaw.model.usage and openclaw.message.processed spans.

Troubleshooting

Next steps