OpenTelemetry Instruments

To use OpenTelemetry instrumentation, install with the opentelemetry extra:

pip install sklearn-instrumentation[opentelemetry]
class sklearn_instrumentation.instruments.opentelemetry.OpenTelemetrySpanner(attributes: Optional[Dict[str, Union[str, bool, int, float]]] = None)[source]

Instrument for OpenTelemetry spans.

Attributes may be passes on instantiation to be applied during instrumentation. Attributes can be supplementally passed on instrumentation using dkwargs under the key attributes. Supplemental attributes will override attributes passed on instantiation.


attributes (Attributes) – A map of attributes to apply to spans for the instrument instance.