dynatrace-extensions / dt-extensions-python-sdk

Dynatrace Python Extensions SDK
https://dynatrace-extensions.github.io/dt-extensions-python-sdk/
MIT License
8 stars 1 forks source link

Investigate providing a thread dump when a scheduled method takes too long to run #8

Closed dlopes7 closed 3 months ago

dlopes7 commented 10 months ago

In Framework V1, there is a single scheduled method, the query method.

When that method takes longer than the hardcoded time (60 seconds) to run, a thread dump file is generated in the logs folder of the plugin agent.

On Framework V2 many methods can be scheduled. When one of them runs for longer than the scheduled interval, an ERROR event is sent to the EEC with the method name and how long it took to run.

Maybe we could also send the full thread dump when that happens, to help the extension developer troubleshoot where his code got stuck.

The main challenge is that today the SDK is very lean, it has zero dependencies. We would need to find a way to provide a dump without introducing a dependency.

FYI @Dynatrace-James-Kitson

dlopes7 commented 3 months ago

I don't think this can be done because by the time we send the event all threads have already finished, we can't go back in time and get the stack.