Privacy Controls
OpenInference provides comprehensive privacy controls to help you maintain security and compliance while still benefiting from observability. You can mask PII, filter sensitive data, and selectively suppress tracing.Overview
Privacy controls in OpenInference allow you to:- Mask sensitive data - Replace PII with
"__REDACTED__"placeholder - Filter specific content - Hide images, text, or embeddings selectively
- Suppress tracing - Completely disable tracing for specific code blocks
- Control payload size - Limit large data like base64-encoded images
Redacted Value Placeholder
When content is hidden, OpenInference uses the constant"__REDACTED__" as a placeholder. This allows trace consumers to identify that content was intentionally hidden rather than missing or empty.
The redacted value constant is available for import:
PII Masking
Hiding Text Content
Protect user messages and LLM responses while preserving trace structure:- Replaces message text with
"__REDACTED__" - Preserves message structure and metadata
- Maintains trace flow and timing information
Hiding Complete Messages
Remove entire message objects from traces:Hiding All Inputs/Outputs
Hide both values and messages completely:hide_inputs=True automatically hides input messages. Setting hide_input_messages=True hides only messages but not the input value.
Data Filtering
Hiding Images
Remove images from traces while keeping text:- Images may contain sensitive or identifying information
- You want to reduce storage costs
- Compliance requires removing visual data
Limiting Image Size
Truncate large base64-encoded images:"__REDACTED__".
Hiding Embeddings
Protect embedding vectors and their associated text:Suppressing Tracing
Context Manager (Python)
Completely disable tracing for specific code blocks:Async Support (Python)
JavaScript Suppression
Use OpenTelemetry’s built-in suppression:Common Privacy Scenarios
GDPR Compliance
Minimize personal data collection:HIPAA Compliance
Protect healthcare information:Financial Services
Hide transaction details and account numbers:Development vs. Production
Use environment-specific configurations:Cost Optimization
Reduce storage costs while maintaining observability:Advanced Patterns
Selective Message Filtering
Hide text but keep images for debugging:Embedding Privacy
Hide vectors but keep text for searchability:LLM-Specific Controls
Hide only invocation parameters:Completions API Privacy
For legacy completions API:Best Practices
- Start restrictive - Begin with more privacy controls and relax as needed
- Test in development - Verify traces contain expected information before deploying
- Document your choices - Keep a record of which privacy controls are enabled and why
- Use environment variables - Make privacy settings configurable per environment
- Review regularly - Audit your privacy settings as requirements change
- Combine methods - Use both TraceConfig and suppress_tracing for comprehensive control
- Monitor impact - Ensure privacy controls don’t hide critical debugging information
Validation
Verify your privacy controls are working:Next Steps
- See TraceConfig for complete configuration reference
- See Environment Variables for deployment options