feat!: bump the lower bound of opentelemetry-instrumentation from 0.43b0 to 0.64b0 - #425
Draft
adubovik wants to merge 6 commits into
Draft
feat!: bump the lower bound of opentelemetry-instrumentation from 0.43b0 to 0.64b0 #425adubovik wants to merge 6 commits into
adubovik wants to merge 6 commits into
Conversation
Bump the lower bound of the OTel instrumentation packages from 0.43b0 to 0.64b0 and use the APIs it provides instead of relying on the behaviour which changed in 0.61b0: * `inject_trace_context=True` adds the `otel*` fields to log records without taking over the logging format - the instrumentor stopped doing it unconditionally in 0.61b0, * the log handler is installed by the instrumentor itself (`enable_log_auto_instrumentation`) instead of the one from `opentelemetry.sdk._logs`, which is deprecated since 1.44 and which used to duplicate every exported log record. Reverts the matrix of OTel versions in the noxfile: the SDK now supports the single generation of the libraries. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The instrumentor is a singleton, so the second `instrument()` call was a no-op guarded by `config.tracing is None` - hard to reason about. Collapse both calls into one, placed after `set_logger_provider()` so the log handler binds to an already-set logger provider. `set_logging_format` is now suppressed when `console_export` is on: OTel's console exporter takes over stderr, so the text format installed by `logging.basicConfig()` was removed again by the logs branch anyway. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Applicable issues
N/A
Description of changes
The OTel instrumentation packages changed the logging behaviour in
0.61b0, breaking the SDK's telemetry tests. Instead of working around it, the lower bound is bumped to0.64b0and the new APIs are used:inject_trace_context=True— adds theotel*fields (otelTraceID,otelSpanID,otelTraceSampled,otelServiceName) to every log record without taking over the logging format. Up to0.60b1the instrumentor did it unconditionally; since0.61b0it only does so together with thelogging.basicConfig()takeover, which the SDK avoids whenTracingConfig.loggingis off. The kwarg was added in0.64b0.enable_log_auto_instrumentation— the log handler is now installed by the instrumentor itself instead ofopentelemetry.sdk._logs.LoggingHandler, which is deprecated since1.44in favour of the one fromopentelemetry-instrumentation-logging. Since0.61b0the instrumentor installs its own handler by default, so the SDK's handler duplicated every exported log record when both tracing and logs were enabled. The kwarg lets the SDK decide, overriding theOTEL_PYTHON_LOG_AUTO_INSTRUMENTATIONenv var. The exported payload is unchanged: the handler is a copy of the deprecated one (sameWARNING->WARNmapping,NOTSETlevel, so no level floor).The new
test_console_export_with_tracing_emits_no_duplicatescovers the duplication, which no test caught before.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
🤖 Generated with Claude Code