Skip to content

Improve tracing_subscriber wasm support by swapping web_time with std::time #3337

Open
@cowlicks

Description

@cowlicks

context is this discussion on the discord

Feature Request

Swap usage of std::time with web_time where appropriate.
The wasm tracing_subscriber panics when you subscribe to FmtSpan::CLOSE events because they include span timing with std::time::Instant which isn't available on wasm.

Crates

tracing_subscriber

Motivation

Improve usage on wasm

Proposal

I'm not sure if it would be better to implement this with some #[cfg(target = "wasm32-unknown-unknown")] code, or if it should just be done across the board.

Alternatives

I don't know! I currently can't figure out a good way to measure the elapsed time of a span in wasm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions