Skip to content

asgiref 3.8 compatibility? #2776

Closed
@drupol

Description

@drupol

Describe your environment

OS: Nix/NixOS
Python version: 3.12
Package version: 0.47b0

What happened?

When trying to package opentelemetry-instrumentation-asgi, it's failing

Build log
Executing pytestCheckPhase
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0 -- /nix/store/l014xp1qxdl6gim3zc0jv3mpxhbp346s-python3-3.12.4/bin/python3.12
cachedir: .pytest_cache
rootdir: /build/source
configfile: pytest.ini
collecting ... ^Mcollected 80 items                                                             

tests/test_asgi_custom_headers.py::TestCustomHeadersEnv::test_http_custom_request_headers_in_span_attributes FAILED [  1%]
tests/test_asgi_custom_headers.py::TestCustomHeadersEnv::test_http_custom_request_headers_not_in_span_attributes FAILED [  2%]
tests/test_asgi_custom_headers.py::TestCustomHeadersEnv::test_http_custom_response_headers_in_span_attributes 
-------------------------------- live log call ---------------------------------
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:204 An instrument with name http.server.duration, type Histogram, unit ms and description Duration of HTTP server requests. has been created already.
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:204 An instrument with name http.server.response.size, type Histogram, unit By and description measures the size of HTTP response messages (compressed). has been created already.
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:204 An instrument with name http.server.request.size, type Histogram, unit By and description Measures the size of HTTP request messages (compressed). has been created already.
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:129 An instrument with name http.server.active_requests, type UpDownCounter, unit {request} and description Number of active HTTP server requests. has been created already.
FAILED                                                                   [  3%]
tests/test_asgi_custom_headers.py::TestCustomHeadersEnv::test_http_custom_response_headers_not_in_span_attributes 
-------------------------------- live log call ---------------------------------
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:204 An instrument with name http.server.duration, type Histogram, unit ms and description Duration of HTTP server requests. has been created already.
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:204 An instrument with name http.server.response.size, type Histogram, unit By and description measures the size of HTTP response messages (compressed). has been created already.
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:204 An instrument with name http.server.request.size, type Histogram, unit By and description Measures the size of HTTP request messages (compressed). has been created already.
WARNING  opentelemetry.sdk.metrics._internal:__init__.py:129 An instrument with name http.server.active_requests, type UpDownCounter, unit {request} and description Number of active HTTP server requests. has been created already.
Exception ignored in: <function ApplicationCommunicator.__del__ at 0x7ffff5c59760>
Traceback (most recent call last):
  File "/nix/store/g1wfp82pn8w93ijzirndj9a9k7wnirh0-python3.12-asgiref-3.8.1/lib/python3.12/site-packages/asgiref/testing.py", line 58, in __del__
    self.stop(exceptions=False)
  File "/nix/store/g1wfp82pn8w93ijzirndj9a9k7wnirh0-python3.12-asgiref-3.8.1/lib/python3.12/site-packages/asgiref/testing.py", line 49, in stop
    if not self.future.done():
           ^^^^^^^^^^^
AttributeError: 'ApplicationCommunicator' object has no attribute 'future'
Exception ignored in: <function ApplicationCommunicator.__del__ at 0x7ffff5c59760>
Traceback (most recent call last):
  File "/nix/store/g1wfp82pn8w93ijzirndj9a9k7wnirh0-python3.12-asgiref-3.8.1/lib/python3.12/site-packages/asgiref/testing.py", line 58, in __del__
    self.stop(exceptions=False)
  File "/nix/store/g1wfp82pn8w93ijzirndj9a9k7wnirh0-python3.12-asgiref-3.8.1/lib/python3.12/site-packages/asgiref/testing.py", line 49, in stop
    if not self.future.done():
           ^^^^^^^^^^^
AttributeError: 'ApplicationCommunicator' object has no attribute 'future'
Exception ignored in: <function ApplicationCommunicator.__del__ at 0x7ffff5c59760>
Traceback (most recent call last):
  File "/nix/store/g1wfp82pn8w93ijzirndj9a9k7wnirh0-python3.12-asgiref-3.8.1/lib/python3.12/site-packages/asgiref/testing.py", line 58, in __del__
    self.stop(exceptions=False)
  File "/nix/store/g1wfp82pn8w93ijzirndj9a9k7wnirh0-python3.12-asgiref-3.8.1/lib/python3.12/site-packages/asgiref/testing.py", line 49, in stop
    if not self.future.done():
           ^^^^^^^^^^^
AttributeError: 'ApplicationCommunicator' object has no attribute 'future'
FAILED                                                                   [  5%]
tests/test_asgi_custom_headers.py::TestCustomHeadersEnv::test_http_repeat_request_headers_in_span_attributes FAILED [  6%]
tests/test_asgi_custom_headers.py::TestCustomHeadersEnv::test_http_repeat_response_headers_in_span_attributes 

Steps to Reproduce

With Nix:

nix build github:NixOS/nixpkgs/master#python3Packages.opentelemetry-instrumentation-asgi -L --show-trace

Without Nix:

With Python ^3.12 and asgiref ^3.8, run the tests in opentelemetry-instrumentation-asgi.

Expected Result

Tests should pass

Actual Result

Tests are failing

Additional context

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions