Mask Span Attributes
The OpenInference specification defines environment variables to control what data is captured. You can also set them in code viaTraceConfig.
| Environment Variable | Effect | Default |
|---|---|---|
OPENINFERENCE_HIDE_INPUTS | Hides input value, all input messages & embedding input text | False |
OPENINFERENCE_HIDE_OUTPUTS | Hides output value & all output messages | False |
OPENINFERENCE_HIDE_INPUT_MESSAGES | Hides all input messages & embedding input text | False |
OPENINFERENCE_HIDE_OUTPUT_MESSAGES | Hides all output messages | False |
OPENINFERENCE_HIDE_INPUT_IMAGES | Hides images from input messages | False |
OPENINFERENCE_HIDE_INPUT_TEXT | Hides text from input messages & input embeddings | False |
OPENINFERENCE_HIDE_OUTPUT_TEXT | Hides text from output messages | False |
OPENINFERENCE_HIDE_EMBEDDING_VECTORS | Hides returned embedding vectors | False |
OPENINFERENCE_HIDE_LLM_INVOCATION_PARAMETERS | Hides LLM invocation parameters (temperature, top_p, etc.) | False |
OPENINFERENCE_HIDE_PROMPTS | Hides prompt strings on LLM spans | False |
OPENINFERENCE_HIDE_CHOICES | Hides completion choices on LLM spans | False |
OPENINFERENCE_BASE64_IMAGE_MAX_LENGTH | Limits characters of a base64 encoding of an image | 32,000 |
TraceConfig in code > environment variables > defaults.
- Python
- JS/TS
Redact PII with Custom Span Processors
For finer-grained control, create a custom span processor that detects and redacts PII patterns before spans are exported. This runs in your application — sensitive data never leaves your infrastructure.Regex-Based Redaction
This processor supports: email addresses, phone numbers, SSNs, credit card numbers, IP addresses, and dates of birth. Add your own patterns as needed.Wire It Up
![Arize AX trace showing PII redaction — user input with [REDACTED_EMAIL] and [REDACTED_PHONE] in place of real values](https://storage.googleapis.com/arize-phoenix-assets/assets/images/arize-docs-images/instrument/redcated_data.png)
Microsoft Presidio Integration
For teams that need NLP-based PII detection (beyond regex), use Microsoft Presidio as a drop-in replacement for the regex patterns. Presidio supports entity types likePERSON, EMAIL_ADDRESS, PHONE_NUMBER, US_SSN, CREDIT_CARD, IP_ADDRESS, LOCATION, US_PASSPORT, and more.
Presidio span processor example
Presidio span processor example