nat.observability.processor.redaction.span_header_redaction_processor#
Attributes#
Classes#
Processor that redacts the Span based on multiple headers and callback logic. |
Module Contents#
- logger#
- class SpanHeaderRedactionProcessor(
- headers: list[str],
- attributes: list[str],
- callback: collections.abc.Callable[Ellipsis, Any],
- enabled: bool = True,
- force_redact: bool = False,
- redaction_value: str = '[REDACTED]',
- redaction_tag: str | None = None,
Bases:
nat.observability.processor.redaction.contextual_span_redaction_processor.ContextualSpanRedactionProcessor[dict[str,Any]]Processor that redacts the Span based on multiple headers and callback logic.
Uses context-scoped atomic updates to avoid redundant callback executions within a single context. Since headers are static per request, the callback result is cached for the entire context using an asynccontextmanager to ensure atomic operations.
- Args:
headers: List of header keys to extract and pass to the callback attributes: List of Span attribute keys to redact callback: Callable that determines if redaction should occur enabled: Whether the processor is enabled (default: True) force_redact: If True, always redact regardless of header checks (default: False) redaction_value: The value to replace redacted attributes with (default: “[REDACTED]”)
- headers#