For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Trust CenterStatusSupportGet a demoPlatform
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingChangelog
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingChangelog
  • Get Started
    • Introduction
    • Setup and Installation
  • LLM Evaluation
    • Introduction
    • Experiments
  • Metrics
    • Introduction
    • Metric Collections
    • Custom Metrics
  • LLM Tracing
    • Introduction
      • Projects
      • Environment
      • Masking
      • Sampling
      • Dropping Traces
    • Signals
    • Troubleshooting
  • Human-in-the-Loop
    • Introduction
    • Collect Feedback
  • Reporting & Analytics
    • Dashboards
    • Executive Insights
  • Red Teaming
    • Introduction
    • Quickstart
    • Frameworks & Policies
    • Risk Profiles
    • Red Team Using DeepTeam
  • Resources
    • Why Confident AI
    • Support
    • Data Handling
    • LLM Use Cases
LogoLogo
Trust CenterStatusSupportGet a demoPlatform
On this page
  • Overview
  • Configure Sample Rate
LLM TracingTrace Management

Sampling

Sending only part of your traces to Confident AI
Was this page helpful?
Previous

Dropping Traces

Conditionally dropping traces before they are sent to Confident AI
Next
Built with

Overview

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

This is useful for high-volume applications where you may want to reduce the amount of data being sent while still maintaining visibility into your system’s performance.

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:

Python
TypeScript
main.py
1from deepeval.tracing import observe, trace_manager
2from openai import OpenAI
3
4client = OpenAI()
5trace_manager.configure(sampling_rate=0.5)
6
7@observe()
8def llm_app(query: str):
9 return client.chat.completions.create(
10 model="gpt-4o",
11 messages=[{"role": "user", "content": query}]
12 ).choices[0].message.content
13
14for _ in range(10):
15 llm_app("Write me a poem.") # roughly half of these traces will be sent
Traces are sampled at random and the rest are dropped