opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Adding addition middleware in FastAPI with FastAPIInstrumentor is creating a strange span.

Open horw opened this issue 1 year ago • 1 comments
trafficstars

I have added a simple middleware in FastAPI and this has created a strange span, which you can see in the image. image

I have used the following middleware.

@app.middleware("http")
async def hello(request: Request, call_next):
    resp = await call_next(request)
    return resp

How can I create middleware that will not create a new span? Or at least without warning clock skew adjustment disabled; not applying calculated delta of -5.163065ms ?

https://github.com/open-telemetry/opentelemetry-python-contrib/blob/60fb936b7e5371b3e5587074906c49fb873cbd76/instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/init.py#L198

horw avatar Jul 11 '24 02:07 horw

Why is this strange? If this for the multiple spans on POST handling I think we already have an issue for that.

xrmx avatar Jul 11 '24 14:07 xrmx