Throwaway OTel retroactive-span diagnostics spike#4685
Conversation
In-crate, off-by-default (otel_spans_spike feature) test that reconstructs a completed DiagnosticsContext into a BACKDATED OpenTelemetry span tree via opentelemetry SpanBuilder::with_start_time/with_end_time. Proves the OTel mapping in DIAGNOSTICS-CONTRACT.md is feasible. Decoupled from any capture-engine prototype: it builds the sample context from the pub(crate) DiagnosticsContextBuilder using only crate::diagnostics / driver::routing / options / models types available on main - no dependency on the deferred Azure#4619 capture module. The azure_core::tracing abstraction builds spans at "now" and has no backdating hook, so the spike talks to the raw opentelemetry crate + an in-memory exporter. Throwaway/feasibility only, gated OFF by default; no public API change; no CHANGELOG. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Nice throwaway — it cleanly proves the backdated Latent coupling to #4683's
|
Address self-review on PR Azure#4685: - Count/iterate attempt spans off ctx.requests() (the retained list the spans are actually built from) instead of ctx.request_count(). On main the two are equal, but once PR Azure#4683's retry-storm compaction lands request_count() reports the true pre-compaction total while requests() is the bounded first+last-per-run list, which would break the assertions. A faithful emitter must count off the list it emits from. - Note (DIAGNOSTICS-CONTRACT.md 7.3) that under compaction a run collapses to a single span + count, so an emitter cannot produce request_count() spans. - Document the otel_spans_spike feature dep-scoping caveat: it enables opentelemetry(+_sdk) unconditionally though the only consumer is the test-gated module, so a non-test --all-features build pulls them in unused. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed in 77db3bb:
cargo fmt + cargo clippy --features otel_spans_spike --all-targets clean; the spike test still passes. |
The main merge pulled in the opentelemetry 0.32 dependency bump (Azure#4691), which removed SpanBuilder::with_end_time. Drop the two redundant .with_end_time(..) builder calls; the backdated end time is already applied via end_with_timestamp(..) when each span ends, so the exported spans and all timeline assertions are unchanged. Update the module doc link accordingly to avoid a broken intra-doc reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Throwaway OpenTelemetry retroactive-span feasibility spike
Companion to the diagnostics contract doc PR (#4684). This is the isolated, throwaway spike that backs up §7–§8 of
DIAGNOSTICS-CONTRACT.md— kept on its own branch so the contract doc stands alone.What it proves
A completed
DiagnosticsContextcan be reconstructed into a backdated OpenTelemetry span tree using the rawopentelemetrySpanBuilder::with_start_time/with_end_time— timestamps theazure_core::tracingabstraction does not expose (it builds spans at "now"). The recorded attempts are laid on an explicit, clearly-backdated (2020) timeline with injected durations, and the operation → attempt parent/child relationships are reconstructed and asserted against an in-memory exporter.Decoupled from the deferred #4619 capture engine
#[cfg(all(test, feature = "otel_spans_spike"))]module so it can use thepub(crate)DiagnosticsContextBuilder.crate::diagnostics/driver::routing/options/models— with no dependency on thediagnostics::captureprototype.opentelemetry+opentelemetry_sdk(in-memory exporter) only behind theotel_spans_spikefeature.Verification
cargo fmt✅ ·cargo clippy --all-features --all-targets -- -D warnings✅ clean · the spike test ✅ passes.4 files, +231: the in-crate test module, the
otel_spans_spikefeature + optional deps, and the module declaration.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com