Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_otel_utils.py32 linesDownload Raw Back to _internal
1from __future__ import annotations2 3from uuid import UUID4 5 6def get_otel_trace_id_from_uuid(uuid_val: UUID) -> int:7    """Get OpenTelemetry trace ID as integer from UUID.8 9    Args:10        uuid_val: The UUID to convert.11 12    Returns:13        Integer representation of the trace ID.14    """15    trace_id_hex = uuid_val.hex16    return int(trace_id_hex, 16)17 18 19def get_otel_span_id_from_uuid(uuid_val: UUID) -> int:20    """Get OpenTelemetry span ID as integer from UUID.21 22    Args:23        uuid_val: The UUID to convert.24 25    Returns:26        Integer representation of the span ID.27    """28    uuid_bytes = uuid_val.bytes29    span_id_bytes = uuid_bytes[:8]30    span_id_hex = span_id_bytes.hex()31    return int(span_id_hex, 16)32 
codekingpro/portable-devtools · Team Ai