nat.observability.processor.redaction.contextual_span_redaction_processor#

Classes#

ContextualSpanRedactionProcessor

Processor that redacts the Span based on the Span attributes.

Module Contents#

class ContextualSpanRedactionProcessor(
attributes: list[str],
callback: collections.abc.Callable[Ellipsis, Any],
enabled: bool,
force_redact: bool,
redaction_value: str,
redaction_tag: str | None = None,
)#

Bases: nat.observability.processor.redaction.contextual_redaction_processor.ContextualRedactionProcessor[nat.data_models.span.Span, nat.observability.processor.redaction.redaction_processor.RedactionDataT]

Processor that redacts the Span based on the Span attributes.

Args:

attributes: List of span attribute keys to redact callback: Callable that determines if redaction should occur enabled: Whether the processor is enabled force_redact: If True, always redact regardless of callback redaction_value: The value to replace redacted attributes with

attributes#
redaction_tag = None#
async redact_item(
item: nat.data_models.span.Span,
) nat.data_models.span.Span#

Redact specified attributes in the span.

Replaces the values of configured attributes with the redaction value.

Args:

item (Span): The span to redact

Returns:

Span: The span with redacted attributes