Package com.tnsai.quality.redaction
Record Class RedactionAuditEvent
java.lang.Object
java.lang.Record
com.tnsai.quality.redaction.RedactionAuditEvent
- Record Components:
eventId- stable id for cross-system correlationtimestamp- when redaction completed (UTC)scope- which sink fired this — LOG_ATTR, MEMORY_WRITE, etc.eventContext- framework correlation context at call time; carries tenantId, sessionId, agentId, traceIdpatternCounts-patternName → match count(e.g."email" → 3, "credit_card" → 1)highestSeverity- max severity across all findings; lets a notifier hop straight to "is this CRITICAL?" without walking the counts maptotalFindings- sum acrosspatternCounts— pre-computed so dashboards can plot it without aggregation
public record RedactionAuditEvent(String eventId, Instant timestamp, RedactionScope scope, com.tnsai.observability.events.EventContext eventContext, Map<String,Integer> patternCounts, Severity highestSeverity, int totalFindings)
extends Record
Audit record for one redaction call (issue #80).
Emitted by AuditingRedactor whenever the wrapped redactor
returns at least one RedactionFinding. Operators get the
compliance audit trail ("we redacted 3 credit-card matches in tenant
acme today") without the audit log itself becoming a leak vector —
the redacted content never appears here, only metadata.
Why a flat Map<patternName, count>: cardinality is bounded
by the pattern catalog (~14 patterns by default), and counts are
aggregate-friendly for downstream metrics (Prometheus counter labels,
Datadog facets).
- Since:
- 0.9.0 (issue #80)
-
Constructor Summary
ConstructorsConstructorDescriptionRedactionAuditEvent(String eventId, Instant timestamp, RedactionScope scope, com.tnsai.observability.events.EventContext eventContext, Map<String, Integer> patternCounts, Severity highestSeverity, int totalFindings) Creates an instance of aRedactionAuditEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.com.tnsai.observability.events.EventContextReturns the value of theeventContextrecord component.eventId()Returns the value of theeventIdrecord component.static RedactionAuditEventfrom(List<RedactionFinding> findings, RedactionContext ctx) Build an audit event from the findings produced by a redactor call.final inthashCode()Returns a hash code value for this object.Returns the value of thehighestSeverityrecord component.booleanSeverity-tier shorthand — handy forif (event.isCritical())gates that decide whether to fire theOnNotificationhook.Returns the value of thepatternCountsrecord component.scope()Returns the value of thescoperecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalFindingsrecord component.
-
Constructor Details
-
RedactionAuditEvent
public RedactionAuditEvent(String eventId, Instant timestamp, RedactionScope scope, com.tnsai.observability.events.EventContext eventContext, Map<String, Integer> patternCounts, Severity highestSeverity, int totalFindings) Creates an instance of aRedactionAuditEventrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentscope- the value for thescoperecord componenteventContext- the value for theeventContextrecord componentpatternCounts- the value for thepatternCountsrecord componenthighestSeverity- the value for thehighestSeverityrecord componenttotalFindings- the value for thetotalFindingsrecord component
-
-
Method Details
-
from
Build an audit event from the findings produced by a redactor call. Aggregates counts per pattern and computes the highest severity in a single pass.- Throws:
IllegalArgumentException- iffindingsis empty — audit events should only be emitted when something actually got redacted
-
isCritical
public boolean isCritical()Severity-tier shorthand — handy forif (event.isCritical())gates that decide whether to fire theOnNotificationhook. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
eventId
Returns the value of theeventIdrecord component.- Returns:
- the value of the
eventIdrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
scope
Returns the value of thescoperecord component.- Returns:
- the value of the
scoperecord component
-
eventContext
public com.tnsai.observability.events.EventContext eventContext()Returns the value of theeventContextrecord component.- Returns:
- the value of the
eventContextrecord component
-
patternCounts
Returns the value of thepatternCountsrecord component.- Returns:
- the value of the
patternCountsrecord component
-
highestSeverity
Returns the value of thehighestSeverityrecord component.- Returns:
- the value of the
highestSeverityrecord component
-
totalFindings
public int totalFindings()Returns the value of thetotalFindingsrecord component.- Returns:
- the value of the
totalFindingsrecord component
-