diff --git a/CHANGELOG.md b/CHANGELOG.md index 929ef959839..2243ebfd2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Diagnostics/OTEL: capture privacy-safe model-call request payload bytes, streamed response bytes, first-response latency, and total duration in diagnostic events, plugin hooks, stability snapshots, and OTEL model-call spans/metrics without logging raw model content. Fixes #33832. Thanks @wwh830. - Logging: write validated diagnostic trace context as top-level `traceId`, `spanId`, `parentSpanId`, and `traceFlags` fields in file-log JSONL records so traced requests and model calls are easier to correlate in log processors. Refs #40353. Thanks @liangruochong44-ui. - Logging/sessions: apply configured redaction patterns to persisted session transcript text and accept escaped character classes in safe custom redaction regexes, so transcript JSONL no longer keeps matching sensitive text in the clear. Fixes #42982. Thanks @panpan0000. - Providers/Ollama: honor `/api/show` capabilities when registering local models so non-tool Ollama models no longer receive the agent tool surface, and keep native Ollama thinking opt-in instead of enabling it by default. Fixes #64710 and duplicate #65343. Thanks @yuan-b, @netherby, @xilopaint, and @Diyforfun2026. diff --git a/docs/gateway/opentelemetry.md b/docs/gateway/opentelemetry.md index 7eb668fa755..5614f8e4c00 100644 --- a/docs/gateway/opentelemetry.md +++ b/docs/gateway/opentelemetry.md @@ -165,6 +165,10 @@ When any subkey is enabled, model and tool spans get bounded, redacted - `openclaw.context.tokens` (histogram, attrs: `openclaw.context`, `openclaw.channel`, `openclaw.provider`, `openclaw.model`) - `gen_ai.client.token.usage` (histogram, GenAI semantic-conventions metric, attrs: `gen_ai.token.type` = `input`/`output`, `gen_ai.provider.name`, `gen_ai.operation.name`, `gen_ai.request.model`) - `gen_ai.client.operation.duration` (histogram, seconds, GenAI semantic-conventions metric, attrs: `gen_ai.provider.name`, `gen_ai.operation.name`, `gen_ai.request.model`, optional `error.type`) +- `openclaw.model_call.duration_ms` (histogram, attrs: `openclaw.provider`, `openclaw.model`, `openclaw.api`, `openclaw.transport`) +- `openclaw.model_call.request_bytes` (histogram, UTF-8 byte size of the final model request payload; no raw payload content) +- `openclaw.model_call.response_bytes` (histogram, UTF-8 byte size of streamed model response events; no raw response content) +- `openclaw.model_call.time_to_first_byte_ms` (histogram, elapsed time before the first streamed response event) ### Message flow @@ -216,6 +220,7 @@ When any subkey is enabled, model and tool spans get bounded, redacted - `openclaw.model.call` - `gen_ai.system` by default, or `gen_ai.provider.name` when the latest GenAI semantic conventions are opted in - `gen_ai.request.model`, `gen_ai.operation.name`, `openclaw.provider`, `openclaw.model`, `openclaw.api`, `openclaw.transport` + - `openclaw.model_call.request_bytes`, `openclaw.model_call.response_bytes`, `openclaw.model_call.time_to_first_byte_ms` - `openclaw.provider.request_id_hash` (bounded SHA-based hash of the upstream provider request id; raw ids are not exported) - `openclaw.harness.run` - `openclaw.harness.id`, `openclaw.harness.plugin`, `openclaw.outcome`, `openclaw.provider`, `openclaw.model`, `openclaw.channel` diff --git a/docs/logging.md b/docs/logging.md index e250f032057..9b09b55c8a8 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -164,6 +164,19 @@ OpenClaw writes the trace fields as top-level JSON keys (`traceId`, `spanId`, `parentSpanId`, `traceFlags`) so external log processors can correlate the line with OTEL spans and provider `traceparent` propagation. +### Model call size and timing + +Model-call diagnostics record bounded request/response measurements without +capturing raw prompt or response content: + +- `requestPayloadBytes`: UTF-8 byte size of the final model request payload +- `responseStreamBytes`: UTF-8 byte size of streamed model response events +- `timeToFirstByteMs`: elapsed time before the first streamed response event +- `durationMs`: total model-call duration + +These fields are available to diagnostic snapshots, model-call plugin hooks, and +OTEL model-call spans/metrics when diagnostics export is enabled. + ### Console styles `logging.consoleStyle`: