opentelemetry.sdk.trace.id_generator
- class opentelemetry.sdk.trace.id_generator.IdGenerator[source]
Bases:
ABC- abstractmethod generate_span_id()[source]
Get a new span ID.
- Return type:
- Returns:
A 64-bit int for use as a span ID
- abstractmethod generate_trace_id()[source]
Get a new trace ID.
Implementations should at least make the 64 least significant bits uniformly random. Samplers like the
TraceIdRatioBasedsampler rely on this randomness to make sampling decisions.See the specification on TraceIdRatioBased.
- Return type:
- Returns:
A 128-bit int for use as a trace ID
- class opentelemetry.sdk.trace.id_generator.RandomIdGenerator[source]
Bases:
IdGeneratorThe default ID generator for TracerProvider which randomly generates all bits when generating IDs.
- generate_span_id()[source]
Get a new span ID.
- Return type:
- Returns:
A 64-bit int for use as a span ID
- generate_trace_id()[source]
Get a new trace ID.
Implementations should at least make the 64 least significant bits uniformly random. Samplers like the
TraceIdRatioBasedsampler rely on this randomness to make sampling decisions.See the specification on TraceIdRatioBased.
- Return type:
- Returns:
A 128-bit int for use as a trace ID