Skip to content

Allow SpanExporter to write partially completed spans during shutdown #2692

Description

@jonathanjyi

What are you trying to achieve?
Instantaneous exporting of Spans/Traces as they occur, such as when a new Event is added to a Span.

What did you expect to see?
Exporters outputting Spans/Traces as they seem fit. Not dictated by when the Span or Trace has "ended".

Additional context.
I'd like to capture Crashes up to the last moment possible. Currently if a Desktop Application crashes with hundreds of Spans with Events in flight, all that data is lost. By having the Exporter control when to output the Events/Spans/Traces to a persistant file location, then we could capture the events that led to the crash. However, since the Export Handler is only called when a Span is Ended(), this is currently not possible.

An alternative approach is to have a global exception handler to unravel each Span and close them, but that's not possible for all Applications.

I know I could write my own Processor and Exporter to have a cache of Spans in flight at startup, but is there a better way to handle this that I'm not aware of?

Metadata

Metadata

Assignees

Labels

[label deprecated] triaged-accepted[label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PRenhancementNew feature or requestspec:traceRelated to the specification/trace directory

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions