Class SpanData
Defined in File span_data.h
Inheritance Relationships
Base Type
public opentelemetry::sdk::trace::Recordable
(Class Recordable)
Class Documentation
-
class SpanData : public opentelemetry::sdk::trace::Recordable
SpanData is a representation of all data collected by a span.
Public Functions
-
inline SpanData()
-
inline opentelemetry::trace::TraceId GetTraceId() const noexcept
Get the trace id for this span
- Returns:
the trace id for this span
-
inline opentelemetry::trace::SpanId GetSpanId() const noexcept
Get the span id for this span
- Returns:
the span id for this span
-
inline const opentelemetry::trace::SpanContext &GetSpanContext() const noexcept
Get the span context for this span
- Returns:
the span context for this span
-
inline opentelemetry::trace::SpanId GetParentSpanId() const noexcept
Get the parent span id for this span
- Returns:
the span id for this span’s parent
-
inline opentelemetry::nostd::string_view GetName() const noexcept
Get the name for this span
- Returns:
the name for this span
-
inline opentelemetry::trace::TraceFlags GetFlags() const noexcept
Get the trace flags for this span
- Returns:
the trace flags for this span
-
inline opentelemetry::trace::SpanKind GetSpanKind() const noexcept
Get the kind of this span
- Returns:
the kind of this span
-
inline opentelemetry::trace::StatusCode GetStatus() const noexcept
Get the status for this span
- Returns:
the status for this span
-
inline opentelemetry::nostd::string_view GetDescription() const noexcept
Get the status description for this span
- Returns:
the description of the the status of this span
-
inline const opentelemetry::sdk::resource::Resource &GetResource() const noexcept
Get the attributes associated with the resource
- Returns:
the attributes associated with the resource configured for TracerProvider
-
inline const opentelemetry::sdk::trace::InstrumentationScope &GetInstrumentationScope() const noexcept
Get the attributes associated with the resource
- Returns:
the attributes associated with the resource configured for TracerProvider
-
inline const opentelemetry::sdk::trace::InstrumentationScope &GetInstrumentationLibrary() const noexcept
-
inline opentelemetry::common::SystemTimestamp GetStartTime() const noexcept
Get the start time for this span
- Returns:
the start time for this span
-
inline std::chrono::nanoseconds GetDuration() const noexcept
Get the duration for this span
- Returns:
the duration for this span
-
inline const std::unordered_map<std::string, opentelemetry::sdk::common::OwnedAttributeValue> &GetAttributes() const noexcept
Get the attributes for this span
- Returns:
the attributes for this span
-
inline const std::vector<SpanDataEvent> &GetEvents() const noexcept
Get the events associated with this span
- Returns:
the events associated with this span
-
inline const std::vector<SpanDataLink> &GetLinks() const noexcept
Get the links associated with this span
- Returns:
the links associated with this span
-
inline virtual void SetIdentity(const opentelemetry::trace::SpanContext &span_context, opentelemetry::trace::SpanId parent_span_id) noexcept override
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
-
inline virtual void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept override
Set an attribute of a span.
- Parameters:
name – the name of the attribute
value – the attribute value
-
inline virtual void AddEvent(nostd::string_view name, opentelemetry::common::SystemTimestamp timestamp = opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now()), const opentelemetry::common::KeyValueIterable &attributes = opentelemetry::common::KeyValueIterableView<std::map<std::string, int>>({})) noexcept override
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 virtual void AddLink(const opentelemetry::trace::SpanContext &span_context, const opentelemetry::common::KeyValueIterable &attributes) noexcept override
Add a link to a span.
- Parameters:
span_context – the span context of the linked span
attributes – the attributes associated with the link
-
inline virtual void SetStatus(opentelemetry::trace::StatusCode code, nostd::string_view description) noexcept override
Set the status of the span.
- Parameters:
code – the status code
description – a description of the status
-
inline virtual void SetName(nostd::string_view name) noexcept override
Set the name of the span.
- Parameters:
name – the name to set
-
inline virtual void SetTraceFlags(opentelemetry::trace::TraceFlags flags) noexcept override
Set the trace flags of the span.
- Parameters:
flags – the flags to set
-
inline virtual void SetSpanKind(opentelemetry::trace::SpanKind span_kind) noexcept override
Set the spankind of the span.
- Parameters:
span_kind – the spankind to set
-
inline virtual void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override
Set Resource of the span
- Parameters:
Resource – the resource to set
-
inline virtual void SetStartTime(opentelemetry::common::SystemTimestamp start_time) noexcept override
Set the start time of the span.
- Parameters:
start_time – the start time to set
-
inline virtual void SetDuration(std::chrono::nanoseconds duration) noexcept override
Set the duration of the span.
- Parameters:
duration – the duration to set
-
inline virtual void SetInstrumentationScope(const InstrumentationScope &instrumentation_scope) noexcept override
Set the instrumentation scope of the span.
- Parameters:
instrumentation_scope – the instrumentation scope to set
-
inline SpanData()