TraceConfig
TheTraceConfig 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:- Values set in the TraceConfig object in code (highest priority)
- Environment variables
- Default values (lowest priority)
Python
Import
Usage
Create aTraceConfig 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 aTraceConfig 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
- See Environment Variables for alternative configuration methods
- See Privacy Controls for comprehensive privacy scenarios