Repository navigation
runtime: one trace per business event (ADR-0034 lot A) - #44
Merged
Merged
Conversation
The runtime carries a W3C traceparent in a NATS header on every message it publishes, so the spans of one event form one trace with parent links: the source or webhook, each flow and invoke, the sink. http-in and api flows continue a caller's trace; http-out, slack-out and exec sinks pass it on; a dead letter keeps it and a replay continues it; the event ring shows the trace id. The OTLP exporter reads the standard OTEL_* variables (traces endpoint, headers, timeout, resource attributes, the six samplers, OTEL_BSP_*), retries what the OTLP specification calls retryable, batches, flushes on a graceful stop, and counts what it sends and drops on /metrics. Transport test T6 checks the chain against a stub collector: three entry cases, an unsampled caller, no span dropped, the event ring, and the flush on stop. bench/trace-cost.sh measures the cost on the flow hop: about 3 µs of CPU for propagation, 10.5 µs to export every span, 4 µs at one in ten. The observability guide now claims end-to-end traces, with that cost, and ADR-0034 records what was built and where the build departs from its text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
… it is bus.rs had gained `use crate::trace`, which the connectors that compile core/src/bus.rs through #[path] do not have: the AMQP build failed in CI. The bus now takes a trace through a two-method trait (the traceparent and tracestate values) and hands a consumed message's headers back with Message::header; parsing stays in trace.rs (trace::of). Both connectors check again, test targets included, and the module says why it must stay self-contained. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
- An exporter header that HTTP cannot carry (a colon for `=`, a control byte) made ureq fail every export with an error quoting the whole header line, which reached the log once a minute. Such entries are now skipped at start with a warning that gives their position only; a transport error prints its detail only when it comes from the network, and only network errors are retried, so a bad header or URL no longer holds the queue for 3.5 s a batch. - The startup line printed the endpoint with any user info or query in it; it now prints scheme, host and path. - The vx.dlq.events announcement forwarded the caller's tracestate, text from outside, in an event meant to hold only what the runtime wrote. It keeps the trace ids only. - Trace headers count toward max_payload. A message they would push past it is now published untraced instead of failing, and a death envelope whose traceparent would not fit goes without it: a trace is never the reason a message or a letter is lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every event the runtime lets in now gets one trace, from the source or webhook through each flow and
invoketo the sink. ADR-0034 lot A asked for exactly this (points 1 to 6, plus point 12).What changes for an operator
One trace per event. A W3C
traceparenttravels in a NATS header on every publish, so the spans of an event have parent links. The payload is untouched.Traces cross the edges of the cell.
http-inandapiflows continue a caller's trace, andhttp-inanswers with thetrace_id.http-outandslack-outsendtraceparentdownstream. Anexecsink getsTRACEPARENTandTRACESTATEin its environment.dead-letteredevent carries the trace id, and so does each entry of the event ring.The exporter reads the standard
OTEL_*variables:OTEL_BSP_*.It also retries 429, 502, 503 and 504 with
Retry-After, flushes its queue on a graceful stop, and exposes two counters:vejas_spans_exported_totalandvejas_spans_dropped_total{reason}.Span shape changes. The kind now says what the hop was:
SERVER,PRODUCER,CONSUMER,CLIENTorINTERNAL. The OpenTelemetry semantic-convention attributes are added, and so isvejas.flow.version. A successful span now has an unset status. All of this is in the CHANGELOG under Changed.How it is proven
Transport test T6 (
e2e/transport/run.sh) runs against a stub collector and checks:traceparent, as one trace whose parents chain all the way to the sink's HTTP call;apiflow called with aTraceParentheader (mixed case);Other checks:
OTEL_*reading.Cost
Measured with the new
bench/trace-cost.shon the isolated flow hop: 20 000 events, median of 5 runs, runtime CPU per event.Throughput stays within 2.5 %. The 200 000 exported spans all arrived. Along the way, two fixes brought export from 63 µs of CPU per event down to about 9 µs:
bench/README.mdhas the full table.Departures from the ADR text
They are recorded in ADR-0034 under "What is built":
code.line.number(the AST has no line numbers yet);Not built:
traceparenton the poll sources' GETs;exec-rpc.Lot B (the panel view, the
VEJAS_TRACESstream, thevejas_traceMCP tool) is next.Fixed after a first CI run and an independent review
bus.rshad gaineduse crate::trace. That broke the AMQP connector, which compilesbus.rsas it is. The bus now takes a trace through a two-method trait, and parsing stays intrace.rs. Both connectors check again.vx.dlq.eventsforwarded the caller'stracestate. It now keeps only the trace ids.max_payload. A message they would push past the limit now goes untraced instead of failing, and the same rule applies to the death envelope'straceparent.🤖 Generated with Claude Code
https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT