Audit (core.audit)¶
Types¶
Audit event types and models.
- class pyspark_pipeline_framework.core.audit.types.AuditAction(*values)[source]¶
-
Standard audit actions.
- PIPELINE_STARTED = 'pipeline_started'¶
- PIPELINE_COMPLETED = 'pipeline_completed'¶
- PIPELINE_FAILED = 'pipeline_failed'¶
- COMPONENT_STARTED = 'component_started'¶
- COMPONENT_COMPLETED = 'component_completed'¶
- COMPONENT_FAILED = 'component_failed'¶
- COMPONENT_RETRIED = 'component_retried'¶
- SECRET_ACCESSED = 'secret_accessed'¶
- CONFIG_LOADED = 'config_loaded'¶
- class pyspark_pipeline_framework.core.audit.types.AuditStatus(*values)[source]¶
-
Audit event status.
- SUCCESS = 'success'¶
- FAILURE = 'failure'¶
- RETRY = 'retry'¶
- WARNING = 'warning'¶
- class pyspark_pipeline_framework.core.audit.types.AuditEvent(action, actor, resource, status, timestamp=<factory>, metadata=<factory>, trace_id=None)[source]¶
Bases:
objectA single audit event.
Contains all information about an auditable action.
- Parameters:
action (AuditAction | str) – The action that occurred (enum or custom string).
actor (str) – Who performed the action (e.g. runner name, component name).
resource (str) – What was acted upon (e.g. pipeline name, component class).
status (AuditStatus) – Outcome of the action.
timestamp (datetime) – When the event occurred.
trace_id (str | None) – Correlation ID for distributed tracing.
- action: AuditAction | str¶
- status: AuditStatus¶
Sinks¶
Audit event sinks for emitting audit trails.
- class pyspark_pipeline_framework.core.audit.sinks.AuditSink[source]¶
Bases:
ABCBase class for audit event sinks.
- abstractmethod emit(event)[source]¶
Emit a single audit event.
- Parameters:
event (AuditEvent)
- Return type:
None
- emit_all(events)[source]¶
Emit multiple audit events.
- Parameters:
events (list[AuditEvent])
- Return type:
None
- class pyspark_pipeline_framework.core.audit.sinks.LoggingAuditSink(logger_name='ppf.audit')[source]¶
Bases:
AuditSinkEmit audit events to Python logging.
- Parameters:
logger_name (str) – Logger name to use. Defaults to
"ppf.audit".
- emit(event)[source]¶
Emit a single audit event.
- Parameters:
event (AuditEvent)
- Return type:
None
- class pyspark_pipeline_framework.core.audit.sinks.FileAuditSink(path)[source]¶
Bases:
AuditSinkEmit audit events to a JSON-lines file.
The file is opened lazily on the first
emit()call.- Parameters:
path (str | Path) – Path to the audit log file.
- emit(event)[source]¶
Emit a single audit event.
- Parameters:
event (AuditEvent)
- Return type:
None
- class pyspark_pipeline_framework.core.audit.sinks.CompositeAuditSink(*sinks)[source]¶
Bases:
AuditSinkFan out audit events to multiple sinks.
Exceptions raised by individual sinks are caught and logged so that one failing sink does not prevent others from receiving events.
- Parameters:
sinks (AuditSink) – One or more audit sinks to fan out to.
- emit(event)[source]¶
Emit a single audit event.
- Parameters:
event (AuditEvent)
- Return type:
None
Filters¶
Configuration filter for redacting sensitive values.