fix(opentelemetry-instrumentation-celery): detach only if the ctx token is not None#2855
Closed
malcolmrebughini wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
17e0d53 to
78c883b
Compare
11 tasks
hyoinandout
reviewed
Sep 5, 2024
...on/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/__init__.py
Show resolved
Hide resolved
|
any news I have this exact problem (ctx token is None and detach crashes) using logfire (Opentelemetry) instrumentation... |
11 tasks
GareArc
added a commit
to langgenius/dify
that referenced
this pull request
Mar 2, 2026
Upgrade OTEL packages from 0.48b0/1.27.0 to 0.49b0/1.28.0 to fix "Failed to detach context" error. Root cause: opentelemetry-instrumentation-celery 0.48b0 and opentelemetry-instrumentation-flask 0.48b0 pass None tokens to context.detach(), causing TypeError. Fixed upstream in 0.49b0 via PR #2927. Changes: - opentelemetry-* packages: 0.48b0 → 0.49b0 (instrumentation) / 1.27.0 → 1.28.0 (SDK/API) - protobuf: 4.25.8 → 5.29.6 (required by OTEL 1.28.0) - google-api-core: 2.18.0 → >=2.19.1 (protobuf 5.x support) - google-auth: 2.29.0 → >=2.47.0 (required by google-cloud-aiplatform 1.123+) - google-cloud-aiplatform: 1.49.0 → >=1.123.0 (google-cloud-storage 3.x support) - googleapis-common-protos: 1.63.0 → >=1.65.0 (protobuf 5.x support) - google-cloud-storage: 2.16.0 → >=3.0.0 (protobuf 5.x support) - httpx: ~=0.27.0 → ~=0.28.0 (required by google-genai 1.37+) Testing: All 26 OTEL unit tests pass. Refs: - open-telemetry/opentelemetry-python#4163 - open-telemetry/opentelemetry-python-contrib#2855 - open-telemetry/opentelemetry-python-contrib#2927
GareArc
added a commit
to langgenius/dify
that referenced
this pull request
Mar 2, 2026
Upgrade OTEL packages from 0.48b0/1.27.0 to 0.49b0/1.28.0 to fix "Failed to detach context" error. Root cause: opentelemetry-instrumentation-celery 0.48b0 and opentelemetry-instrumentation-flask 0.48b0 pass None tokens to context.detach(), causing TypeError. Fixed upstream in 0.49b0 via PR #2927. Changes: - opentelemetry-* packages: 0.48b0 → 0.49b0 (instrumentation) / 1.27.0 → 1.28.0 (SDK/API) - protobuf: 4.25.8 → 5.29.6 (required by OTEL 1.28.0) - google-api-core: 2.18.0 → >=2.19.1 (protobuf 5.x support) - google-auth: 2.29.0 → >=2.47.0 (required by google-cloud-aiplatform 1.123+) - google-cloud-aiplatform: 1.49.0 → >=1.123.0 (google-cloud-storage 3.x support) - googleapis-common-protos: 1.63.0 → >=1.65.0 (protobuf 5.x support) - google-cloud-storage: 2.16.0 → >=3.0.0 (protobuf 5.x support) - httpx: ~=0.27.0 → ~=0.28.0 (required by google-genai 1.37+) Testing: All 26 OTEL unit tests pass. Refs: - open-telemetry/opentelemetry-python#4163 - open-telemetry/opentelemetry-python-contrib#2855 - open-telemetry/opentelemetry-python-contrib#2927
GareArc
added a commit
to langgenius/dify
that referenced
this pull request
Mar 2, 2026
Upgrade OTEL packages from 0.48b0/1.27.0 to 0.49b0/1.28.0 to fix "Failed to detach context" error. Root cause: opentelemetry-instrumentation-celery 0.48b0 and opentelemetry-instrumentation-flask 0.48b0 pass None tokens to context.detach(), causing TypeError. Fixed upstream in 0.49b0 via PR #2927. Changes: - opentelemetry-* packages: 0.48b0 → 0.49b0 (instrumentation) / 1.27.0 → 1.28.0 (SDK/API) - protobuf: 4.25.8 → 5.29.6 (required by OTEL 1.28.0) - google-api-core: 2.18.0 → >=2.19.1 (protobuf 5.x support) - google-auth: 2.29.0 → >=2.47.0 (required by google-cloud-aiplatform 1.123+) - google-cloud-aiplatform: 1.49.0 → >=1.123.0 (google-cloud-storage 3.x support) - googleapis-common-protos: 1.63.0 → >=1.65.0 (protobuf 5.x support) - google-cloud-storage: 2.16.0 → >=3.0.0 (protobuf 5.x support) - httpx: ~=0.27.0 → ~=0.28.0 (required by google-genai 1.37+) Testing: All 26 OTEL unit tests pass. Refs: - open-telemetry/opentelemetry-python#4163 - open-telemetry/opentelemetry-python-contrib#2855 - open-telemetry/opentelemetry-python-contrib#2927
GareArc
added a commit
to langgenius/dify
that referenced
this pull request
Mar 2, 2026
Upgrade OTEL packages from 0.48b0/1.27.0 to 0.49b0/1.28.0 to fix "Failed to detach context" error. Root cause: opentelemetry-instrumentation-celery 0.48b0 and opentelemetry-instrumentation-flask 0.48b0 pass None tokens to context.detach(), causing TypeError. Fixed upstream in 0.49b0 via PR #2927. Changes: - opentelemetry-* packages: 0.48b0 → 0.49b0 (instrumentation) / 1.27.0 → 1.28.0 (SDK/API) - protobuf: 4.25.8 → 5.29.6 (required by OTEL 1.28.0) - google-api-core: 2.18.0 → >=2.19.1 (protobuf 5.x support) - google-auth: 2.29.0 → >=2.47.0 (required by google-cloud-aiplatform 1.123+) - google-cloud-aiplatform: 1.49.0 → >=1.123.0 (google-cloud-storage 3.x support) - googleapis-common-protos: 1.63.0 → >=1.65.0 (protobuf 5.x support) - google-cloud-storage: 2.16.0 → >=3.0.0 (protobuf 5.x support) - httpx: ~=0.27.0 → ~=0.28.0 (required by google-genai 1.37+) Testing: All 26 OTEL unit tests pass. Refs: - open-telemetry/opentelemetry-python#4163 - open-telemetry/opentelemetry-python-contrib#2855 - open-telemetry/opentelemetry-python-contrib#2927
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
As brought up in this comment, if the task producer is not instrumented the incoming context will be None and there's no token to attach.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.