spinframework / spinframework/spin
[OTel]: Spans produced by `spin_sdk::key_value::Store::set` don't have a parent assigned
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 310
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 24
Description
Spans produced as part of using the key-value store set function, don't have a parent assigned. This results in having two independent traces from a single HTTP API invocation
I've tested other actions in the context of key-value store (such as exists and `get) which are all represented correctly:
Versions
spinCLI:spin 2.5.1 (cba6773 2024-05-14)spin-sdkcrate:3.0.1
Repro
See the following pseudo code for reproducing the behavior:
use spin_sdk::http::{IntoResponse, Request, Response};
use spin_sdk::http_component;
use spin_sdk::key_value::Store;
/// A simple Spin HTTP component.
#[http_component]
fn handle_api(req: Request) -> anyhow::Result<impl IntoResponse> {
println!("Handling request to {:?}", req.header("spin-full-url"));
let store = Store::open_default()?;
let exists = store.exists("foo")?;
if !exists {
return Ok(Response::new(404, ()));
}
let Some(value) = store.get("foo")? else {
return Ok(Response::new(204, ()));
};
store.set("bar", b"baz")?;
Ok(Response::builder()
.status(200)
.header("content-type", "text/plain")
.body(value)
.build())
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Rust SDK implementation of spin_sdk::key_value::Store::set and compare its tracing behavior with the exists and get operations described in the report. Reproduce the HTTP component example with OpenTelemetry enabled, then identify the relevant tracing test or add coverage showing that set's span belongs to the request trace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100