python_outbox_core.publisher.metrics

Metrics and observability for outbox publishing.

Best Practices Applied: 1. Structured logging (machine-readable) 2. Consistent event naming (outbox.*) 3. Rich context (event_id, type, timing) 4. OpenTelemetry-ready structure

References: - Structured logging: https://www.structlog.org/

Classes

OutboxMetrics

Structured logging for outbox operations.

Module Contents

class python_outbox_core.publisher.metrics.OutboxMetrics(logger: Any = None)

Structured logging for outbox operations.

Projects can extend this to add Prometheus/StatsD metrics.

logger
log_no_events() None

Log when no events are pending.

log_success(event: Any) None

Log successful event publication.

Args:

event: The published IOutboxEvent instance

log_batch_complete(published: int, total: int) None

Log batch processing completion.

Args:

published: Number of successfully published events total: Total events in batch

log_batch_started(batch_size: int) None

Log batch processing start.