opentelemetry-rust icon indicating copy to clipboard operation
opentelemetry-rust copied to clipboard

[Feature]: Name spawned threads

Open howardjohn opened this issue 1 year ago • 3 comments

Related Problems?

No response

Describe the solution you'd like:

The TokioCurrentThread spawns threads without names. This makes debugging hard. For example:

thread '<unnamed>' panicked at /home/john/.rhack/tokio-1.37.0/src/runtime/time/entry.rs:557:9:
A Tokio 1.x context was found, but it is being shutdown.

is quite hard to trace back to otel.

I would like each thread spawned by this library to be named

Considered Alternatives

Use the multithreaded tokio runtime which does not spawn. This is currently causing deadlocks (https://github.com/open-telemetry/opentelemetry-rust/issues/1395), so its not acceptable.

Additional Context

No response

howardjohn avatar Jul 20 '24 01:07 howardjohn

BTW, I don't get A Tokio 1.x context was found, but it is being shutdown. after upgrading -- was just an example of a type of issue that would have been easier to debug if the thread was named.

howardjohn avatar Jul 20 '24 02:07 howardjohn

@howardjohn If you'd like to contribute the fix, please feel free to proceed. We eventually plan to eliminate the dependency on the async runtime for batch processors. I'm currently working on this for logs (#1943), and a similar approach would be replicated to traces as well.

lalitb avatar Jul 20 '24 02:07 lalitb

BTW turns out the error was actually still happening, opened https://github.com/open-telemetry/opentelemetry-rust/issues/1963. I missed it due to not setting the global trace provider after upgrading :facepalm:

howardjohn avatar Jul 24 '24 20:07 howardjohn

Closing as thread created by PeriodicReader, BatchProcessor uses named thread.

cijothomas avatar Dec 19 '24 02:12 cijothomas