Instrumenting WebAssembly
You can use emit in WebAssembly applications.
When WebAssembly support requires bindings to JavaScript APIs, crates will use a web Cargo feature that enables them.
If you’re targeting WASI via the wasm32-wasip2 target, you shouldn’t need to do anything special to make emit work, but not all emitters support WASI yet. The following emitters are compatible with WASI:
emit_termto emit events to stdout.
If you’re targeting NodeJS or the web via the wasm32-unknown-unknown target, you can use emit’s default enabled web Cargo feature, and any emitters that support a web Cargo feature of their own. That includes:
emit_otlpto emit events to an OpenTelemetry-compatible service. Note that in the browser you may need to configure CORS. See the docs for more details.emit_otlpsupportswasm32-unknown-unknown, but notwasm32v1-none.emit_webto emit events via theconsoleAPI.emit_websupports bothwasm32-unknown-unknownandwasm32v1-none.
You can also treat WebAssembly like any other embedded target. See Instrumenting embedded applications for more details.