Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Updates documentation for opentelemetry instrument all
elijahbenizzy7ce0348f77e2
diff --git a/burr/integrations/opentelemetry.py b/burr/integrations/opentelemetry.pyindex 98eb5837..d718b378 100644--- a/burr/integrations/opentelemetry.py+++ b/burr/integrations/opentelemetry.py@@ -134,11 +134,30 @@ class OpenTelemetryBridge(DoLogAttributeHook,):"""Adapter to log Burr events to OpenTelemetry. At a high level, this works as follows:+1. On any of the start/pre hooks (pre_run_execute_call, pre_run_step, pre_start_span), we start a new span2. On any of the post ones we exit the span, accounting for the error (setting it if needed)3. On do_log_attributes, we log the attributes to the current span -- these are serialized using the serde moduleThis 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:++ .. code-block:: python++ # 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"""def __init__(self, tracer_name: str = None, tracer: trace.Tracer = None):@@ -640,7 +659,11 @@ def _init_instrument(def init_instruments(*instruments: INSTRUMENTS, init_all: bool = False) -> None:- """Instruments the specified libraries+ """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_SPECS`` field for the list of+ available libraries.:param instruments: Name of libraries to instrument (e.g., `requests`, `openai`):param init_all: If True, initialize all available instruments for imported packages.diff --git a/docs/concepts/additional-visibility.rst b/docs/concepts/additional-visibility.rstindex 793d09c7..b2620f92 100644--- a/docs/concepts/additional-visibility.rst+++ b/docs/concepts/additional-visibility.rst@@ -5,7 +5,7 @@ Additional Visibility.. note::Burr comes with the ability to see inside your actions. This is a very pluggable framework- that comes with the default tracking client, but can also be hooked up to tools such as `OpenTelemetry <https://opentelemetry.io/>`_(OTel)+ that comes with the default tracking client, but can also be hooked up to tools such as `OpenTelemetry <https://opentelemetry.io/>`_ (OTel)----------Quickstartdiff --git a/docs/reference/integrations/opentelemetry.rst b/docs/reference/integrations/opentelemetry.rstindex b190ee15..280cedf0 100644--- a/docs/reference/integrations/opentelemetry.rst+++ b/docs/reference/integrations/opentelemetry.rst@@ -1,9 +1,12 @@+.. _opentelintegrationref:+--------------OpenTelemetry---------------.. _opentelintegrationref:Burr has two integrations with OpenTelemetry:++1. Burr can log traces to OpenTelemetry2. Burr can capture any traces logged within an action and log them to OpenTelemetry@@ -13,3 +16,10 @@ See the following resources for more information:- `Example in the repository <https://github.com/dagworks-inc/burr/tree/main/examples/opentelemetry>`_- `Blog post <https://blog.dagworks.io/p/9ef2488a-ff8a-4feb-b37f-1d9a781068ac/>`_- `OpenTelemetry <https://opentelemetry.io/>`_++Reference for the various useful methods:++.. autoclass:: burr.integrations.opentelemetry.OpenTelemetryBridge+ :members:++.. autofunction:: burr.integrations.opentelemetry.init_instruments