Spans for long running tasks - can we send span events out as they happen? #3732
Replies: 3 comments 3 replies
-
We currently have an experimental event API which sends events as log records. There are several open questions related to the event API, but one of them is how they interact with span events? My opinion is that after we work out some of the other issues with the event API and get it stable, that we should deprecate the span event API and encourage folks to directly use the event API. Users would then be able to configure the SDK on whether events recorded in the context of a span are attached to the span as span events when exported, or exported independently as log events, with trace context fields tying back to the related span. We're working on spinning up an event working group to discuss these questions and more. |
Beta Was this translation helpful? Give feedback.
-
is there any movement on this? |
Beta Was this translation helpful? Give feedback.
-
One idea would be to allow the span start "event" to be emitted independently of the span end "event" (I put event in quotes as I know they're not the same as the span events we can attach to a span discussed above, but potentially could be...). Currently, in the Python OTEL SDK, we use a context manager to wrap a section of code and the span is exported once the context manager exits. However, the two main issues for long-running spans as mentioned are:
If a span start record could be exported immediately, and followed up eventually by the end record, it would allow for streaming based use cases and observing traces progressing in real-time (solving both the problems mentioned above). I'm sure that's a pretty huge change to the spec though, but hope one day it might be possible to achieve. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Spans fall short when modeling long-running events because they can't be sent until the event finishes. Child spans do get sent, but they lack any information (attributes, start time, etc.) from their parent. Nonetheless, this is still useful because at least you get some information. Unfortunately, this is not true for span events: if you add an event to a span it won't get sent until the span completes. This means that span events are in some ways inferior to child spans or just emitting an out-of-band log with correlation.
It would be really interesting if we could greedily send out span events as they occur. Further, if we could have some sort of semantic convention around an event for "a span was started but is still ongoing" then we could also improve the situation where you can get no information on a long-running span until it completes.
Beta Was this translation helpful? Give feedback.
All reactions