Skip to content

Using the coiled client with newer versions of ddtrace causes exceptions #331

@samantha-earthmover

Description

@samantha-earthmover

If ddtrace is installed and tracing is enabled, there's some code that blows up in the coiled client while sending api requests

ddtrace=3.14.3

builtins.typeerror: HTTPPropagator.inject() got an unexpected keyword argument 'span_context'
Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/coiled/context.py", line 112, in async_wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/coiled/core.py", line 2034, in _add_interation
    response = await self._do_request(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/backoff/_async.py", line 76, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/coiled/core.py", line 426, in _do_request
    response = await session.request(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/ddtrace/contrib/internal/trace_utils_async.py", line 35, in wrapper
    return await func(mod, pin, wrapped, instance, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/ddtrace/contrib/internal/aiohttp/patch.py", line 122, in _traced_clientsession_request
    resp = await func(*args, **kwargs)  # type: aiohttp.ClientResponse
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/aiohttp/client.py", line 603, in _request
    await trace.send_request_start(method, url.update_query(params), headers)
  File "/app/.venv/lib/python3.12/site-packages/aiohttp/tracing.py", line 355, in send_request_start
    return await self._trace_config.on_request_start.send(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/aiosignal/__init__.py", line 36, in send
    await receiver(*args, **kwargs)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/coiled/context.py", line 149, in on_request_start
    inject_tracing(headers=params.headers)
  File "/app/.venv/lib/python3.12/site-packages/coiled/context.py", line 127, in inject_tracing
    headers.update(create_trace_data())
                   ^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/coiled/context.py", line 138, in create_trace_data
    HTTPPropagator.inject(span_context=span.context, headers=trace_data)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HTTPPropagator.inject() got an unexpected keyword argument 'span_context'

A fix would be nice, but in lieu of that if one of you could grab me the version of ddtrace that y'all are using so I can downgrade us to that, trying to figure out when they renamed it is a pain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions