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
| Parameter | Type | Default | Description |
|---|---|---|---|
hide_llm_invocation_parameters | bool | False | Hides LLM invocation parameters |
hide_inputs | bool | False | Hides input.value and all input messages |
hide_outputs | bool | False | Hides output.value and all output messages |
hide_input_messages | bool | False | Hides all input messages (independent of HIDE_INPUTS) |
hide_output_messages | bool | False | Hides all output messages (independent of HIDE_OUTPUTS) |
hide_input_images | bool | False | Hides images from input messages |
hide_input_text | bool | False | Hides text from input messages |
hide_output_text | bool | False | Hides text from output messages |
hide_embedding_vectors | bool | False | Deprecated: Use hide_embeddings_vectors instead |
hide_embeddings_vectors | bool | False | Replaces embedding vectors with "__REDACTED__" |
hide_embeddings_text | bool | False | Replaces embedding text with "__REDACTED__" |
hide_prompts | bool | False | Hides LLM prompts (completions API) |
hide_choices | bool | False | Hides LLM choices (completions API outputs) |
base64_image_max_length | int | 32000 | Limits characters of a base64 encoding of an image |
Example: Hiding Sensitive Data
JavaScript
Import
Usage
Create a trace config object and pass it to your instrumentation constructor:Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
hideInputs | boolean | false | Hides input.value and all input messages |
hideOutputs | boolean | false | Hides output.value and all output messages |
hideInputMessages | boolean | false | Hides all input messages |
hideOutputMessages | boolean | false | Hides all output messages |
hideInputImages | boolean | false | Hides images from input messages |
hideInputText | boolean | false | Hides text from input messages |
hideOutputText | boolean | false | Hides text from output messages |
hideEmbeddingVectors | boolean | false | Replaces embedding vectors with "__REDACTED__" |
hidePrompts | boolean | false | Hides LLM prompts |
base64ImageMaxLength | number | 32000 | Limits characters of a base64 encoding of an image |
Example: Partial Configuration
Java
Import
Usage
Use the builder pattern to create aTraceConfig instance:
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
hideInputs | boolean | false | Hides input values |
hideOutputs | boolean | false | Hides output values |
hideInputMessages | boolean | false | Hides all input messages |
hideOutputMessages | boolean | false | Hides all output messages |
hideInputImages | boolean | false | Hides images from input messages |
hideOutputImages | boolean | false | Hides images from output messages |
hideInputText | boolean | false | Hides text from input messages |
hideOutputText | boolean | false | Hides text from output messages |
hideInputAudio | boolean | false | Hides audio from input messages |
hideOutputAudio | boolean | false | Hides audio from output messages |
hideInputEmbeddings | boolean | false | Hides input embeddings |
hideOutputEmbeddings | boolean | false | Hides output embeddings |
hidePromptTemplate | boolean | false | Hides prompt templates |
hidePromptTemplateVariables | boolean | false | Hides prompt template variables |
hidePromptTemplateVersion | boolean | false | Hides prompt template version |
hideToolParameters | boolean | false | Hides tool parameters |
base64ImageMaxLength | String | "unlimited" | Limits characters of a base64 encoding of an image |
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