When working with high-volume applications, you may not want to log every trace to LangSmith. Sampling rates allow you to control what percentage of traces are logged, helping you balance observability needs with cost considerations.Documentation Index
Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-lschan-1765567880-b1c8e16.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Set a global sampling rate
This section is relevant for those using the LangSmith SDK or LangChain, not for those logging directly with the LangSmith API.
LANGSMITH_TRACING_SAMPLING_RATE environment variable to any float between 0 (no traces) and 1 (all traces). For instance, setting the following environment variable will log 75% of the traces.
traceable decorator and RunTree objects.
Set different sampling rates per client
You can also set sampling rates on specificClient instances and use the tracing_context context manager: