Skip to content

Commit bbb1b94

Browse files
committed
celery: remove deprecated import of ContextManager from typing
Signed-off-by: emdneto <[email protected]>
1 parent 1092344 commit bbb1b94

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
import logging
16-
from typing import ContextManager, Optional, Tuple
18+
from contextlib import AbstractContextManager
19+
from typing import Optional, Tuple
1720

1821
from celery import registry # pylint: disable=no-name-in-module
1922
from celery.app.task import Task
@@ -123,7 +126,7 @@ def attach_context(
123126
task: Optional[Task],
124127
task_id: str,
125128
span: Span,
126-
activation: ContextManager[Span],
129+
activation: AbstractContextManager[Span],
127130
token: Optional[object],
128131
is_publish: bool = False,
129132
) -> None:
@@ -171,7 +174,7 @@ def detach_context(task, task_id, is_publish=False) -> None:
171174

172175
def retrieve_context(
173176
task, task_id, is_publish=False
174-
) -> Optional[Tuple[Span, ContextManager[Span], Optional[object]]]:
177+
) -> Optional[Tuple[Span, AbstractContextManager[Span], Optional[object]]]:
175178
"""Helper to retrieve an active `Span`, `ContextManager` and context token
176179
stored in a `Task` instance
177180
"""

instrumentation/opentelemetry-instrumentation-celery/test-requirements-1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
amqp==5.2.0
22
asgiref==3.8.1
3-
billiard==4.2.0
3+
billiard==4.2.1
44
celery==5.3.6
55
click==8.1.7
66
click-didyoumean==0.3.0

0 commit comments

Comments
 (0)