Automatic instrumentation
Automatic code instrumentation and best practices for tracing with Laminar
By default, Laminar.initialize()
will automatically instrument majority of common LLM and VectorDB libraries for tracing.
This includes OpenAI, Anthropic, Langchain, Pinecone, and many more.
Instrument all available libraries
See all available auto-instrumentable modules here.
Disable automatic instrumentation
initialize()
accepts an optional instruments
parameter.
If you explicitly pass an empty set, no automatic instrumentations will be applied.
Instrument specific modules only
You can also enable instrumentation for specific modules only.
This is useful if you either want more control over what is being instrumented. Also, use this if you are using Next.js and having issues with automatic instrumentation – learn more.
Let’s say, for example, we call OpenAI and Anthropic models to perform the same task, and we only want to instrument the Anthropic calls, but not OpenAI.
initialize()
accepts
an optional instruments
parameter. Pass a set of instruments you want to enable.
In this case we only want to pass Instruments.ANTHROPIC
.
See available instruments in the next subsection.
Available instruments
See available instruments by importing Instruments
from lmnr
or view source.
All modules from this list are auto-instrumented, if you do not pass instruments
to Laminar.initialize()
.