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

SIGINT ignored when using .install_batch(opentelemetry::runtime::Tokio) #731

Closed
rex-remind101 opened this issue Feb 11, 2022 · 6 comments
Closed
Labels
A-trace Area: issues related to tracing question Further information is requested

Comments

@rex-remind101
Copy link
Contributor

I've confirmed that when using .install_batch(opentelemetry::runtime::Tokio) I cannot stop the running program via ^C (in my case with Tokio but maybe this is true for any runtime). When using .install_simple() I can use SIGINT to kill the program no problem.

more here actix/actix-web#2638

@TommyCpp
Copy link
Contributor

I think you need to use opentelemetry::runtime::TokioCurrentThread to start to spawn the background job of opentelemetry in the right place. Alternatively, you can use #[tokio::main] instead of #[actix_web::main] to start a multi-thread tokio runtime. Then you should be able to use opentelemetry::runtime::TokioCurrentThread

@rex-remind101
Copy link
Contributor Author

I don't know what those macros do, but I'd imagine #[actix_web::main] does more than #[tokio::main], so that wouldn't be a drop in replacement. Is there an example of using both of these together or using opentelemetry::runtime::TokioCurrentThread I can follow? Thank you

@TommyCpp
Copy link
Contributor

There are few options here. One is using actic-web-opentelemetry repo. Or you can simplely enable rt-tokio-current-hread feature in opentelemetry and use opentelemetry::runtime::TokioCurrentThread. No other changes needed.

@TommyCpp TommyCpp added A-trace Area: issues related to tracing question Further information is requested labels Feb 13, 2022
@rex-remind101
Copy link
Contributor Author

Oh, ok! It was unclear to me what rt-tokio-current-thread does but that makes sense now. Is that documented and I simply missed it?

Will give that a shot, thank you.

@rex-remind101
Copy link
Contributor Author

This worked, thanks. I looked at documentation and the only explanation sort of hinting at the full context of what you said is here

/// this, be sure to enable the `rt-tokio-current-thread` feature in this crate

@TommyCpp
Copy link
Contributor

Good point. I updated one of our examples to be more accurate #734. Also, we should add some additional context on how to choose runtime on the main docs. I will close this for now as the problem is resolved but I will open an action item on GA issue to track the doc updates.

@TommyCpp TommyCpp mentioned this issue Feb 15, 2022
15 tasks
@hdost hdost mentioned this issue Feb 21, 2024
41 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trace Area: issues related to tracing question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants