feat(sdk): add optional traceprovider parameter - #260
Merged
namrataghadi-galileo merged 2 commits intoAug 21, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
namrataghadi-galileo
enabled auto-merge (squash)
August 21, 2026 20:47
soumya-io
self-requested a review
August 21, 2026 21:09
soumya-io
approved these changes
Aug 21, 2026
namrataghadi-galileo
deleted the
feature/SAO-16152-add-optional-trace-provider-init-param
branch
August 21, 2026 21:10
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.
Summary
TracerProvider, exporter, and span processor. Applications that already run OTEL (e.g. Google ADK viaGoogleADKInstrumentor) ended up with two disconnected pipelines, splitting application and control spans across separate export requests.otel_tracer_providerparam toagent_control.init()so the built-inotelsink can reuse an application-owned or globally-registered SDK provider instead of always creating its own.Scope
otel_tracer_providerkwarg onagent_control.init()/init_observability().observability_sink_name="otel"; ignored fordefault,registered, and other named sinks.TracerProvider(viatrace.get_tracer_provider()) → Agent Control-owned provider (existing behavior).otel_sink.py:create_otel_control_event_sink()accepts atracer_providerkwarg, tracksprovider_owned, and only attaches an Agent Control exporter/BatchSpanProcessorwhen it creates the provider itself. OTLP exporter import is now lazy and skipped entirely on the external-provider path.observability.py: provider is threaded through a runtime-only global (_configured_otel_tracer_provider), not the JSON-typedobservability_sink_config. Changing the explicit provider on reinitialization invalidates only the cached OTEL sink, leaving other sink caches untouched.OTELControlEventSink.close()flushes external providers but no longer shuts them down; Agent Control-created providers are still shut down as before.default,registered, or other named custom sink behavior.Risk and Rollout
Noneand only affects behavior whenobservability_sink_name="otel"; all other sink paths are unchanged.Testing
test_otel_sink.py(explicit-provider precedence, provider-owned vs. external, proxy/no-op rejection, no duplicate processor, trace/parent correlation, lifecycle/shutdown ownership, reinitialization invalidation) andtest_init_validation.py(runtime-only path, not leaked intosink_config).make check:uv run pytest(644 passed, 1 pre-existing unrelated failure requiring a live server, confirmed failing on the prior commit too),uv run mypy src/agent_control(clean),uv run ruff check src/(clean, matches themake linttarget).Checklist