class documentation

OpenTelemetry ID generator that uses Temporal's deterministic random generator.

Warning

This class is experimental and may change in future versions. Use with caution in production environments.

This generator uses Temporal's workflow-safe random number generator when inside a workflow execution, ensuring deterministic span and trace IDs across workflow replays. Falls back to standard random generation outside of workflows.

Can be seeded with OpenTelemetry span IDs from client context to maintain proper span parenting across the client-workflow boundary.

Method __init__ Initialize a TemporalIdGenerator.
Method generate_span_id Generate a span ID using Temporal's deterministic random when in workflow.
Method generate_trace_id Generate a trace ID using Temporal's deterministic random when in workflow.
Method seed_span_id Seed the generator with a span ID to use as the first result.
Method seed_trace_id Seed the generator with a trace ID to use as the first result.
Instance Variable spans Undocumented
Instance Variable traces Undocumented
Instance Variable _id_generator Undocumented
def __init__(self, id_generator: IdGenerator): (source)

Initialize a TemporalIdGenerator.

def generate_span_id(self) -> int: (source)

Generate a span ID using Temporal's deterministic random when in workflow.

Returns
intA 64-bit span ID.
def generate_trace_id(self) -> int: (source)

Generate a trace ID using Temporal's deterministic random when in workflow.

Returns
intA 128-bit trace ID.
def seed_span_id(self, span_id: int): (source)

Seed the generator with a span ID to use as the first result.

This is typically used to maintain OpenTelemetry span parenting when crossing the client-workflow boundary.

Parameters
span_id:intThe span ID to use as the first generated span ID.
def seed_trace_id(self, trace_id: int): (source)

Seed the generator with a trace ID to use as the first result.

Parameters
trace_id:intThe trace ID to use as the first generated trace ID.

Undocumented

Undocumented

_id_generator = (source)

Undocumented