OTLP binding
On this page
This document is part of the sessionpipe protocol and is licensed under CC BY 4.0. The words MUST, MUST NOT, SHOULD, SHOULD NOT and MAY are used as in RFC 2119. Status: Draft (see VERSIONING.md).
sessionpipe events (PROTOCOL.md) can be exported directly to any OpenTelemetry Protocol (OTLP) receiver — an OpenTelemetry Collector, Grafana Alloy / Tempo / Loki, Datadog, Honeycomb, or Jaeger — over OTLP/HTTP JSON (application/json), with no custom sessionpipe receiver.
1. Privacy first
An OTLP sink is governed by the exact same privacy contract as any other sink (PRIVACY.md):
- Every event MUST pass through
filter(event, tier, pii)before OTLP serialization. secrets@1runs above tier 0 and cannot be disabled;pii@1runs when--piiis enabled on the sink.- Fields stripped by the tier allowlist or by
pii@1(such as prompts below tier 2, tool inputs/outputs below tier 3, oraccount_idunderpii@1) MUST NOT appear as OTLP attributes.
2. Sink URLs and signals
An OTLP sink URL uses one of two scheme forms (case-insensitive):
otlp:http://…/otlp:https://…otlp+http://…/otlp+https://…
Embedded URL credentials (otlp:https://user:pass@host) MUST be rejected; pass credentials via --token or --header instead. Plain http:// to a non-loopback host SHOULD trigger a warning.
The path selects which OTLP/HTTP JSON signals are exported:
| URL path | Signals exported |
|---|---|
Base URL (e.g. otlp:http://localhost:4318, otlp:https://otlp.grafana.net/otlp) |
Both /v1/logs (all events) and /v1/traces (span-bearing events), appended to the base path. Batches with no span-bearing events POST only /v1/logs. |
Ends with /v1/logs |
Logs only, to that exact URL. |
Ends with /v1/traces |
Traces only, to that exact URL (use this for trace-only backends such as Jaeger). Every event in the batch is emitted as a span (instant span when no duration is present, with unique spanId for *.started events so (traceId, spanId) never collides with *.ended). |
OTLP sinks do not query /.well-known/sessionpipe.
3. Authentication, headers, and redirects
Every request sends Content-Type: application/json (which user headers MUST NOT override).
- If the sink has a
token(stored in the OS keychain or0600config), the sender setsAuthorization: Bearer <token>, unlessheadersexplicitly provides anauthorizationheader. - Extra HTTP headers (
--header "Name: Value"or--header "Name=Value", OTLP sinks only) are sent on every request — supporting Grafana Cloud (Authorization: Basic …), Honeycomb (x-honeycomb-team,x-honeycomb-dataset), Datadog (dd-api-key), and custom collector headers. Header values live in the OS secret store (sessionpipe secrets move keychain|secret-service) alongsidetoken, leaving only header names inconfig.json. - Header names MUST match
[A-Za-z0-9-]+, values MUST contain only printable ASCII and HTAB ([\t\x20-\x7e]*), and hop-by-hop / framing headers (content-type,content-length,host,transfer-encoding,connection) MUST be refused. Error messages MUST NOT echo header values. - Senders MUST set
redirect: "manual"and MUST NOT follow HTTP3xxredirects (preventing cross-origin credential leakage and SSRF). A3xxresponse pauses the sink.
4. Correlation: trace IDs, span IDs, and links
All logs and spans belonging to one session share deterministic, non-zero OTLP hex IDs so backends correlate logs and traces automatically without shared state across workers:
| Identifier | Derivation |
|---|---|
traceId (32 hex) |
First 16 bytes of sha256("sessionpipe.trace:" + harness.name + ":" + session.id) |
Session root spanId (16 hex) |
First 8 bytes of sha256("sessionpipe.session-span:" + harness.name + ":" + session.id) |
Turn spanId (16 hex) |
First 8 bytes of sha256("sessionpipe.turn-span:" + harness.name + ":" + session.id + ":" + turn_id) |
Tool spanId (16 hex) |
First 8 bytes of sha256("sessionpipe.tool-span:" + harness.name + ":" + session.id + ":" + call_id) |
Delegation spanId (16 hex) |
First 8 bytes of sha256("sessionpipe.delegation-span:" + harness.name + ":" + session.id + ":" + ask_id) |
Other event spanId (16 hex) |
First 8 bytes of sha256("sessionpipe.span:" + event.id) |
Span hierarchy and links:
session.startedandsession.backfillare root spans (spanId= session root, noparentSpanId). Whensession.parent_id,session.delegated_by, orsession.launched_byis present, they attach OTLP Span Links to the related session's(traceId, sessionSpanId)withsessionpipe.link.kind(parent,delegated_by,launched_by).turn.endedhasparentSpanId= session root span andkind = CLIENT (3).tool.endedhasparentSpanId= turn span (whenturn_idis present) else session root span, andkind = INTERNAL (1).delegation.endedhasparentSpanId= session root span,kind = CLIENT (3), and links to the target session whendata.tois<harness>:<id>(sessionpipe.link.kind = "delegation_target").
5. Resource, scope, and attributes
Events in a batch are grouped into resourceLogs / resourceSpans by (harness.name, harness.version, session.machine).
Resource attributes
| Attribute | Value |
|---|---|
service.name |
"sessionpipe" |
gen_ai.agent.name |
harness.name |
sessionpipe.protocol.version |
1 (int) |
sessionpipe.harness.name |
harness.name |
sessionpipe.harness.version |
harness.version (when present) |
host.name |
session.machine (when present; hashed when pii@1 ran) |
InstrumentationScope is { "name": "sessionpipe", "version": "<sender version>" }.
Common event attributes
| Attribute | Source |
|---|---|
gen_ai.conversation.id |
session.id |
gen_ai.request.model |
session.model |
vcs.repository.url.full |
session.repo |
vcs.ref.head.name |
session.branch |
sessionpipe.event.id |
event.id |
sessionpipe.event.type |
event.type |
sessionpipe.event.tier |
event.tier (int) |
sessionpipe.harness.event |
harness.event |
sessionpipe.session.id |
session.id |
sessionpipe.session.short_id |
8-hex short id (PROTOCOL.md §3) |
sessionpipe.session.seq |
session.seq (int) |
sessionpipe.session.cwd |
session.cwd |
sessionpipe.session.title, title_source, url, account_id, attended, effort, parent_id, launched_by, delegated_by |
matching session.* fields when present |
sessionpipe.privacy.pii |
privacy.pii (bool) |
sessionpipe.privacy.rulesets |
privacy.rulesets (string array, when non-empty) |
Per-type mapping
turn.started/turn.ended:gen_ai.operation.name = "invoke_agent",sessionpipe.turn.*,sessionpipe.duration_ms(ms),error.typeon error.turn.endedspan is namedinvoke_agent <harness>withstartTimeUnixNano = time - msandendTimeUnixNano = time.turn.transcript/turn.progress(tier 2+):gen_ai.operation.name = "invoke_agent",sessionpipe.turn.number,gen_ai.input.messages(user, redacted),gen_ai.output.messages(assistant, redacted).tool.started/tool.ended(tier 1+; input/output at tier 3):gen_ai.operation.name = "execute_tool",gen_ai.tool.name,gen_ai.tool.call.id,sessionpipe.tool.ok,sessionpipe.duration_ms,error.typeon failure,gen_ai.tool.call.arguments(input, tier 3),gen_ai.tool.call.result(output, tier 3).tool.endedspan is namedexecute_tool <tool>withstartTimeUnixNano = time - ms.files.changed(tier 1+):sessionpipe.files.paths(string array),sessionpipe.files.count(int).attention.needed/attention.cleared:sessionpipe.attention.id,kind,clearance, plusgen_ai.tool.name,sessionpipe.attention.message, andsessionpipe.subagent.idat tier 1+.subagent.started/subagent.ended(tier 1+):sessionpipe.subagent.id,type,background.context.compacted(tier 1+):sessionpipe.compaction.trigger.limits.observed(tier 1+):sessionpipe.limits.plan,account_id(absent underpii@1), and per-windowsessionpipe.limits.window.<id>.used_percent,resets_at,window_minutes.delegation.started/delegation.ended:gen_ai.operation.name = "invoke_agent",sessionpipe.delegation.*,sessionpipe.duration_ms,error.typeon failure.- Unknown types: each key in
datais exported assessionpipe.data.<key>.
Wire encoding rules
All 64-bit integer timestamps (timeUnixNano, observedTimeUnixNano, startTimeUnixNano, endTimeUnixNano) are non-negative decimal strings (>= 0) and safe-integer attributes (Number.isSafeInteger) are encoded as intValue decimal strings (non-safe integers and floats as doubleValue, and limits.observed used_percent always as doubleValue) per the OTLP Protobuf JSON mapping. Non-finite numbers (NaN, Infinity) are omitted. LogRecords set eventName = "sessionpipe." + event.type and severity DEBUG (5) for session.heartbeat, ERROR (17) for failed tools/turns/delegations and error attentions, WARN (13) for non-error attentions and interrupted turns, and INFO (9) otherwise.
Conformance vectors: conformance/otlp-mapping.json.
6. Delivery, retries, and errors
OTLP sinks use the same outbox, cursor, pacing (1 request/second per machine), and retry behavior as HTTP sinks (HTTP.md §2). Response body reads are bounded to 64 KiB, and Retry-After waits are capped at 1 hour.
| Status | Sender behaviour |
|---|---|
200, 202 |
Advance cursor. Record any partialSuccess.rejectedLogRecords / rejectedSpans without retrying the batch. |
3xx |
Do not follow redirects; pause the sink (doctor reports it). |
400 |
Drop the batch and log the error. |
401 |
Pause the sink (doctor reports it). |
413 |
Halve the batch and retry; drop a single event that still fails. |
429 |
Wait per Retry-After (seconds or HTTP date, capped at 1 h; default 60 s) and retry. |
5xx, timeout, network error |
Retry with exponential backoff (2 s · 10 s · 60 s · 5 min · 30 min) without advancing the cursor. |
In dual-signal (base URL) mode, if one signal succeeds (200/202) and the other returns 404, 405, or 501 (endpoint does not implement that signal), the batch is acknowledged so the accepted signal is not duplicated in an infinite retry loop. When both signals fail, action precedence is pause > retry (taking the maximum Retry-After) > split > drop.