Files
zenml/venv/lib/python3.9/site-packages/mlflow/tracing/utils/token.py
Christian Mantha 2ca0b9ef7c star
2026-03-02 19:10:52 -05:00

20 lines
546 B
Python

import contextvars
from dataclasses import dataclass
from typing import Optional
from mlflow.entities import LiveSpan
@dataclass
class SpanWithToken:
"""
A utility container to hold an MLflow span and its corresponding OpenTelemetry token.
The token is a special object that is generated when setting a span as active within
the Open Telemetry span context. This token is required when inactivate the span i.e.
detaching the span from the context.
"""
span: LiveSpan
token: Optional[contextvars.Token] = None