Thread RoutingMetadata trait through user tracing; move routing heade…#1
Draft
mar-cf wants to merge 3 commits into
Draft
Thread RoutingMetadata trait through user tracing; move routing heade…#1mar-cf wants to merge 3 commits into
mar-cf wants to merge 3 commits into
Conversation
Adds the per-process user pipeline — `UserTracingSettings`, `init_user`/`USER_HARNESS`, and the OTLP-over-UDS exporter that encodes `RoutingMetadata` into the `cf-trace-config` header — wired into `telemetry::init`. `start_user_trace` now takes a required `RoutingMetadata` attached at span construction and inherited by descendants (the exporter drops routing-less spans). Verified end-to-end by producer tests that decode the exported OTLP body.
Adds the `TraceparentContext` W3C parser and wires it through: `start_user_trace` gains an optional `inbound` traceparent that stitches the user root onto the upstream trace (shared trace id, inbound parent), and `user_tracing::w3c_traceparent()` derives the header for the current user span for outbound propagation. Covered by parser unit tests plus continuation tests through the test harness and the OTLP/UDS producer path.
…r name to OtlpUds settings
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.
//
RoutingMetadatais a trait — you define the concrete routing type.group_keybatches// spans that share it into one request;
encodeproduces the routing header's value.#[derive(Debug)]
struct MyRouting { zone_id: u64, account_id: u64 }
impl RoutingMetadata for MyRouting {
fn group_key(&self) -> String { format!("{}|{}", self.zone_id, self.account_id) }
fn encode(&self) -> String { format!("zone={};account={}", self.zone_id, self.account_id) }
}
// Per request: open the root.
routingis required and fixed at construction (inherited by all// descendants);
inboundcontinues an upstream W3C trace, or None for a fresh one.let _root = tracing::start_user_trace(
"example_span_name",
MyRouting { zone_id, account_id },
inbound, // Option
);