Class SpanProcessor
Defined in File processor.h
Inheritance Relationships
Derived Types
public opentelemetry::sdk::trace::BatchSpanProcessor
(Class BatchSpanProcessor)public opentelemetry::sdk::trace::MultiSpanProcessor
(Class MultiSpanProcessor)public opentelemetry::sdk::trace::SimpleSpanProcessor
(Class SimpleSpanProcessor)
Class Documentation
-
class SpanProcessor
Span processor allow hooks for span start and end method invocations.
Built-in span processors are responsible for batching and conversion of spans to exportable representation and passing batches to exporters.
Subclassed by opentelemetry::sdk::trace::BatchSpanProcessor, opentelemetry::sdk::trace::MultiSpanProcessor, opentelemetry::sdk::trace::SimpleSpanProcessor
Public Functions
-
virtual ~SpanProcessor() = default
-
virtual std::unique_ptr<Recordable> MakeRecordable() noexcept = 0
Create a span recordable. This requests a new span recordable from the associated exporter.
Note: This method must be callable from multiple threads.
- Returns:
a newly initialized recordable
-
virtual void OnStart(Recordable &span, const opentelemetry::trace::SpanContext &parent_context) noexcept = 0
OnStart is called when a span is started.
- Parameters:
span – a recordable for a span that was just started
parent_context – The parent context of the span that just started
-
virtual void OnEnd(std::unique_ptr<Recordable> &&span) noexcept = 0
OnEnd is called when a span is ended.
- Parameters:
span – a recordable for a span that was ended
-
virtual bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0
Export all ended spans that have not yet been exported.
- Parameters:
timeout – an optional timeout, the default timeout of 0 means that no timeout is applied.
-
virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0
Shut down the processor and do any cleanup required. Ended spans are exported before shutdown. After the call to Shutdown, subsequent calls to OnStart, OnEnd, ForceFlush or Shutdown will return immediately without doing anything.
- Parameters:
timeout – an optional timeout, the default timeout of 0 means that no timeout is applied.
-
virtual ~SpanProcessor() = default