Skip to main content

TraceConfig

The TraceConfig object allows you to configure trace behavior programmatically in your application code. This provides an alternative to setting environment variables and allows for dynamic configuration.

Overview

TraceConfig helps you modify the observability level of your tracing. You can:
  • Keep sensitive information from being logged for security reasons
  • Limit the size of base64 encoded images to reduce payload size
  • Control which parts of your LLM interactions are traced

Precedence Order

Configuration values are resolved in the following order:
  1. Values set in the TraceConfig object in code (highest priority)
  2. Environment variables
  3. Default values (lowest priority)

Python

Import

Usage

Create a TraceConfig instance and pass it to your instrumentor’s instrument() method:

Parameters

Example: Hiding Sensitive Data

JavaScript

Import

Usage

Create a trace config object and pass it to your instrumentation constructor:

Parameters

Example: Partial Configuration

Java

Import

Usage

Use the builder pattern to create a TraceConfig instance:

Parameters

Example: Default Configuration

Redacted Content

When content is hidden due to privacy configuration settings, the value "__REDACTED__" is used as a placeholder across all languages. This constant value allows consumers of the trace data to identify that content was intentionally hidden rather than missing or empty.

Next Steps