Tracing & Telemetry
The tracing module provides utilities for registering and managing OpenTelemetry-compatible tracing for your projects, including project registration, span attributes, and tracer provider configuration.register Function
Registers a new tracing provider for your project and configures telemetry for experiment or observe runs.
project_name(Optional[str]): Name of the project. If not provided, will be read from environment variables.project_type(Optional[ProjectType]): Type of the project (EXPERIMENTorOBSERVE). Default:EXPERIMENT.project_version_name(Optional[str]): Version name for the project.eval_tags(Optional[List[EvalTag]]): List of evaluation tags.metadata(Optional[Dict[str, Any]]): Additional metadata for the project.batch(bool): Whether to use batch span processing. Default:False.set_global_tracer_provider(bool): IfTrue, sets this provider as the global OpenTelemetry tracer provider.headers(Optional[Dict[str, str]]): Additional headers for the exporter.verbose(bool): IfTrue, prints configuration details.
_TracerProvider: The configured tracer provider.
ValidationError: If arguments are invalid or duplicate custom eval names are provided.
TracerProvider Class
An extension of opentelemetry.sdk.trace.TracerProvider with Future AGI aware defaults.
endpoint(str, optional): The collector endpoint to which spans will be exported.verbose(bool): IfTrue, configuration details will be printed to stdout.
add_span_processor(...): Registers a newSpanProcessorfor thisTracerProvider.
Span and Message Attribute Constants
The following classes provide constants for span and message attributes used in tracing:SpanAttributesMessageAttributesMessageContentAttributesImageAttributesAudioAttributesDocumentAttributesRerankerAttributesEmbeddingAttributesToolCallAttributesToolAttributes
Enum Types
The tracing module also provides several enums for project and span types:ProjectType:EXPERIMENT,OBSERVEEvalTagTypeEvalSpanKindEvalNameEndpointsFiSpanKindValuesFiMimeTypeValuesFiLLMSystemValuesFiLLMProviderValues