OpenTelemetryΒΆ
Burr has two integrations with OpenTelemetry:
- Burr can log traces to OpenTelemetry 
- Burr can capture any traces logged within an action and log them to OpenTelemetry 
See the following resources for more information:
Reference for the various useful methods:
- class burr.integrations.opentelemetry.OpenTelemetryBridge(tracer_name: str = None, tracer: Tracer = None)ΒΆ
- Adapter to log Burr events to OpenTelemetry. At a high level, this works as follows: - On any of the start/pre hooks (pre_run_execute_call, pre_run_step, pre_start_span), we start a new span 
- On any of the post ones we exit the span, accounting for the error (setting it if needed) 
- On do_log_attributes, we log the attributes to the current span β these are serialized using the serde module 
 - This works by logging to OpenTelemetry, and setting the span processor to be the right one (that knows about the tracker). - You can use this as follows: - # replace with instructions from your prefered vendor my_vendor_library_or_tracer_provider.init() app = ( ApplicationBuilder() .with_entrypoint("prompt") .with_state(chat_history=[]) .with_graph(graph) .with_hooks(OpenTelemetryBridge()) .build() ) app.run() # will log to OpenTelemetry - post_run_step(*, exception: Exception, **future_kwargs: Any)ΒΆ
- Run after a step is executed. - Parameters:
- state β State after step execution 
- action β Action that was executed 
- result β Result of the action 
- sequence_id β Sequence ID of the action 
- exception β Exception that was raised 
- future_kwargs β Future keyword arguments 
 
 
 
- burr.integrations.opentelemetry.init_instruments(
- *instruments: Literal['openai', 'anthropic', 'cohere', 'google_generativeai', 'mistral', 'ollama', 'transformers', 'together', 'bedrock', 'replicate', 'vertexai', 'groq', 'watsonx', 'alephalpha', 'pinecone', 'qdrant', 'chroma', 'milvus', 'weaviate', 'lancedb', 'marqo', 'redis', 'langchain', 'llama_index', 'haystack', 'requests', 'httpx', 'urllib', 'urllib3'],
- init_all: bool = False,
- Instruments the specified libraries, or all that are installed if it is enabled. - This will check if any libraries are available in the current environment and initialize if they are. See the - INSTRUMENTS_SPECSfield for the list of available libraries.- Parameters:
- instruments β Name of libraries to instrument (e.g., requests, openai) 
- init_all β If True, initialize all available instruments for imported packages. 
 
- Returns: