fermyon / spin

Spin is the open source developer tool for building and running serverless applications powered by WebAssembly.
https://developer.fermyon.com/spin
Apache License 2.0
5.24k stars 248 forks source link

Sleeping in a Spin app breaks traces #2487

Open calebschoepp opened 6 months ago

calebschoepp commented 6 months ago

Traces are not properly emitted when a Spin app sleeps.

The commit that introduced this regression is most likely here.

e.g.

use spin_sdk::http::{IntoResponse, Response};
use spin_sdk::http_component;
use spin_sdk::observe;

/// A simple Spin HTTP component.
#[http_component]
async fn hello_world(_req: http::Request<()>) -> anyhow::Result<impl IntoResponse> {
    std::thread::sleep(std::time::Duration::from_millis(500));
    Ok(Response::new(200, "Hello, world!"))
}
lann commented 6 months ago

(As discovered by @calebschoepp) Disabling metrics fixes this. Seems probable that this is an upstream tracing-opentelemetry or opentelemetry bug.

calebschoepp commented 4 months ago

Potentially related to #2525