Class RedisOutboxMetrics

java.lang.Object
com.aim2be.platform.outbox.redis.RedisOutboxMetrics

public class RedisOutboxMetrics extends Object
Micrometer binder for the Redis-outbox metrics. Mirrors the PG OutboxMetricsBinder no-op discipline: when constructed with a null MeterRegistry (Actuator/Micrometer absent in the consumer) every recording method is a no-op and gauge registration is skipped, so the autoconfig boots in minimal contexts.

Metrics:

  • im2be_outbox_redis_enqueued_total{topic} — counter, one per newly-enqueued PENDING entry.
  • im2be_outbox_redis_parked_failed_total — counter, one per entry PARKED to FAILED (refinement #3 — the operator-alert signal; this is the metric that pages, NOT a silent drop).
  • im2be_outbox_redis_durability_violations_total — counter, one per failed durability check (refinement #7).
  • im2be_outbox_redis_retention_deleted_total — counter, total SENT entries reaped by retention (refinement #9).
  • im2be_outbox_redis_repaired_total{class} — counter, repairs applied, tagged by inconsistency class (refinement #10).
  • im2be_outbox_redis_pending_total — gauge, current :pending sorted-set cardinality (backlog visibility).
  • im2be_outbox_redis_undecodable_total — counter, one per corrupted-JSON entry the cold poller skipped (so it cannot poison the sweep — alert on a non-zero rate).
  • Constructor Details

    • RedisOutboxMetrics

      public RedisOutboxMetrics(io.micrometer.core.instrument.MeterRegistry registry, org.springframework.data.redis.core.StringRedisTemplate redis, RedisOutboxKeys keys)
      Parameters:
      registry - Micrometer registry, or null for no-op mode
      redis - Redis template for the :pending gauge poll; never null
      keys - the key set (the pending key the gauge polls); never null
  • Method Details

    • recordUndecodable

      public void recordUndecodable()
      Counts one entry the cold poller could NOT decode (corrupted JSON in the Hash). The entry is skipped so it cannot poison the poller (a parse error in findPendingBatch would otherwise propagate every tick and stall all cold relaying); this counter makes the un-relayable entry observable rather than a silent forever-skip — wire an alert on a non-zero rate so an operator can inspect + repair it.
    • recordEnqueued

      public void recordEnqueued(String topic)
      Counts one newly-enqueued PENDING entry.
      Parameters:
      topic - the entry's Kafka topic
    • recordParkedFailed

      public void recordParkedFailed(UUID eventId)
      Counts one entry PARKED to FAILED (refinement #3). This is the operator-alert signal — wire an alert on a non-zero rate.
      Parameters:
      eventId - the parked entry's id (for log correlation; not a tag to avoid unbounded cardinality)
    • recordPublishFailure

      public void recordPublishFailure(String topic)
      Counts one failed publish attempt (hot relay or cold poller), tagged by topic. Includes circuit-open short-circuits — a degraded broker is a publish failure from the relay's perspective.
      Parameters:
      topic - the topic whose publish failed
    • recordDurabilityViolation

      public void recordDurabilityViolation()
      Counts one durability-config violation (refinement #7).
    • recordRetentionDeleted

      public void recordRetentionDeleted(long count)
      Adds count to the retention-deleted counter (refinement #9).
      Parameters:
      count - number of SENT entries reaped this sweep
    • recordRepaired

      public void recordRepaired(String inconsistencyClass)
      Counts one applied repair, tagged by inconsistency class (refinement #10).
      Parameters:
      inconsistencyClass - "zrem_orphan" or "zadd_orphan"