Class SimpleSpanProcessor

Inheritance Relationships

Base Type

Class Documentation

class SimpleSpanProcessor : public opentelemetry::sdk::trace::SpanProcessor

The simple span processor passes finished recordables to the configured SpanExporter, as soon as they are finished.

OnEnd and ForceFlush are no-ops.

All calls to the configured SpanExporter are synchronized using a spin-lock on an atomic_flag.

Public Functions

inline explicit SimpleSpanProcessor(std::unique_ptr<SpanExporter> &&exporter) noexcept

Initialize a simple span processor.

Parameters:

exporter – the exporter used by the span processor

inline virtual std::unique_ptr<Recordable> MakeRecordable() noexcept override

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

inline virtual void OnStart(Recordable&, const opentelemetry::trace::SpanContext&) noexcept override

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

inline virtual void OnEnd(std::unique_ptr<Recordable> &&span) noexcept override

OnEnd is called when a span is ended.

Parameters:

span – a recordable for a span that was ended

inline virtual bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override

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.

inline virtual bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override

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.

inline ~SimpleSpanProcessor() override