Launch Week 02 wrapped — explore all five launches

Dropping Traces

Conditionally dropping traces before they are sent 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

Dropping lets you silently discard a trace based on runtime conditions. Unlike sampling, which randomly drops a percentage of traces, this gives you full programmatic control over which traces are sent.

Drop a Trace

To drop the current trace, call update_current_trace (Python) or updateCurrentTrace (TypeScript) with drop set to True/true. The trace will be silently discarded and never sent to the observatory.

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

client = OpenAI()

@observe()
def llm_app(query: str):
    if "health" in query.lower():
        update_current_trace(drop=True)
        return "OK"

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

llm_app("/health")          # this trace is dropped
llm_app("Write me a poem.") # this trace is 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