[fix] expose BatchSpanProcessor queue, exporter and sampler tuning in register() - #192
Open
JayaSurya-27 wants to merge 1 commit into
Open
[fix] expose BatchSpanProcessor queue, exporter and sampler tuning in register()#192JayaSurya-27 wants to merge 1 commit into
JayaSurya-27 wants to merge 1 commit into
Conversation
… register() Previously documented tuning params were silently dropped, making span drops under high throughput unavoidable via the Python API.
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.
What does this PR do?
Exposes span-processor / exporter / provider tuning through
register()and the SDK processor classes:max_queue_size,schedule_delay_millis,max_export_batch_size,export_timeout_millis,timeout,sampler,span_limits,span_exporter. All default toNone, falling back to the standardOTEL_*env vars / upstream defaults, so existing callers see zero behavior change.Why?
Under high-throughput ingestion the OTel
BatchSpanProcessorqueue (default 2048) overflows and spans are silently dropped (Queue full, dropping Span). The SDK'sBatchSpanProcessordocumented tuning params but never accepted or forwarded them, andregister()exposed none of them — so there was no supported Python-API way to prevent the drop.Fixed TH-7478
Also fixed along the way:
register(batch=False)now warns when batch-only tuning params are passed (previously silently dropped; the warning also works on Python 3.10/3.11, not just 3.12+).register(span_exporter=...)no longer crashes with non-OTLP exporters (config banner read_endpoint/_headersunguarded).endpointkwarg onTracerProvider/SimpleSpanProcessor/BatchSpanProcessor._build_default_exporter.Sampler,ParentBased,TraceIdRatioBased,SpanLimitsfor usability.Note: exporter
compressionwas deliberately NOT exposed — the fi-collector does not decode gzip (HTTP or gRPC), so enabling it would break ingestion against self-hosted deployments. To be added together with collector gzip support.How was it tested?
pytest) — 31 new tests inpython/tests/test_batch_span_processor_tuning.py: kwarg/env/default precedence, forwarding to upstream, sampler effectiveness (ratio 0/1),endpoint=TypeError guards, gRPC timeout forwarding, batch=False warning, end-to-end emit, custom-exporter regression./tracer/v1/traces,application/x-protobuf, no Content-Encoding), plus a forced-drop demo (queue=10 drops, queue=100000 does not).ruff checkpasses on changed files (only pre-existing findings remain)register()docstring andpython/CHANGELOG.mdChecklist
Notes for reviewers
None).timeoutis seconds (exporter) while*_millisparams are milliseconds (batch processor) — matches upstream OTel naming; called out in theregister()docstring.tests/test_otel.pyfails collection (staleSESSION_NAMEimport) and one env-dependenttest_settings.pyfailure — both reproduce ondevwithout this change.