Wire the tracing subscriber (unify dev console + release OTLP) #138
Notifications
Due Date
No due date set.
Blocks
#140 Migrate the LLM client + streaming spans to tracing
Apps/ImageApi
#141 Migrate the DAO-layer context threading to tracing
Apps/ImageApi
#142 Give background jobs a root span
Apps/ImageApi
Reference: Apps/ImageApi#138
Reference in new issue
Block a user
Part of #135
Work
Install a
tracingsubscriber inotel::init_tracingso spans are produced in BOTH builds, replacing today's release-onlyglobal::set_tracer_providerwith no subscriber.tracing,tracing-subscriber,tracing-log,tracing-opentelemetry = "0.32"(no otel bump).tracing-subscriber::fmtlayer -> console, so spans AND logs are visible; thetracing-logbridge keeps existinglog::calls flowing to the console (replacingenv_logger).OTLP_OTLS_ENDPOINTis set.try_init()(process-global), NOTset_default()(thread-local) - validated by spike #133.tests/otel_propagation.rsfrom the spike #133 patch in-tree as the propagation regression test; confirm it passes in the real build.#[cfg(not(debug_assertions))]fork aroundinit_logs/init_tracinginmain.rsand decide what remains gated.Resolution
The subscriber config that landed, and confirmation the regression test is green.
Resolved — commit
48a3f03onfeature/tracing-migration.Delivered (per spec):
tracingsubscriber installed in both build profiles viaotel::init_tracing():registry()+EnvFilter(honorsRUST_LOG, defaults toinfo) +OpenTelemetryLayer+ consolefmtlayer. Previously release-only → spans were a no-op in dev.OTLP_OTLS_ENDPOINTset → batch OTLP exporter (release/staging); unset → provider builds with valid span contexts (so outgoingtraceparentinjection still works) but exports nowhere, and the consolefmtlayer shows spans.TraceContextPropagatorset at init — required by thetracing-actix-webmiddleware (#139) and the outgoing traceparent helpers (both read the global propagator).+ tracing,tracing-subscriber(env-filter/fmt/ansi/registry),tracing-opentelemetry 0.32;opentelemetry_sdkgainstesting.main.rs:init_tracing()called in both builds;env_loggerstays in debug,init_logs()stays in release.tests/otel_propagation.rsbrought in from the spike — pins the spawn-carry invariant (S2/S4 baretokio::spawnorphan; S6.instrument()/ S7span.enter()propagate).Two design calls, both conventional:
tracing-logbridge left off (default-features = false) so the consolefmtlayer prints tracing spans only;logrecords stay on their existing path (env_logger debug / OTel release). Avoids double-printing every log line.fmtlayer present in both builds (a release run locally also prints spans). If you'd rather have release export-only, that's a one-line#[cfg(debug_assertions)]gate — say the word.Evidence:
cargo clippy --all-targets0 warnings; 690 lib + 775 integration + 1 regression + 4 doc-tests pass; smoke-ran the debug binary —init_tracing()+env_logger+ migrations + watcher all start cleanly (no panic).Note: this is the foundation/plumbing. Console span visibility materializes in #139–#142 as the request/LLM/DB spans are migrated to
#[instrument]; #138 just wires the pipe + propagator so those spans flow and cross spawn boundaries correctly.