Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when using threading.Timer #1877

Open
ocelotl opened this issue Jun 28, 2023 · 0 comments
Open

Issue when using threading.Timer #1877

ocelotl opened this issue Jun 28, 2023 · 0 comments

Comments

@ocelotl
Copy link
Contributor

ocelotl commented Jun 28, 2023

          Hello, 

I've encountered an issue when trying to instrument threading.Thread. Everything works fine until I try to use threading.Timer, which fails with a TypeError. I believe this is because Timer internally creates a new Thread which is not covered by the instrumentation.

Here's the minimal code to reproduce the issue:

from opentelemetry.instrumentation.threading import ThreadingInstrumentor
import threading

ThreadingInstrumentor().instrument()

def test():
    pass

threading.Timer(0, test)  # Raises TypeError

And the error message:

TypeError: super(type, obj): obj must be an instance or subtype of type

I've tried to work around this by modifying the ThreadingInstrumentor to cover Timer as well, but this leads to other complications as Timer has a more complex implementation than Thread.

It would be great if the library could provide a way to instrument Timer without these issues, or at least document this limitation and provide some guidance on how to deal with it.

Thank you.

Originally posted by @NikulausRui in #1582 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant