Class Recordable

Inheritance Relationships

Derived Types

Class Documentation

class Recordable

Maintains a representation of a span in a format that can be processed by a recorder.

This class is thread-compatible.

Subclassed by opentelemetry::sdk::trace::MultiRecordable, opentelemetry::sdk::trace::SpanData

Public Functions

virtual ~Recordable() = default
virtual void SetIdentity(const opentelemetry::trace::SpanContext &span_context, opentelemetry::trace::SpanId parent_span_id) noexcept = 0

Set the span context and parent span id

Parameters
  • span_context – the span context to set

  • parent_span_id – the parent span id to set

virtual void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept = 0

Set an attribute of a span.

Parameters
  • name – the name of the attribute

  • value – the attribute value

virtual void AddEvent(nostd::string_view name, opentelemetry::common::SystemTimestamp timestamp, const opentelemetry::common::KeyValueIterable &attributes) noexcept = 0

Add an event to a span.

Parameters
  • name – the name of the event

  • timestamp – the timestamp of the event

  • attributes – the attributes associated with the event

inline void AddEvent(nostd::string_view name)

Add an event to a span with default timestamp and attributes.

Parameters

name – the name of the event

inline void AddEvent(nostd::string_view name, opentelemetry::common::SystemTimestamp timestamp)

Add an event to a span with default (empty) attributes.

Parameters
  • name – the name of the event

  • timestamp – the timestamp of the event

virtual void AddLink(const opentelemetry::trace::SpanContext &span_context, const opentelemetry::common::KeyValueIterable &attributes) noexcept = 0

Add a link to a span.

Parameters
  • span_context – the span context of the linked span

  • attributes – the attributes associated with the link

inline void AddLink(opentelemetry::trace::SpanContext span_context)

Add a link to a span with default (empty) attributes.

Parameters

span_context – the span context of the linked span

virtual void SetStatus(opentelemetry::trace::StatusCode code, nostd::string_view description) noexcept = 0

Set the status of the span.

Parameters
  • code – the status code

  • description – a description of the status

virtual void SetName(nostd::string_view name) noexcept = 0

Set the name of the span.

Parameters

name – the name to set

virtual void SetSpanKind(opentelemetry::trace::SpanKind span_kind) noexcept = 0

Set the spankind of the span.

Parameters

span_kind – the spankind to set

virtual void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept = 0

Set Resource of the span

Parameters

Resource – the resource to set

virtual void SetStartTime(opentelemetry::common::SystemTimestamp start_time) noexcept = 0

Set the start time of the span.

Parameters

start_time – the start time to set

virtual void SetDuration(std::chrono::nanoseconds duration) noexcept = 0

Set the duration of the span.

Parameters

duration – the duration to set

inline virtual explicit operator SpanData*() const

Get the SpanData object for this Recordable.

Returns

SpanData*

virtual void SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) noexcept = 0

Set the instrumentation scope of the span.

Parameters

instrumentation_scope – the instrumentation scope to set

inline void SetInstrumentationLibrary(const InstrumentationScope &instrumentation_scope) noexcept