fix(opentelemetry): give inject_core_spans its own tracer cache key#13633
Open
shreemaan-abhishek wants to merge 1 commit into
Open
Conversation
rewrite() and inject_core_spans() build different tracers (route sampler vs forced always_on) but shared one lrucache slot keyed only on metadata.modifiedIndex, so a warm worker could hand inject_core_spans the route-sampler tracer and silently drop the always_on guarantee. Namespace the inject cache key so the always_on tracer is preserved, while keeping the rebuild-on-metadata-change behavior. Also harden the regression test setup to fail fast when the admin update is rejected or the metadata never propagates to the worker, instead of returning "ok" on a broken setup and masking the real assertion.
membphis
approved these changes
Jun 30, 2026
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.
Description
Follow-up to #13618.
_M.rewrite()andinject_core_spans()build different tracers:rewriteuses the route's configured sampler, whileinject_core_spansdeliberately forces analways_onsampler so that, once a trace's root span is recording, the full internal core-span tree is kept unconditionally regardless of the route sampler.After #13618 both paths called
core.lrucache.plugin_ctx()with the same extra key (metadata.modifiedIndex) on the sameapi_ctx, so they shared a single lrucache slot. On a warm worker,rewrite(rewrite phase) populates the slot first, andinject_core_spans(log phase) then reuses that route-sampler tracer instead of thealways_onone it built, silently dropping the always_on guarantee for any sampler that is not trace_id-deterministic.This change namespaces the inject cache key (
inject_core_spans#<modifiedIndex>) so the two tracers no longer collide, while preserving the rebuild-on-metadata-change behavior from #13618.It also hardens the regression test setup added in #13618 to fail fast when the admin update is rejected or the metadata never propagates to the worker, so the test cannot return
okon a broken setup and mask the real assertion.Checklist