Dynatrace/OneAgent-SDK-for-Python

Agent does not seem to trace calls to MongoDB when using AsyncIOMotorClient.

3x0dv5 opened this issue · 1 comments

I wonder if anyone out there managed to get Dynatrace to work with AsyncIOMotorClient, like when we use Beanie.
It seems that in the Listener the oneage.get_sdk().tracecontext_get_current() is always empty, it's like OneAgent loses track of the current trace context.
It seems that the python SDK does not support the scenario where we use MongoDb with Beanie.

Have you guys also seen this?

The trace context is only maintained on the current thread, the SDK does not support cross-thread tracing or async patterns out of the box. Depending on how exactly this hook is invoked you may be able to make it work using in-process linking https://github.com/Dynatrace/OneAgent-SDK-for-Python/blob/master/README.md#trace-in-process-asynchronous-execution

Of course, you also need to start some other tracer in the first place to have something as get_current, but I'm assuming you do that already.