Description
Currently, exporters in OTel only get access to spans that are already finished in order to send them to the backend.
This proposal adds an option to also allow exporting spans that are currently processing, i.e., already started but not yet ended. They might also be referred to as open, unfinished, running or "in-flight" spans. (I'd like to avoid the term active here since this has a different semantic in OTel.)
This allows the backend to display long-running spans and provide details about them in realtime. It further allows for debugging the instrumentation code since it will reveal spans that are started but not being ended.
The backend can also use this information for performance improvements because it receives information about spans ahead of time. This, for example, allows the backend to make decisions about keeping other, dependent parent or child spans in memory if there are currently processing spans expected to arrive later on or otherwise persist them on disk.
OpenCensus had a functionality like this used in their zPages feature:
- https://opencensus.io/zpages/java/#tracez
- https://github.com/census-instrumentation/opencensus-java/blob/master/api/src/main/java/io/opencensus/trace/export/RunningSpanStore.java
https://github.com/census-instrumentation/opencensus-java/blob/master/impl_core/src/main/java/io/opencensus/implcore/trace/export/InProcessRunningSpanStore.java - https://github.com/census-instrumentation/opencensus-go/blob/master/trace/spanstore.go#L43
This would have the following implications on the implementation:
A SpanProcessor implementing this feature would take Spans provided via the span start hook and provide those to the exporter. The current default processors only use the end span hook on which they hand the span over to the export right away (simple span processor) or batch it first (batching span processor).
The information on whether a span is processing or finished could, for example, be indicated by:
- A) adding a field ProcessingStatus (or LifecycleStatus?) to the Span object which can have the values processing and finished, or
- B) without any adaption by simply checking if the (mandatory) span end time is set - if it is not, the span is not yet finished, or
- C) extending the SpanExporter interface by a method in addition to the existing
export
method, something likeexportProcessing
.
I would prefer option C since this provides the clearest distinction and spare the need for filtering all provided spans in exporters that don't want to handle processing spans - they could just make exportProcessing
a no-op.
What's your opinion on a feature like that? I'd like to gather some feedback before I create an OTEP for it.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status