Repository navigation
Conversation
Exports over OTLP/HTTP to alloy-traces on the host's loopback, and trusts the traceparent Envoy sends, so needle samples exactly the requests Envoy sampled and its spans join Envoy's traces. Needs needle v1.1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment still described v1.0.0. It is rendered into envoy.yaml, so even this changes the config hash and restarts Envoy on the next apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Important
Draft until #30's rollout is done. Do not merge this until needle v1.1.0 is running and settled on all three boxes. Once this is on
main, anyrouting.ymlrun frommainapplies it, so a box still on v1.0.0 would take the new image and this config in one restart. That would undo the point of #30 being digest-only. It also needs v1.1.0:NEEDLE_TRACING_TRUST_TRACEPARENTdoesn't exist before it.What changes
Part of ipni/infra#163. needle starts sending traces, which join the ones Envoy already produces.
k8s/needle/kustomization.yamladds two env vars to all four instances:OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318alloy-tracescollector on the box's loopback, over OTLP/HTTP. This is the endpoint ipni/infra's collector config and monitoring docs name for services.NEEDLE_TRACING_TRUST_TRACEPARENT=trueNEEDLE_SAMPLING_FRACTIONstays at its default of 0, so a request with noTraceparent, such as a tool run on the box, isn't traced.k8s/route-origin/envoy.yaml.j2gets a comment-only fix: it still said v1.0.0 drops the traceparent. It is a separate commit, because of the Envoy restart described below.Is trusting
Traceparentsafe?needle's docs allow it only when needle is reachable solely through a proxy that removes the client's headers and sends its own. Checked in this repo:
envoy.yaml.j2has one listener and one connection manager, and its early header mutation removestraceparentandtracestatebefore Envoy reads them.scripts/routing-rate-test.sh, which an operator runs on the box and which sends noTraceparent.What this costs
envoy.yaml, so even this edit changes theenvoy-confighash. The Deployment usesRecreate, so each box's site has a brief outage when its Envoy is replaced./dnsaddrlookups. The collector keeps any trace containing an error, and needle marks a router span as ERROR when that router returned error results. If that is common, far more than one in ten traces could reach Tempo. I have no measurement of this, so it is the main thing to watch.Span names are low cardinality (endpoint, router operation and router name), so the span metrics stay small. If the collector is down, spans are dropped.
Merging does not deploy this
k8s/needle/andk8s/route-origin/envoy.yaml.j2match none of the path patterns in thechangesjob of.github/workflows/ci.yml, so neither this PR nor its merge triggers a CI dry run or apply. Only the checks run.routing.ymldoesn't run from CI.Rollout plan, for a person to run
After #30's rollout is finished and this is merged, from an up-to-date
main:-e production_rollout=false. It rolls all three boxes at once, which is an outage.--tags needleon those commands. The comment change then waits for the nextrouting.ymlrun that includes the origin role, and restarts Envoy at that point.After sing-1, before going on:
{resource.service.name="needle", resource.cluster="sing1"}, joined toroute-originspans in the same trace.traces_spanmetrics_calls_total{service_name="needle", cluster="sing1"}is non-zero, and its rate looks like about 5% of requests rather than all of them.TraceSpansRefused,TracesNotDeliveredandTempoDiscardingSpansstay quiet, and Tempo's storage growth on lith-1 looks reasonable.To roll back, revert this PR and run the same steps, which costs another warm-up and another Envoy restart.
Checks run locally
All pass:
yamllint .andansible-lint(Passed: 0 failure(s), 0 warning(s), profileproduction)ansible-playbook --syntax-checkon all seven playbooksscripts/render-manifests.yml, pluskubectl kustomizeon every overlaylibp2p_identity.pyunit tests,dns.txtanddns-libp2p.txtagainst their generator, andshellcheckRender diff against
main:needle: the two new variables in the ConfigMap, and its new hash on the ConfigMap and the four Deployments.route-origin: the comment lines and theenvoy-confighash.Differences from CI: these ran on macOS with Python 3.14, and ansible-lint used ansible-core 2.22, while CI uses Ubuntu with Python 3.12. The syntax checks and renders used ansible-core 2.19.4. The cert-manager checksum used
shasum -a 256.Not verified
Traceparenton every request. If Envoy omitted it on unsampled requests, those still wouldn't be traced, because the fraction is 0. The first check after sing-1 covers this.routing.ymldry run, which stays with the person doing the rollout.🤖 Generated with Claude Code