20#ifndef ORES_TELEMETRY_DOMAIN_SPAN_HPP
21#define ORES_TELEMETRY_DOMAIN_SPAN_HPP
27#include "ores.telemetry/domain/span_context.hpp"
28#include "ores.telemetry/domain/span_kind.hpp"
29#include "ores.telemetry/domain/span_status.hpp"
30#include "ores.telemetry/domain/span_link.hpp"
31#include "ores.telemetry/domain/attribute_value.hpp"
81 std::optional<std::chrono::system_clock::time_point>
end_time;
113 std::optional<std::chrono::nanoseconds>
duration()
const;
Domain types for telemetry and observability.
Definition attribute_value.hpp:29
std::map< std::string, attribute_value > attributes
A collection of attributes as key-value pairs.
Definition attribute_value.hpp:52
span_status_code
The status code of a span, following OpenTelemetry conventions.
Definition span_status.hpp:32
@ unset
The default status. The operation completed without any known errors.
span_kind
The type of span, following OpenTelemetry conventions.
Definition span_kind.hpp:34
@ internal
Default value. Indicates an internal operation within an application, not representing a remote call.
Represents a single operation within a trace.
Definition span.hpp:45
std::optional< std::chrono::system_clock::time_point > end_time
When the span ended. Empty if the span is still in progress.
Definition span.hpp:81
span_kind kind
The kind of span (internal, server, client, producer, consumer).
Definition span.hpp:71
attributes attrs
Key-value pairs providing additional context about the operation.
Definition span.hpp:98
bool is_root() const
Checks if this is a root span (no parent).
Definition span.cpp:28
bool is_session() const
Checks if this span represents a session (has session.id attribute).
Definition span.cpp:24
std::string status_message
A message describing the status, typically set when status is error.
Definition span.hpp:91
std::string name
A human-readable name describing the operation.
Definition span.hpp:66
std::optional< span_id > parent_span_id
The parent span's ID, if this is not a root span.
Definition span.hpp:54
std::vector< span_link > links
Links to other spans forming hypergraph relationships.
Definition span.hpp:59
std::chrono::system_clock::time_point start_time
When the span started.
Definition span.hpp:76
span_status_code status_code
The status code of the operation.
Definition span.hpp:86
span_context context
The span's identity (trace_id + span_id + flags).
Definition span.hpp:49
std::optional< std::chrono::nanoseconds > duration() const
Calculates the duration of the span if it has ended.
Definition span.cpp:32
Immutable context for trace propagation across boundaries.
Definition span_context.hpp:37