Operational questions and evidence
Observability is the ability to investigate system behavior using available evidence. Telemetry is the data emitted about that behavior. An assistant that retrieves a policy, queries an order API, and drafts a customer reply needs evidence about both its execution and the result delivered. These distinctions follow the OpenTelemetry observability primer.
The user’s task is obtaining an accurate reply about an order. That task may involve several HTTP requests and repeated attempts. Counting successful requests therefore answers a different question from counting successfully resolved tasks.
| Operational question | Useful evidence | Interpretation limit |
|---|---|---|
| Which tasks are affected? | Metrics aggregate counts and measurements by task type or release. | An aggregate does not reconstruct an individual execution. |
| What happened during this task? | Traces connect operations; structured logs record events using named fields. | Uninstrumented operations remain outside the account. |
| What changed? | Code, prompt, model, and configuration versions. | A version difference suggests an explanation; it does not establish causation. |
| Where did time and resources go? | Operation timings and available token-usage records. | Usage is not a bill, and overlapping durations are not additive elapsed time. |
| Was the reply useful? | A task-linked judgment with its criterion and source. | A judgment is additional evidence, not an execution status. |
Evaluation judges behavior against intended-use criteria. A valid response format or successful API call can coexist with an incorrect policy answer. Attach the judgment to the relevant task, preserving how it was obtained. Evals develops criteria, measurement validity, and calibration.
A model’s written explanation is another output to inspect. Research has demonstrated explanations that omit influences affecting an answer. Observable inputs, actions, and results support an execution account; a plausible rationale does not reveal hidden computation or establish why the answer occurred.
Spans, concurrency and completion boundaries
A trace connects execution records. A span records a timed operation; its attributes hold metadata, its events mark instants, and its status describes that operation. Parentage records execution structure, while timestamps show overlap. A span link associates related work without assigning another parent. OpenTelemetry trace concepts define this vocabulary.
OpenTelemetry supplies shared instrumentation conventions and tooling. Automatic instrumentation can wrap supported client libraries, but application work still needs explicit coverage: assembling model input, validating a reply, and choosing an output destination. A captured model request alone cannot explain those decisions.
Overlap is not parentage
Example timingsIndependent child calls overlap inside one enclosing execution.
Read the diagram as text
- Server execution. Ends after output handling. 0 to 900 ms; duration 900 ms.
- Policy fetch. 20 to 220 ms; duration 200 ms. Parent: Server execution.
- Order query. 20 to 320 ms; duration 300 ms. Parent: Server execution.
- Context assembly. 320 to 370 ms; duration 50 ms. Parent: Server execution.
- Model generation. 370 to 820 ms; duration 450 ms. Parent: Server execution.
- Output handling. Validation and server flushing. 820 to 900 ms; duration 80 ms. Parent: Server execution.
| Milestone | Record | What it establishes |
|---|---|---|
| Provider termination | Completion, length limit, error, or cancellation reason. | Generation ended under that condition; a returned prefix may be incomplete. |
| Application completion | Validation result and identified final response. | Application processing finished; correctness still needs its intended-use check. |
| Server flushing | For Node.js HTTP, the response finish event. | Bytes were handed to the operating system, not necessarily received by the client. |
| Connection closure | close together with writableFinished. | Distinguishes completed flushing from premature closure; close alone is ambiguous. |
| Client acknowledgment | Application-defined acknowledgment after parsing the identified final response. | That client processing milestone occurred, not that a person read the answer. |
Record validation failures, cancellation observations, and stream termination as distinct events. If client acknowledgment is absent, receipt remains unknown. Treating server completion as delivery would erase precisely the failure boundary needed to investigate a complaint about a missing reply.
Identity across services and execution attempts
A correlation ID joins related records. Its meaning must be explicit: a task identifier follows user intent, while request, attempt, trace, and span identifiers distinguish execution units. One task can survive several executions. The following identifiers describe an application design, not a universal runtime schema.
| Identity | Unit identified | Relationship to preserve |
|---|---|---|
| Task T | One requested customer outcome. | All requests and attempts belong to T. |
| Request R; message M | An incoming request and queued work item. | R produced M; M carries correlation context. |
| Attempts A1 and A2 | Distinct executions, potentially in separate traces. | A2 follows interrupted A1 without becoming the same attempt. |
| Trace and span IDs | An execution graph and an operation within it. | Preserve parent identities or explicit links. |
| Checkpoint C | A saved runtime snapshot. | Record which attempt saved or restored C. |
One task, distinct executions
ExampleResumption preserves task association without merging attempt identities.
Read the diagram as text
- Task T.
- HTTP request R.
- Queued message M.
- Attempt A1: interrupted.
- Saved checkpoint C.
- Attempt A2: resumed.
- Task T → HTTP request R: initiates.
- HTTP request R → Queued message M: enqueues with context.
- Queued message M → Attempt A1: interrupted: processing links origin.
- Attempt A1: interrupted → Saved checkpoint C: saved before interruption.
- Saved checkpoint C → Attempt A2: resumed: restored by.
- Task T → Attempt A2: resumed: same task.
Context propagation carries execution identity across boundaries. With W3C Trace Context, the sender injects a traceparent value and the receiver extracts it before creating downstream spans. Independently instrumented services otherwise produce disconnected records. Incoming context is untrusted correlation metadata, never authorization. See context propagation.
Queue consumers may use span links: a batch can have several message origins, but a span has only one parent. Administrative control also limits visibility. A third-party tool may remain one opaque call, while an instrumented server operated by the same team can contribute internal spans.
- Saved state — An agent runtime manages execution and saved state. LangGraph distinguishes a continuing thread from a checkpoint snapshot; restoration does not recover an arbitrary process stack. Surviving process loss requires persistent storage. Harness Engineering explains recovery.
- Runtime-specific identities — Temporal distinguishes Workflow Id from Run Id; retries can create another run. These meanings differ from LangGraph’s thread and checkpoint identities. Preserve explicit mappings instead of renaming every identifier task ID.
- Acknowledgment boundaries — RabbitMQ publisher confirmation concerns broker acceptance, independently of consumer acknowledgment. Neither alone proves an order mutation or customer notification occurred. Record confirmation at the application’s actual effect boundary.
- Repeated effects — Idempotency prevents retries of the same intent from repeating an effect through service-side enforcement. Logging an operation ID supplies correlation, not that enforcement.
Capture policy and execution provenance
Data minimization collects only evidence serving a defined purpose. Redaction removes or masks sensitive content. Apply both before export, including to error messages and identifiers. Hashing predictable identifiers does not guarantee anonymity; sampling fewer records does not make the retained payloads safe. OpenTelemetry’s sensitive-data guidance explains capture controls.
A prompt is the instructions and content supplied to a model. The original user request differs from the assembled input, which may include history, retrieved passages, and tool definitions. Message order and serialization matter. Context Engineering explains assembly; observability records what the particular call actually received, within capture permissions.
Capture has separate destinations
ExampleMetadata permission does not imply payload-storage permission.
Read the diagram as text
- Application content.
- Capture policy.
- Filtered metadata.
- Restricted artifact.
- Payload omitted.
- Application content → Capture policy: data: classify.
- Capture policy → Filtered metadata: data: permitted fields.
- Capture policy → Restricted artifact: data: separately authorized payload.
- Capture policy → Payload omitted: control: payload disallowed.
| Record group | Useful fields | Availability example |
|---|---|---|
| Model invocation | Requested/returned model, settings, prompt version. | Returned model unavailable; never infer it. |
| Agent and application | Agent ID/version, code revision, configuration. | Versions retained. |
| Effective input | Ordered messages and selected document versions. | Restricted reference retained; personal fields redacted. |
| Tools and decisions | Schema revision, arguments/results, validation, routing, cache selection. | Result truncated; omitted fields unavailable. |
Provenance describes an artifact’s origins and production history: which inputs and activities produced it, and who was responsible. The W3C provenance model formalizes these relationships. A derived summary should retain links to its contributing sources rather than treating every document in a bundle as equal support.
A document URL can later return different content. A reference hash can detect changed bytes when the reference is trusted, but cannot recover an unavailable document. Retained version identifiers improve comparison without guaranteeing reproducibility.
- Inspect every capture path — GenAI content capture is discouraged by default. Configured external-storage hooks can operate independently of span-content flags and sampling; review their destinations separately.
- Constrain necessary payload access — When diagnosis requires content, authorize specific fields and readers. Keep credentials out of records, restrict artifact access, and recognize that redacted evidence may prevent an exact comparison.
- Apply the whole lifecycle — Retention and deletion cover exports, backups, and debug copies as well as the main store. Privacy and Data Governance establishes the permissions and lifecycle policies that telemetry must implement.
Failure localization and competing explanations
Investigation begins with expected behavior, the actual user-visible result, and the completeness of available records. Compare inputs and outputs at component interfaces. Seek consequential discrepancies rather than automatically blaming the last error or the first suspicious timestamp. Several conditions can contribute to the same outcome.
In the policy example, eligibility depends only on order age: the applicable policy allows 30 days, but the assistant receives an obsolete 14-day passage. The order API returns 20 days; the reply denies eligibility and claims 40 days. The source selection and the reply’s factual claim both require investigation.
Two discrepancies in one reply
ExampleSource selection and answer content require separate investigation.
Read the diagram as text
- Selected v1: 14 days.
- Applicable v2: 30 days.
- Order result: 20 days old.
- Captured model input.
- Denied; claims age is 40 days.
- Applicable v2: 30 days → Selected v1: 14 days: supersedes.
- Selected v1: 14 days → Captured model input: passage included.
- Order result: 20 days old → Captured model input: result included.
- Captured model input → Denied; claims age is 40 days: input to recorded generation.
| Explanation | Discriminating evidence | Remaining limit |
|---|---|---|
| Outdated source | The retained passage is v1; applicable v2 changes the window. | Trace the selection or cache decision that supplied v1. |
| Missing context | v2 is absent from the captured effective input. | Absence does not identify which upstream selection step omitted it. |
| Tool-result misuse | The tool returns 20 days; the reply states 40. | An intermediate transformation or generation could introduce the discrepancy. |
| Unsupported answer | No retained input supports the 40-day claim. | This judgment requires adequate input coverage. |
Fixing only one discrepancy may leave the denial unchanged: 20 days exceeds the obsolete 14-day window, while the incorrect 40-day claim exceeds the current 30-day window. A final pass/fail result can therefore conceal a repaired intermediate defect. Compare intermediate evidence as well as the final outcome.
Inspect retry reasons, fallback choices, cache hits, and cancellation paths even when the final response succeeds. Grouping executions by path can reveal recurring associations, but a lower score on one path does not prove which operation caused it. Retrieval-Augmented Generation explains the retrieval-to-answer interfaces.
- Delivery can fail independently — In Laurie Voss’s workshop, a report agent attempted disk writes in a notebook without write permission. Repeated traces exposed a delivery problem despite completed research. The instruction needed to specify returning the report through the output.
- Prioritize by consequences and recurrence — Label failures by their supported explanation and user impact. Frequency alone can prioritize a common nuisance over a severe failure; severity and recurrence should both inform the next repair.
Recorded evidence, replay and fresh execution
Reproduction has several meanings. Reading a historical result preserves that result. Reusing recorded dependency responses holds selected inputs fixed. Calling a model or external service again creates a new execution whose outputs may differ. Saved configuration narrows uncertainty but does not make these methods equivalent.
| Method | What remains fixed | What can change | Justified conclusion |
|---|---|---|---|
| Historical inspection | Retained inputs, outputs, and versions. | Interpretation of those records. | What was recorded under those conditions; unavailable evidence stays unavailable. |
| Recorded-response replay | Matched, intercepted dependency responses. | Application code and any calls not replayed. | Behavior under the captured dependency results. |
| Fresh or checkpoint-based execution | Selected initial or saved state. | Subsequent model calls, external state, and effects. | Behavior in the new execution, not an identical reconstruction of history. |
A test double is a controlled substitute for a dependency. VCR.py’s none mode replays recorded HTTP interactions and rejects new ones. Other modes can make fresh requests. This protection covers intercepted HTTP only; filesystem writes, subprocesses, and other network paths need separate controls. Sandboxes and Execution Isolation covers containment.
Checkpoint re-execution can run later nodes again. LangGraph’s Functional API can instead reuse persisted completed task results during resumption, while ordinary entrypoint code runs again. An unfinished task may repeat an external effect that occurred before its result was saved. Checkpointing therefore does not replace idempotency. Harness Engineering develops these recovery responsibilities.
- Test a specific explanation — Change one suspected factor while fixing captured dependencies and comparison criteria. Repeat where model variation matters. A repaired symptom strengthens the case for that intervention under those conditions; it does not establish every cause of the historical incident.
- Keep regression evidence distinct — Retain investigated failures as regression cases. Once their results guide revisions, they are no longer untouched validation evidence. Evals explains independent change assessment.
Task metrics, latency and usage accounting
A service-level indicator, or SLI, measures a defined service property. A service-level objective, or SLO, sets its target over a period; the allowed bad-event fraction is the error budget. Define eligible tasks, success criteria, observation period, and an accountable owner. Transport availability and correct task completion need separate indicators.
| Golden signal | Task-oriented measurement | Useful distinction |
|---|---|---|
| Latency | Task duration and slow-tail percentiles. | Keep failed-task latency visible; successful-call averages exclude it. |
| Traffic | Eligible tasks and downstream attempt volume. | Retries increase dependency traffic without adding user tasks. |
| Errors | User-visible failures and violated service requirements. | An HTTP success can contain incorrect content. |
| Saturation | Pressure on constrained capacity, including waiting work. | Queue growth can precede visible task failures. |
Tail latency describes the slow end of a duration distribution. Record the observation boundary: client time to first response chunk differs from server time to first token, and a chunk need not equal one token. Application completion and client acknowledgment occur at still different boundaries. LLM Inference explains serving measurements.
Tokens are model-specific processing units mapped to vocabulary identifiers, not reliably words or characters. Usage accounting must retain the relevant model and token categories. Tokenization explains counting. Observed usage, estimated monetary charges, and provider billing are separate records; translating between them requires an explicit accounting rule.
| Task | Attempt | Observed result | Provider-reported total tokens |
|---|---|---|---|
| T1 | A1 | Completed | 600 |
| T2 | A1 | Stream interrupted before final usage record | Unavailable |
| T2 | A2 | Completed | 600 |
The ledger contains two tasks and three attempts. Its known usage subtotal is 1,200 tokens; T2’s total and the overall total remain incomplete. With streaming include_usage, an interrupted connection may prevent receipt of the final aggregate usage chunk. Missing provider usage is not zero, even when some output text arrived.
Retries can preserve completion while increasing serial waiting and dependency work. Record attempts, backoff, queue delay, rate-limit responses, and exhausted execution budgets. A timeout means the caller stopped waiting; downstream work or an external effect may continue. Cancellation and explicitly observed abandonment need separate outcomes rather than disappearing from successful-task statistics.
- Alert on a decision — An alert should identify the affected task population, violated objective, responsible responder, and next investigation or containment action. A number without a response policy is not an operational reliability contract.
- Track budget consumption — Burn rate compares the observed bad-event rate with the SLO’s allowed rate. Long and short windows can distinguish sustained impact from a problem that has already stopped. Delayed quality labels and low traffic require care before applying immediate thresholds.
Delayed outcomes and comparable populations
Feedback has its own identity and clock. Link a complaint or review to the originating task and release, retaining execution time, feedback time, criterion, judgment method, evaluator version, supporting evidence, and disagreement. A later label changes what is known about the execution; it does not change which version produced it.
A cohort is a group selected for comparison. Drift is a change in observed inputs, behavior, or outcomes. Compare relevant task types and release versions at a common follow-up horizon: recent tasks have had less opportunity to receive complaints or downstream confirmations. An unresolved eventual outcome differs from a definitively missed deadline.
Feedback arrives after execution
ExampleLater evidence changes knowledge, not the originating release.
Current snapshot: Day 0. Outcome unknown.
Read the diagram as text
- Task T.
- Release R.
- Day 0: outcome unknown.
- Customer complaint.
- Day 2: failure reported.
- Policy review.
- Day 3: failure confirmed.
- Task T → Release R: executed with.
- Task T → Day 0: outcome unknown: initial evidence.
- Task T → Customer complaint: reported by.
- Customer complaint → Day 2: failure reported: adds report.
- Customer complaint → Policy review: investigated through.
- Policy review → Day 3: failure confirmed: adds judgment.
- Execution. Current snapshot: Day 0. Outcome unknown. Active: Task T, Release R, Day 0: outcome unknown. New: Task T, Release R, Day 0: outcome unknown.
- Report. Current snapshot: Day 2. Complaint added; prior snapshot retained. Active: Task T, Release R, Day 0: outcome unknown, Customer complaint, Day 2: failure reported. New: Customer complaint, Day 2: failure reported.
- Review. Current snapshot: Day 3. Review confirms failure; earlier evidence remains. Active: Task T, Release R, Day 0: outcome unknown, Customer complaint, Day 2: failure reported, Policy review, Day 3: failure confirmed. New: Policy review, Day 3: failure confirmed.
- Selective observation — The success rate among reviewed cases need not equal the success rate among all eligible tasks. Complaints and volunteer feedback select particular experiences. Report observed successes, observed failures, and unresolved cases separately.
- Bounds before assumptions — Assume 100 eligible tasks have 60 confirmed successes, 20 failures, and 20 unresolved outcomes. Their eventual success fraction lies between 60% and 80%. Reporting 75% from the 80 resolved cases would describe only those cases.
| Task group | Variant A successes / tasks | Variant B successes / tasks |
|---|---|---|
| Easy | 9 / 10 = 90% | 80 / 100 = 80% |
| Hard | 20 / 100 = 20% | 1 / 10 = 10% |
| All tasks | 29 / 110 ≈ 26.4% | 81 / 110 ≈ 73.6% |
A performs better within both groups but receives mostly hard tasks. B’s aggregate benefits from receiving mostly easy tasks. Aggregate rates weight groups by their observed sizes; different weights produce this reversal. Neither the aggregate nor the within-group association alone establishes a causal release effect.
An outcome alert should lead to representative executions from the affected cohort plus targeted failure review. Experts can annotate traces and turn recurring problems into regression cases. Keep the representative sample distinct from the failure-enriched queue. Evals covers the validity of the resulting quality measures.
- Bound real exposure — A canary gives a limited portion of production traffic to a candidate while retaining a control. Its outputs affect real users. Compare version-separated indicators and define stop, rollback, and expansion criteria before exposure.
- Require the relevant evidence — If expansion requires mature task outcomes and verified monitoring coverage, successful targeted replay establishes neither condition. Hold expansion while repairing coverage and completing follow-up, provided existing safety stops and the bounded exposure policy permit that wait. Rollback cannot necessarily undo completed effects.
Sampling and telemetry resource limits
Sampling retains a selected subset of telemetry. Head sampling decides near execution start; tail sampling waits for enough later evidence to select errors, slow tasks, or other paths. Tail sampling requires buffering and cannot recover upstream discards. OpenTelemetry sampling guidance explains these tradeoffs.
Representative retention supports population analysis; targeted retention supports diagnosis. Preserve selection rules and inclusion probabilities where applicable, and keep reliable eligible-task counters separate. A failure-enriched diagnostic sample cannot directly estimate the production failure rate.
Early discard is irreversible
ExampleTail selection sees only traces admitted upstream.
Read the diagram as text
- Eligible tasks.
- Population counters.
- Head decision.
- Discarded traces.
- Buffer; tail decision.
- Diagnostic records.
- Eligible tasks → Population counters: count independently.
- Eligible tasks → Head decision: trace candidates.
- Head decision → Discarded traces: not admitted.
- Head decision → Buffer; tail decision: admitted.
- Buffer; tail decision → Diagnostic records: retention rule matches.
- Buffer; tail decision → Discarded traces: rule does not match.
- Bound metric dimensions — Cardinality is the number of distinct values a field takes. Each distinct metric-label combination creates another time series. Use bounded dimensions such as operation class; place task identifiers in protected logs or spans. Raw prompts and request IDs can make series counts grow with traffic. Prometheus instrumentation guidance explains the resource consequences.
- Budget the entire evidence path — Payload size, buffers, export traffic, storage, indexing, queries, and retention all consume resources. Lower retention does not eliminate collection or processing costs. Measure these costs under the intended workload.
- Preserve bounded failure behavior — Batching reduces export overhead, but queues remain finite. Define what can be dropped and how that loss becomes visible instead of allowing diagnostics to block application work indefinitely.
Telemetry integrity and diagnostic coverage
Instrumentation and export can fail independently of the application. Standard simple and batching span processors export finished spans; active work may therefore be absent. A full SDK queue can drop spans, and flushing can time out. Requesting a flush does not establish complete delivery.
Collector queues buffer destination outages, but capacity limits and exhausted retries can still lose records. Persistent storage helps across restarts without eliminating disk failure or prolonged-outage risk. Monitor occupancy, capacity, and export failures. A failed send may later succeed, so failed-send counts are not automatically lost-record counts.
Evidence delivery can fail
A completed operation does not guarantee an ingested record.
Read the diagram as text
- Finished-span SDK queue.
- Collector queue.
- Backend.
- Dropped evidence.
- Retry endpoint.
- Finished-span SDK queue → Collector queue: export succeeds.
- Finished-span SDK queue → Dropped evidence: queue full.
- Collector queue → Backend: delivery succeeds.
- Collector queue → Retry endpoint: retryable failure.
- Collector queue → Dropped evidence: limits exhausted.
| Evidence condition | Interpretation | Diagnostic response |
|---|---|---|
| Sampled out | A retention decision excluded records. | Inspect selection policy; do not infer execution absence. |
| Redacted, truncated, or unavailable | Specific content cannot be inspected. | Preserve the reason and narrow the conclusion. |
| Repeated telemetry | The OpenTelemetry Protocol (OTLP) exports telemetry; retransmission may duplicate records. | Distinguish duplicate delivery from another application attempt. |
| Disconnected execution | Propagation may be broken or the service may be opaque. | Verify boundaries rather than assuming internal work never occurred. |
| Cross-host timestamp conflict | Host clocks can disagree. | Use known send/receive and execution relationships; unrelated concurrent work may remain unordered. |
Coverage verification is a test contract for the instrumentation itself. Exercise known paths and compare expected records with received evidence. A quiet dashboard is persuasive only when the relevant execution boundaries and evidence pipeline are known to be working.
- Success and failure — Verify application spans, validation outcomes, final response identity, and visible failure records for known inputs.
- Retries and asynchronous work — Verify distinct attempts and producer/consumer relationships, including batches with several origins.
- Cancellation and interrupted streams — Verify termination evidence, delivery uncertainty, and explicit missing usage rather than zero-filled totals.
- Resumption — Verify links to saved state while distinguishing reused results from newly executed work.
- Export recovery and overhead — Exercise destination failure and recovery; inspect queue limits and application impact under load.
Diagnostic telemetry is neither authoritative runtime state nor automatically a durable audit record. Where decisions require retained evidence, separately define integrity, access, retention, and recovery responsibilities. The available trace should state its coverage, not silently claim completeness.
Open questions
Cross-organization trace continuity remains constrained by ownership and disclosure boundaries. Useful diagnosis needs more than an opaque duration, but shared telemetry can reveal sensitive operations. Progress would include an agreed minimal evidence contract that preserves task correlation, failure boundaries, and responsibility without exposing internal payloads.
Timely quality alerts remain difficult when outcomes arrive selectively or unpredictably. Faster detection matters for containment, but immature feedback can misstate current quality. Progress would mean validated alert behavior under documented feedback delays, explicit unresolved counts, and sensitivity to which users never report outcomes.
Privacy-preserving reproduction requires choosing which evidence survives deletion and minimization. Full content improves replay fidelity but expands exposure; references cannot restore deleted artifacts. Progress would be a purpose-specific capture design with demonstrated diagnostic usefulness, restricted access, and verified disposal across downstream copies.




























































































































































































