ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
trace_id Struct Referencefinal

A 128-bit trace identifier, compatible with OpenTelemetry. More...

#include <trace_id.hpp>

Collaboration diagram for trace_id:
Collaboration graph

Public Member Functions

bool is_valid () const
 Checks if the trace_id is valid (not all zeros).
 
std::string to_hex () const
 Converts the trace_id to a 32-character lowercase hex string.
 
auto operator<=> (const trace_id &) const =default
 Default comparison operator.
 

Static Public Member Functions

static trace_id from_hex (std::string_view hex)
 Creates a trace_id from a 32-character hex string.
 

Public Attributes

std::array< std::byte, 16 > bytes {}
 The raw 128-bit identifier.
 

Detailed Description

A 128-bit trace identifier, compatible with OpenTelemetry.

The trace_id uniquely identifies a distributed trace. All spans belonging to the same trace share the same trace_id. The 128-bit size matches the OpenTelemetry and W3C Trace Context specifications.

The internal structure embeds metadata for efficient local generation:

Member Function Documentation

◆ from_hex()

trace_id from_hex ( std::string_view  hex)
static

Creates a trace_id from a 32-character hex string.

Parameters
hexThe hex string representation.
Returns
The parsed trace_id, or an invalid trace_id if parsing fails.
Here is the caller graph for this function: