Learn how to use any OpenTelemetry-compatible instrumentor with LangWatch.
BaseInstrumentor
interface.
opentelemetry.instrumentation.instrumentor.BaseInstrumentor
. You can find the official documentation for this base class here:
langwatch.setup()
instrumentors
list in the langwatch.setup()
call. LangWatch will then manage its lifecycle (calling its instrument()
and uninstrument()
methods appropriately).
Here’s a conceptual example using the OpenTelemetry LoggingInstrumentor
:
LoggingInstrumentor
(managed by langwatch.setup()
) will automatically create OpenTelemetry spans for any log messages emitted by the standard Python logging
module. LangWatch will then capture these spans.
BaseInstrumentor
interface, you can integrate it with LangWatch using the langwatch.setup(instrumentors=[...])
method described above.
BaseInstrumentor
Compliance: Ensure the instrumentor correctly implements the BaseInstrumentor
interface, particularly the instrument()
and uninstrument()
methods, and instrumentation_dependencies()
.TracerProvider
. The instrumentor, when activated by LangWatch, will use this provider to create spans. If you are managing your OpenTelemetry setup more directly (e.g., providing your own TracerProvider
to langwatch.setup()
), the instrumentor will use that instead.BaseInstrumentor
interface, LangWatch remains flexible and extensible, allowing you to bring telemetry from a wide array of Python libraries into your observability dashboard.