Skip to main content

Set a sampling rate for traces


This section is relevant for those using the LangSmith SDK or LangChain, not for those logging directly with the LangSmith API.

By default, all traces are logged to LangSmith. To down-sample the number of traces logged to LangSmith, set the LANGCHAIN_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.


This works for the traceable decorator and RunTree objects.

Was this page helpful?

You can leave detailed feedback on GitHub.