Open wooden-worm opened 2 years ago
Hi :wave: Sorry for the late response. Could you provide your compiling target? for target_arch=wasm32
, we only use the Duration
and UNIX_EPOCH
in time mod, which should be the same across different platforms. And the #[path]
attribute in your link should point the mod to https://github.com/rust-lang/rust/blob/master/library/std/src/sys/unsupported/time.rs, as you can see Duration
and UNIX_EPOCH
are avaible.
I just double checked, when target wasm32-unknown-unknown
open telemetry panics at https://github.com/rust-lang/rust/blob/f0c4da49983aa699f715caf681e3154b445fb60b/library/std/src/sys/unsupported/time.rs#L13 at runtime.
Any chance you are using opentelemetry-stackdriver
crate? Looks like the panic happens for Instant::now()
function.
Marked as a after stable as this is only part of stackdriver and shouldn't be required for stabilization of the Primary SDKs.
I tried to use open telemetry with wasm, but got the runtime error
time not implemented on this platform
I haven't investigated in depth yet, but I think it's because open telemetry is referring the
std::time
module, which in turn pulls in https://github.com/rust-lang/rust/blob/cfa4ac66c194046f631ce076c75516ecfdeb77ee/library/std/src/sys/wasm/mod.rs#L47, which is non existent. Thus just swapping outtime::now()
like what we're doing here https://github.com/open-telemetry/opentelemetry-rust/blob/185ab3c20f0483f80b60eba23fdd8ec4b2b189aa/opentelemetry/src/lib.rs#L258 doesn't work.