Documentation Index
Fetch the complete documentation index at: https://kawax.biz/llms.txt
Use this file to discover all available pages before exploring further.
OpenTelemetry
Copilot CLI includes built-in OpenTelemetry tracing. By configuring it in the SDK, you can collect trace data from the CLI process.Basic usage
Enable tracing for the CLI process
Add telemetry settings toconfig/copilot.php, or pass options directly.
TelemetryConfig options
| Option | Description |
|---|---|
otlpEndpoint | OTLP HTTP endpoint URL |
filePath | File path for JSON-lines trace output |
exporterType | "otlp-http" or "file" |
sourceName | Instrumentation scope name |
captureContent | Whether to capture message content (prompts, responses) |
W3C Trace Context propagation
Most users do not need this feature.
TelemetryConfig is enough to collect CLI traces.
Use the advanced flow below only when you want to create custom OpenTelemetry spans in your app and display them in the same distributed trace as CLI spans.traceparent and tracestate) into JSON-RPC requests for session.create, session.resume, and session.send.
Automatic propagation (recommended)
Installopen-telemetry/api.
Trace context then propagates automatically.
Custom provider
Use this if you want custom trace context acquisition logic.SDK → CLI (outbound)
The SDK automatically injectstraceparent and tracestate into these RPC calls:
session.create— when creating a sessionsession.resume— when resuming a sessionsession.send— when sending a message
CLI → SDK (inbound)
When the CLI invokes a tool, trace context is included in the tool handler$invocation array:
open-telemetry/api is installed, OpenTelemetry context during tool execution links automatically to CLI spans.
You do not need to use traceparent explicitly.
Dependencies
| Package | Purpose |
|---|---|
open-telemetry/api | Automatic Trace Context propagation (suggested, optional) |
open-telemetry/sdk | Trace data export |
open-telemetry/api is listed in composer.json as suggest.
The SDK itself works normally even if it is not installed.
For the latest updates, see the GitHub repository.