Repository navigation
Conversation
route-origin's Envoy sends an OpenTelemetry span for 5% of requests, and one for its call to needle, to the trace collector on the box's loopback (ipni/infra#163). Span names come from route decorators, never the path. Clients cannot force or continue a trace: x-client-trace-id is ignored and traceparent/tracestate are dropped before Envoy reads them. The access log carries the trace ID, which Grafana links to Tempo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
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.
Part of ipni/infra#163.
What
route-origin's Envoy (
k8s/route-origin/envoy.yaml.j2) sends OpenTelemetry traces to ipni/infra's trace collector on the box's loopback (127.0.0.1:4317,kubernetes/platform/alloy-traces). The collector turns every span into latency metrics, keeps failed traces, traces over 1s and a tenth of the rest, and sends those to Tempo on lith-1. In Grafana they show on the Latency dashboard ("From traces") and in Explore.tracingon the connection manager: 5% of requests (random_sampling), about 7 traces/s per box at the fleet's ~424 req/s. Each sampled request gets Envoy's span plus, withspawn_upstream_span, one for the call to needle, so a trace shows which instance served it and how long it took.service_name: route-origin.decoratoron each route:lookup,ipns-put,version,not-found,misdirected. Never the path: a path carries a CID, and every span name becomes a metric series.client_sampling: 0ignoresx-client-trace-id, and an early header mutation dropstraceparentandtracestatebefore Envoy reads them. (x-envoy-force-traceis already ignored from outside, as Envoy stripsx-envoy-*from external requests.)trace_id. Grafana's Loki data source (ipni/infra#246) turns it into a link to the trace. It is set on every request; only the sampled 5% (that survive tail sampling) are stored.otel_collectorcluster: 127.0.0.1:4317, HTTP/2. If the collector is down, Envoy drops the spans; requests are unaffected.Not in this PR: needle
The plan in ipni/infra#163 was to turn on needle's own traces with
OTEL_*andNEEDLE_SAMPLING_FRACTION. That doesn't work with needle v1.0.0, so it's left out rather than paying for a needle rollout:NEEDLE_SAMPLING_FRACTIONnever samples. needle's root sampler only samples spans whose name starts withneedle, but with otelhttp v0.70 (which v1.0.0 builds against) the request span is named after the method and route (GET /), notneedle.request. Tested with the pinned image at fraction 1: no spans.NEEDLE_TRACING_AUTHand an authorisedtraceparent, needle does export, but only oneGET /span per request, with no breakdown by router.That needs a fix in ipni/needle before needle is worth tracing. Until then needle ignores the
traceparentEnvoy sends it (noNEEDLE_TRACING_AUTH), so needle's side of a request is only Envoy's upstream span.Merge order
If this is rolled out before the collector exists, Envoy just fails to send spans; nothing else changes.
Rollout
routing.ymlisn't applied from CI. The ConfigMap hash changes, so the role rolls Envoy on each box, one box at a time withproduction_rollout:Afterwards, on any box, the access log should carry
trace_id, and Envoy should report spans sent with no failures:Checked
envoy --mode validateon the pinned image (distroless-v1.39.1): OK.lookup,versionandnot-found, plusrouter needle egressfor the upstream call, withservice.name=route-origin;trace_id;traceparent(andx-client-trace-id) got fresh trace IDs, so the strip works.ansible-playbook --syntax-check routing.yml.--check --diffabove is the first look at the real render.🤖 Generated with Claude Code