There are scenarios where adjusting the observability level of your tracing is necessary. For example, you might want to prevent sensitive data from being logged for security purposes, or you might aim to reduce the payload size by limiting the size of base64 encoded images logged.

The traceAI Specification provides a set of environment variables that you can configure to meet your observability requirements. Additionally, the traceAI auto-instrumentors allow you to specify a trace configuration directly in your code, eliminating the need to set environment variables if you prefer.

The available settings include:

Environment Variable NameDescriptionTypeDefault
FI_HIDE_INPUTSHides input values, all input messages, and embedding input textboolFalse
FI_HIDE_OUTPUTSHides output values and all output messagesboolFalse
FI_HIDE_INPUT_MESSAGESHides all input messages and embedding input textboolFalse
FI_HIDE_OUTPUT_MESSAGESHides all output messagesboolFalse
FI_HIDE_INPUT_IMAGESHides images from input messagesboolFalse
FI_HIDE_INPUT_TEXTHides text from input messages and input embeddingsboolFalse
FI_HIDE_OUTPUT_TEXTHides text from output messagesboolFalse
FI_HIDE_EMBEDDING_VECTORSHides returned embedding vectorsboolFalse
FI_BASE64_IMAGE_MAX_LENGTHHides the character count of a base64 encoded imageint32,000

To configure these settings, you can:

  1. Set the environment variables as outlined above
  2. Define the configuration within your code as demonstrated below
  3. Opt for the default values by taking no action

You can use a combination of these methods, with the following order of precedence:

  1. Values defined in the TraceConfig within your code
  2. Environment variables
  3. Default values

Below is an example of how to configure these settings in code using our OpenAI Python instrumentor. This configuration is applicable to all of our auto-instrumentors.

Python Example

from fi_instrumentation import TraceConfig
config = TraceConfig(        
    hide_inputs=...,
    hide_outputs=...,
    hide_input_messages=...,
    hide_output_messages=...,
    hide_input_images=...,
    hide_input_text=...,
    hide_output_text=...,
    hide_embedding_vectors=...,
    base64_image_max_length=...,
)

from traceai_openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument(
    tracer_provider=trace_provider,
    config=config,
)