Interface ITelemetrySanitizer
Sanitizes telemetry data to prevent PII leakage into observability systems.
public interface ITelemetrySanitizer
- Extension Methods
Remarks
Implementations control how sensitive data (user IDs, email addresses, tokens) is handled before being emitted as span tags, log properties, or metric dimensions.
The default implementation (HashingTelemetrySanitizer) uses SHA-256 hashing
for sensitive values, suppresses highly sensitive tags entirely, and passes through
non-sensitive data unchanged.
Methods
SanitizePayload(string)
Sanitizes a payload string (e.g., a message body or log message) before it is emitted.
string SanitizePayload(string payload)
Parameters
payloadstringThe raw payload to sanitize.
Returns
- string
The sanitized payload.
SanitizeTag(string, string?)
Sanitizes a telemetry tag value before it is emitted.
string? SanitizeTag(string tagName, string? rawValue)
Parameters
tagNamestringThe name of the tag (e.g., "user.id", "auth.email").
rawValuestringThe raw tag value to sanitize.