Launch Week 02 wrapped — explore all five launches

Trace Sampling

Sending only part of your traces to Confident AI

Included on the Enterprise plan. Book a demo, opens in a new tab. Included on the Team plan. Included on the Starter plan. Not included on the Free plan.

Overview

Sampling allows you to control what percentage of traces are sent to Confident's observatory.

Configure Sample Rate

Configure the sampling rate by setting the CONFIDENT_SAMPLE_RATE environment variable, which represents the proportion of traces that will be sent to the observatory.

export CONFIDENT_SAMPLE_RATE=0.5

Alternatively, you can set the sampling rate directly in code:

main.py
from deepeval.tracing import observe, trace_manager
from openai import OpenAI

client = OpenAI()
trace_manager.configure(sampling_rate=0.5)

@observe()
def llm_app(query: str):
    return client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": query}]
    ).choices[0].message.content

for _ in range(10):
    llm_app("Write me a poem.")  # roughly half of these traces will be sent
Ready to monitor AI in production?Connect traces, alerts, dashboards, and evals in one production workflowBook a demo

Last updated on

Built byConfident AI