-
Notifications
You must be signed in to change notification settings - Fork 49
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
WASM (wasm32-unknown-unknown
) support?
#179
Comments
minstant is designed to work on WASM. Seems like a bug! @zhongzc |
Yeah, that seems to be a bug 🐛 @andylokandy regarding the option to implement some kind of a Span processor, does this sound like a viable solution to you? I can start a PR :) |
The collector is very complex. I don't believe it'll be a good idea to make it public customizable. You may see https://github.com/tikv/minitrace-rust/blob/master/minitrace/src/collector/global_collector.rs |
Yeah, that's what I just figured. We have a completely separate entry point for the WASM runtime, so I think ideally, I can create a custom collector and avoid using the global one (using the library without I'm keeping open because I still think we need to get the |
@andylokandy I noticed the complexity you mentioned. I was wondering if it makes sense to separate the GlobalCollector and allow it to provide it to the global init method? something like This way I thin I can implement different Collector my project a that matches my needs 🤔 (collect and flush manually) |
If only manual flushing is considered, there is a workaround: you could set batch_report_interval to an insantly large value to avoid auto reporting, and then call minitrace::flush manually. |
Let me take a look. |
Yeah that's one option, but the main thing is the implementation of the current collector. It's using threads and I think it's currently not supported (it passes compilation, but fails at runtime as far as I remember). Also, I noticed that
So it's not only the compilation error, we might also need alternative runtime? The |
Well. If threads are not available, then minitrace is hardly useless, because we heavily use optimized thread synchronization technique internally to achieve its performance. |
Yeah, that makes perfect sense when compiling and running on a binary with a long-living session. We can't really use threads, so we want to collect spans in memory, and flush them at the end of the request. |
Updated my lockfile and seems like the fix in I noticed that some other packages are not fully supported:
|
Fixed by tikv/minstant#32. I'm going to move non-related discussion to a new issue. |
It seems like
minitrace
at the moment is usingminstant
(https://github.com/tikv/minitrace-rust/blob/master/minitrace/Cargo.toml#L21), and this crate cannot be compiled to WASM. It fails with an error:Maybe it's possible to migrate to
instant
(https://crates.io/crates/instant)?Also, I noticed that some pieces of the core are using threads, maybe it's possible to provide an external processor to the runtime?
My current use-case uses WASM to build a binary to a CloudFlare Worker (
fetch
event handler). Ideally, the tracing solution for that runtime would need to collect events during the execution pipeline, store the events in memory, and then flush it with a special handler (wait_until
, see https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/#contextwaituntil).Using a processor instead of just passing the batching config to
set_reporter
could look like that:(
opentelemetry-rust
has a similar idea calledSpanProcessor
)The text was updated successfully, but these errors were encountered: