Skip to content

Conversation

@asteurer
Copy link

@asteurer asteurer commented Nov 4, 2025

Overview

This is an implementation of WASI OTel which gives guest applications the ability to export traces and metrics (and eventually logs) with OpenTelemetry SDKs.

We see two options for adding this to Spin:

  • Require the user to compile Spin with configuration flags that will enable this feature.
  • Have this feature available out-of-the-box and add an experimental-features flag that the user will pass to spin up.

To help ease adoption, we would prefer to pass a flag to spin up, but we know there was some previous work around this with WASI P3 so we're happy to defer to that process.

Some additional notes:

  • In the root Cargo.toml, you will notice that certain experimental features are being enabled for the opentelemetry-sdk dependency, and that we are using reqwest-client instead of reqwest-blocking-client in the opentelemetry dependency. These are all to prevent runtime errors that come from the default OpenTelemetry dependency configurations conflicting with Spin's async runtime.
  • Currently wasi-otel is a phase 0 proposal but we are presenting it to the WASI subgroup this month in the hopes of moving it to phase 1.

Usage

To try the features added in this PR, do the following:

  1. Build Spin from this branch:
git clone --branch wasi-otel --depth 1 https://github.com/asteurer/spin
cd spin
cargo install --path .
spin plugin update
spin plugin install otel
  1. Clone OpenTelemetry WASI and try the Rust example applications:
git clone https://github.com/calebschoepp/opentelemetry-wasi
spin otel setup

###############
### Tracing ###
###############
cd opentelemetry-wasi/rust/examples/spin-basic
spin build
spin otel up

# In a different terminal window
spin otel open jaeger
curl localhost:3000

################
###  Metrics ###
################
cd opentelemetry-wasi/rust/examples/spin-metrics
spin build
spin otel up

# In a different terminal window
spin otel open prometheus
curl localhost:3000

Signed-off-by: Caleb Schoepp <[email protected]>

fix: update opentelemetry version

Signed-off-by: Andrew Steurer <[email protected]>

Fix out of date Cargo.lock from bad rebase

Signed-off-by: Caleb Schoepp <[email protected]>

feat(factor-otel): adding metrics

Signed-off-by: Andrew Steurer <[email protected]>

feat(factor-otel): refactoring otel conversions

Signed-off-by: Andrew Steurer <[email protected]>

fix(telemetry): update BatchLogProcessor to be async

Signed-off-by: Andrew Steurer <[email protected]>

feat(factor-otel): refactoring WIT and updating conversions

Signed-off-by: Andrew Steurer <[email protected]>

fix(factor-otel): updating WIT

Signed-off-by: Andrew Steurer <[email protected]>

feat(factor-otel): updating WIT and conversions

Signed-off-by: Andrew Steurer <[email protected]>

feat(factor-otel): small refactors

Signed-off-by: Andrew Steurer <[email protected]>

fix(factor-otel): rebasing wasi-otel branch on main

Signed-off-by: Andrew Steurer <[email protected]>
@calebschoepp
Copy link
Collaborator

@lann I think you would likely be the most relevant reviewer for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants