Skip to content

0003: OpenTelemetry traces from the trace-event pipeline

Status: accepted (v1.0.0).

Context

Teams want CredenceStack's results in the observability platforms they already run (Langfuse, Datadog, Splunk and any OTLP backend), next to their agents' own telemetry. The evidence bundle must stay the record: deterministic, hash-chained, signed, and private where scenarios are confidential. Ten connectors exist, each recording trace events through Environment.record.

Decisions

  1. One hook, not one per connector. Spans are built by a listener on Environment.record. Every connector, present and future, emits the same span tree, and the conformance kit checks it ("emits a valid span tree").
  2. Scenario granularity by default. One trace per scenario epoch, linked to a run trace (and back). In most platforms one trace reads as one agent run. --otel-granularity run gives one trace for small runs.
  3. Status rules. The scenario span is ERROR only for execution errors (a crash or a timeout). A failed test is a result: credencestack.result=fail and credencestack.test_failed=true, status unset. APM error rates then count broken runs, not failed tests.
  4. Privacy by default. Content capture is off: spans carry names, ids, types, counts, timings, statuses and results only. With --otel-content, public content is redacted and capped; confidential content is never captured, whatever the flags.
  5. An id sidecar, not ids in the chain. Trace ids are random. Putting them in the hash-chained events would break determinism and tie the evidence to one platform. They go to otel/ids.json, listed in the manifest (so signed) and skipped by determinism checks; the report's "View trace" links read it.
  6. Wall-clock spans. Durations in APM tools are real; simulated times are credencestack.sim_time on events.
  7. Scenario spans end with their own episode. Results are known only after Inspect grades (and, for cross-epoch findings, after every epoch), so the span stays open and ends with the episode's end time; the grade span is zero-length at that time.
  8. Never slow a run. Batch export with bounded queues and timeouts, a bounded flush on exit, and no more attempts after two failed batches. Failures are explained in one line; the run's exit code never depends on export.
  9. Off unless asked. --otel or CREDENCESTACK_OTEL_ENABLED=1 turns it on; OTEL_* variables alone only print a hint. The core imports no part of CredenceStack's telemetry, nor the SDK, when it is off.

Consequences

  • A connector author gets telemetry by recording trace events, which the conformance kit already requires.
  • Platforms that read GenAI conventions show the spans without mapping; names are pinned to a recorded version (pinned conventions) and may change with the conventions, which are still in Development.
  • chat spans exist only for connectors that record model calls; their start time is approximate (the previous trace event).
  • The bundle's Merkle root is not on the run span: signing is a separate command.