Record Class RedactionContext

java.lang.Object
java.lang.Record
com.tnsai.quality.redaction.RedactionContext
Record Components:
eventContext - framework event context (tenant, agent, capability…)
scope - which sink is asking for redaction
tenantPolicyId - optional named policy override; empty means "use whatever the redactor's default is"

public record RedactionContext(com.tnsai.observability.events.EventContext eventContext, RedactionScope scope, Optional<String> tenantPolicyId) extends Record
Per-call context handed to a Redactor (issue #80).

Lets a redactor pick policy based on which sink is calling (RedactionScope), which tenant the event belongs to (carried inside eventContext), and which named tenant policy was in effect (tenantPolicyId). The redactor itself stays stateless — context flows in per call.

Since:
0.5.0 (issue #80)
  • Constructor Details

    • RedactionContext

      public RedactionContext(com.tnsai.observability.events.EventContext eventContext, RedactionScope scope, Optional<String> tenantPolicyId)
      Creates an instance of a RedactionContext record class.
      Parameters:
      eventContext - the value for the eventContext record component
      scope - the value for the scope record component
      tenantPolicyId - the value for the tenantPolicyId record component
  • Method Details

    • logAttr

      public static RedactionContext logAttr(com.tnsai.observability.events.EventContext eventContext)
      Convenience: context for a RedactionScope.LOG_ATTR call with default policy.
    • llmPrompt

      public static RedactionContext llmPrompt(com.tnsai.observability.events.EventContext eventContext)
      Convenience: context for an RedactionScope.LLM_PROMPT call with default policy.
    • llmResponse

      public static RedactionContext llmResponse(com.tnsai.observability.events.EventContext eventContext)
      Convenience: context for an RedactionScope.LLM_RESPONSE call with default policy.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • eventContext

      public com.tnsai.observability.events.EventContext eventContext()
      Returns the value of the eventContext record component.
      Returns:
      the value of the eventContext record component
    • scope

      public RedactionScope scope()
      Returns the value of the scope record component.
      Returns:
      the value of the scope record component
    • tenantPolicyId

      public Optional<String> tenantPolicyId()
      Returns the value of the tenantPolicyId record component.
      Returns:
      the value of the tenantPolicyId record component