Skip to content

FastApi Opentelemetry throwing concurrent.futures._base.CancelledError  #467

@nilansaha

Description

@nilansaha

For Kubernetes I have implemented healthchecks in FastAPI like this

@router.get("/health/liveness", tags=["health_checks"])
async def liveness():
    if check_liveness():
        result = {"status": "UP"}
    else:
        result = {"result": "DOWN"}
    return result

However, opentelemetry always gives errors in these spans. Not sure why. This is the error I get in Datadog Tracing

CancelledError
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/opentelemetry/trace/__init__.py", line 522, in use_span
yield span
File "/usr/local/lib/python3.7/site-packages/opentelemetry/sdk/trace/__init__.py", line 879, in start_as_current_span
yield span_context
File "/usr/local/lib/python3.7/site-packages/opentelemetry/instrumentation/asgi/__init__.py", line 213, in wrapped_receive
message = await receive()
File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 526, in receive
await self.message_event.wait()
File "/usr/local/lib/python3.7/asyncio/locks.py", line 293, in wait
await fut
concurrent.futures._base.CancelledError

And this happens for all the endpoints. Not sure whats up. Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions