Is there any existing relations between events? (spans belonging to traces)

Your question

Hello!
I am trying to take advantage of exported spans from my Stalwart server, but it turns out Tempo and Grafana are returning only independent spans, without relations between them.

So I am wondering if this feature exists, is available in the community edition (the comparison table says yes for telemetry) or if I am doing something wrong?

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Let me check the OpenTelemetry doc page and server source for span linkage.

Right now Stalwart’s OpenTelemetry span exporter does not link spans together in a parent‑child hierarchy: each span is emitted with its own span ID used as the trace ID and the parent_span_id field is always set to 0 (no parent). That’s why Tempo/Grafana show them as independent, disconnected spans rather than a connected trace tree with sub-spans — there’s currently no code path in the exporter (crates/common/src/telemetry/tracers/otel.rs) that threads a parent span/trace ID from a request’s parent event into its children.

This is not something you’re misconfiguring; the span exporter simply doesn’t currently propagate trace/parent relationships between related events, in either the community or enterprise builds. You’re limited to correlating spans manually (e.g., via shared attributes like connection ID) rather than through the OTel parent/trace linkage.

Reference: OpenTelemetry | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

You are not doing anything wrong and it is not an edition limitation. Our OpenTelemetry exporter emits every span as its own root trace: the trace id is derived from the span’s own id and the parent span id is always zero, so there is nothing for Tempo to build a hierarchy from. Span links are empty as well, so there is no cross-referencing either.

The model behind that is one span per session, an SMTP, IMAP or HTTP session, with the individual events of that session attached as span events inside it. So the detail you are after is there, it is just flat rather than nested.