ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
trace_id_generator Class Referencefinal

Generator for 128-bit trace IDs with embedded metadata. More...

#include <trace_id_generator.hpp>

Collaboration diagram for trace_id_generator:
Collaboration graph

Public Member Functions

 trace_id_generator ()
 Constructs the generator with locally derived machine ID.
 
 trace_id_generator (std::uint16_t machine_id)
 Constructs the generator with an explicit machine ID.
 
domain::trace_id operator() ()
 Generates a new trace_id.
 
std::uint16_t machine_id () const
 Gets the machine ID being used by this generator.
 

Detailed Description

Generator for 128-bit trace IDs with embedded metadata.

The generated trace_id has the following structure:

This structure provides:

Constructor & Destructor Documentation

◆ trace_id_generator() [1/2]

Constructs the generator with locally derived machine ID.

The machine ID is derived from system properties (hostname, MAC address) and remains constant for the lifetime of the process.

◆ trace_id_generator() [2/2]

trace_id_generator ( std::uint16_t  machine_id)
explicit

Constructs the generator with an explicit machine ID.

Parameters
machine_idThe 16-bit machine identifier.

Member Function Documentation

◆ operator()()

domain::trace_id operator() ( )

Generates a new trace_id.

Thread-safe: Multiple threads can call this concurrently.

Returns
A unique trace_id with embedded timestamp and machine ID.