Repository navigation
Descriptive spans, OpenTelemetry trace context and more metrics (0.2.5) - #58
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spans now set otel.name, so a trace viewer shows what each span did (`call charge`, `sleep 5s`, `attempt 2`, `for items`) instead of `step` everywhere, and carry the context to drill down: - workflow span: name, version, engine, run, parent instance, outcome and error status - step span: covers the whole live step (TaskStarted to its record and TaskCompleted), with seq, ordinal, key, call site, timeout, outcome, cache hit, child instance id and payload sizes - attempt, retry backoff, limit wait and persist spans under a step - one replay span per resume, with an event per replayed step - spans for signals, updates, queries and events sent to an instance, schedule ticks, lease renewal, recovery and replay checks - every Event is logged in the span it happened in - ctx.start and recovered instances get traces of their own - YAML engine: workflow span, a span per task (nested as in the workflow, with its JSON pointer), a span per for-loop iteration - the span and subscriber now follow blocking calls (Redb stores) and script output readers - EngineBuilder::trace_payloads(max_bytes) puts truncated step inputs and outputs on spans (off by default) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- executor spans for HTTP calls (method, URL without query, status), scripts, shell commands and containers, in both engines - request spans for HTTP and gRPC listeners (SERVER kind, route, status) - feature `otel`: a request carrying a W3C traceparent continues the caller's trace, and HTTP calls carry the current one on, through the propagator the application installs - every store call is timed (debug span, latency and error metrics), and the YAML engine's events are logged in the span they happen in - metrics: workflow duration, running and resumed instances, continue-as-new, step outcome and timeouts, replayed steps, task attempts, heartbeat timeouts, cache hits, limit waits, active tasks, persistence, leases, messages, emitted events, schedule ticks and lag, replay divergences, listener requests, jq evaluations - fields that change are recorded once, with their final value, since trace backends keep every value an attribute is given - tests/otel_export.rs checks what an OpenTelemetry exporter receives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`jackdaw run --otlp-endpoint URL` (or OTEL_EXPORTER_OTLP_ENDPOINT) sends spans to an OpenTelemetry collector over OTLP/HTTP as service `jackdaw`, with W3C trace context as the propagator; JACKDAW_OTLP_FILTER picks the spans (default info). `--metrics-addr ADDR` serves the engine's metrics at /metrics, with histogram buckets for the *_seconds metrics. Both are behind the CLI's `telemetry` feature, on by default. The persistence metrics' `backend` label now names the store (RedbPersistence, ...) rather than the trait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mirror of a YAML run read task events from the store before taking the run's opening event from its channel, and its poll tick raced the channel, so TaskStarted could be reported before WorkflowStarted. The channel now comes first, and the store is read once the opening event is in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arminhammer
force-pushed
the
span-names
branch
from
November 10, 2026 21:07
5217532 to
5c243cf
Compare
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.
Why
In Grafana every jackdaw span was named
step(orworkflow), so a 240-step trace was a wall of identical rows, and you had to open each span to see what it was. Only two spans existed, the YAML engine had none, and several paths ran with no span at all.What changes
Span names. Every span sets
otel.name, whichtracing-opentelemetryexports as the span name. A trace now readsworkflow shop/order@1,call charge,attempt 2,retry backoff 200ms,sleep 1h,run shipping,HTTP POST pay.example. Thetracingnames and existing fields stay.More spans, and more context on them:
TaskStartedto its journal write andTaskCompleted. It records seq, ordinal, key, call site, outcome, timeout, cache hit, child instance id and payload sizes.attemptspan.task.reference), and a span perforiteration.Eventis logged in the span it happened in, so it shows as a span event.otel.status_code = ERROR,error.typeandexception.message.tests/otel_export.rschecks for duplicates).Parent/child fixes:
ctx.startand recovered instances get traces of their own, linked to the span that started them.Payloads:
EngineBuilder::trace_payloads(max_bytes)puts truncated step inputs and outputs on spans. It is off by default, since payloads can hold sensitive data.Feature
otel: a listener request with a W3Ctraceparentheader continues the caller's trace, andctx.http/ YAMLcall: httpcarry the current trace on. It uses the propagator the application installs; the library still installs nothing.Metrics: workflow duration, running and resumed instances, continue-as-new, step outcome and timeouts, replayed steps, attempt duration, heartbeat timeouts, cache hits and misses, limit waits, active tasks, store latency and errors (by store type), leases, delivered messages, emitted events, schedule ticks and lag, replay divergences, listener requests, and jq evaluations. Both engines report them. Labels never carry instance ids.
CLI:
j 8000 ackdaw run --otlp-endpoint URLsends traces over OTLP/HTTP, and--metrics-addr ADDRserves Prometheus/metricswith histogram buckets. Both are behind the defaulttelemetryfeature.Other:
TaskStartedcould be reported before itsWorkflowStarted.guide::observability, covering spans, fields, metrics and Grafana TraceQL/PromQL examples, and a CHANGELOG entry.Behaviour changes to note
attemptspan, which is a child of the step span (it used to log directly in the step span).jackdaw_step_duration_secondsgains anoutcomelabel.ctx.startno longer appears inside its starter's trace. It has its own trace, linked to the starter.Testing
operations/observability.feature, 17 with the updated existing ones: span names, attempt and backoff spans, events as span events, error status, the replay span, payloads on and off, thestarttrace, continue-as-new runs, the YAML task tree, and metrics.tests/otel_export.rsruns a realtracing-opentelemetrypipeline with an in-memory exporter. It checks exported names, parent links, status, span events, no duplicate attributes, andtraceparentcontinuation through an HTTP listener.cargo clippyis clean for--all-features --all-targets, default features,--no-default-features,otelalone,wasm32-wasip2, and the CLI with and withouttelemetry.jackdaw runagainst a local OTLP receiver received the expected span names andservice.name, and/metricsserved the new series as histograms.cargo test --workspace --all-features: everything passes except a few flaky scenarios under full parallel load:config.feature"same id with other input is refused unless restarted" fails onmaintoo (4 of 10 runs in isolation). The purge sees the finished instance still in memory, because it is published before it is forgotten.🤖 Generated with Claude Code