fix(logger): gate OTLP/syslog/tokio stack for wasm32 targets#22
Open
p0wline wants to merge 5 commits into
Open
fix(logger): gate OTLP/syslog/tokio stack for wasm32 targets#22p0wline wants to merge 5 commits into
p0wline wants to merge 5 commits into
Conversation
opentelemetry-otlp (grpc-tonic) pulls tonic -> tokio (net) -> mio, which does not compile for wasm32-unknown-unknown. All OTLP, syslog, and file-appender stacks are now restricted to cfg(not(target_arch = "wasm32")). On wasm32, tracing_init() is a no-op stub and LoggingGuards is an empty struct. Bumps version 0.8.0 -> 0.8.1.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes wasm32-unknown-unknown build failures caused by opentelemetry-otlp (grpc-tonic → tokio/net → mio) by gating OTLP/syslog/file-appender logging functionality to non-wasm32 targets and providing no-op stubs on wasm32.
Changes:
- Move OTLP/syslog-related dependencies under
target.'cfg(not(target_arch = "wasm32"))'.dependenciesto avoid pulling tokio/mio on wasm32. - Gate OTLP-related types/APIs and logging initialization logic to non-wasm targets, and provide a wasm32 no-op
tracing_init()plus a stubLoggingGuards. - Bump workspace version
0.8.0→0.8.1(and updateCargo.lock).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crate/logger/src/types.rs | Adds cfg-gating for OTLP guard types and introduces a wasm32 LoggingGuards no-op stub. |
| crate/logger/src/lib.rs | Gates OTLP/syslog/file-appender initialization to non-wasm and adds a wasm32 no-op tracing_init(). |
| crate/logger/src/error.rs | Gates OTLP-specific error variants to non-wasm targets. |
| crate/logger/Cargo.toml | Moves OTLP/syslog deps to non-wasm target deps; adjusts dependency placement. |
| Cargo.toml | Bumps workspace version to 0.8.1. |
| Cargo.lock | Updates locked crate versions to 0.8.1. |
Comments suppressed due to low confidence (1)
crate/logger/Cargo.toml:44
- The
tracing_exampleno longer hasrequired-features, so it will be considered by--all-targetsbuilds/lints for wasm32 even though it uses#[tokio::main]and setsTracingConfig::log_to_syslog(which is absent on wasm32 with the current cfg). This can reintroduce wasm32 build failures in CI when someone runscargo clippy --all-targets --target wasm32-unknown-unknown. Gate the example behind a feature again (and define the feature) to keep default/wasm builds working.
[[example]]
name = "tracing_example"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
time >= 0.3.36 removed the deprecated Parseable trait used by cookie-0.16.2 (pulled by actix-web 4.x). Pin time to 0.3.35 in the lockfile until actix-web migrates to cookie >= 0.18.
p0wline
added a commit
to Cosmian/kms
that referenced
this pull request
Jun 30, 2026
…to 0.8.1 - Integrate k8s-plugin-e2e job directly into test_all.yml alongside all other test types (test-nix, hsm, windows). The job is gated on internal PRs only (requires ghcr.io pull access). - Remove the now-redundant standalone k8s-plugin-e2e.yml workflow. - Bump cosmian_logger workspace dep 0.8.0 -> 0.8.1 (anticipates Cosmian/http_client_server#22 which gates OTLP/tonic/mio behind cfg(not(target_arch = "wasm32")), fixing the WASM build).
…e pin time is a version-constraint-only dep (not used in code) to keep actix-web 4.x -> cookie 0.16.2 compilable. The affected parse functions are not called with untrusted input in this codebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
opentelemetry-otlp(withgrpc-tonic) pullstonic→tokio(with thenetfeature) →mio, which does not compile forwasm32-unknown-unknown. This causedcosmian_kms_client_wasmbuilds to fail whenevercosmian_loggerwas a dependency.Fix
All OTLP, syslog, and file-appender stacks are now restricted to
cfg(not(target_arch = "wasm32")):Cargo.toml: OTLP/syslog deps moved to[target.'cfg(not(target_arch = "wasm32"))'.dependencies]src/error.rs: OTLP error variants gatedsrc/types.rs:TelemetryGuards,LoggingGuards(with SDK fields) gated; wasm32 gets a no-opLoggingGuardsstubsrc/lib.rs: all OTLP/syslog/file-appender code gated; wasm32 gets a no-optracing_init()On wasm32,
tracing_init()is a no-op stub — downstream code should install a wasm-compatible subscriber (e.g.tracing_wasm) if log output is needed.Verification
Bumps version
0.8.0→0.8.1.