Observability
Overview
Observability Drivers are used by Observability to send telemetry (metrics and traces) related to the execution of an LLM application. The telemetry can be used to monitor the application and to diagnose and troubleshoot issues. All Observability Drivers implement the following methods:
__enter__()
sets up the Driver.__exit__()
tears down the Driver.observe()
wraps all functions and methods marked with the@observable
decorator. At a bare minimum, implementations call the wrapped function and return its result (a no-op). This enables the Driver to generate telemetry related to the invocation's call arguments, return values, exceptions, latency, etc.
Observability Drivers
Gen AI Builder
Info
This driver requires the drivers-observability-griptape-cloud
extra.
The Gen AI Builder Observability Driver instruments @observable
functions and methods with metrics and traces for use with the Gen AI Builder.
Note
For the Gen AI Builder Observability Driver to function as intended, it must be run from within either a Managed Structure on Gen AI Builder or locally via the Skatepark Emulator.
Here is an example of how to use the GriptapeCloudObservabilityDriver
with the Observability
context manager to send the telemetry to Gen AI Builder:
from griptape.drivers.observability.griptape_cloud import GriptapeCloudObservabilityDriver from griptape.observability import Observability from griptape.rules import Rule from griptape.structures import Agent observability_driver = GriptapeCloudObservabilityDriver() with Observability(observability_driver=observability_driver): agent = Agent(rules=[Rule("Output one word")]) agent.run("Name an animal")
OpenTelemetry
Info
This driver requires the drivers-observability-opentelemetry
extra.
The OpenTelemetry Observability Driver instruments @observable
functions and methods with metrics and traces for use with OpenTelemetry. You must configure a destination for the telemetry by providing a SpanProcessor
to the Driver.
Here is an example of how to use the OpenTelemetryObservabilityDriver
with the Observability
context manager to output the telemetry directly to the console:
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter from griptape.drivers.observability.open_telemetry import OpenTelemetryObservabilityDriver from griptape.observability import Observability from griptape.rules import Rule from griptape.structures import Agent observability_driver = OpenTelemetryObservabilityDriver( service_name="name-an-animal", span_processor=BatchSpanProcessor(ConsoleSpanExporter()) ) with Observability(observability_driver=observability_driver): agent = Agent(rules=[Rule("Output one word")]) agent.run("Name an animal")
- On this page
- Overview
- Observability Drivers
Could this page be better? Report a problem or suggest an addition!