Package com.aim2be.platform.outbox.redis
Class RedisOutboxMetrics
java.lang.Object
com.aim2be.platform.outbox.redis.RedisOutboxMetrics
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 toFAILED(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:pendingsorted-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 Summary
ConstructorsConstructorDescriptionRedisOutboxMetrics(io.micrometer.core.instrument.MeterRegistry registry, org.springframework.data.redis.core.StringRedisTemplate redis, RedisOutboxKeys keys) -
Method Summary
Modifier and TypeMethodDescriptionvoidCounts one durability-config violation (refinement #7).voidrecordEnqueued(String topic) Counts one newly-enqueued PENDING entry.voidrecordParkedFailed(UUID eventId) Counts one entry PARKED toFAILED(refinement #3).voidrecordPublishFailure(String topic) Counts one failed publish attempt (hot relay or cold poller), tagged by topic.voidrecordRepaired(String inconsistencyClass) Counts one applied repair, tagged by inconsistency class (refinement #10).voidrecordRetentionDeleted(long count) Addscountto the retention-deleted counter (refinement #9).voidCounts one entry the cold poller could NOT decode (corrupted JSON in the Hash).
-
Constructor Details
-
RedisOutboxMetrics
public RedisOutboxMetrics(io.micrometer.core.instrument.MeterRegistry registry, org.springframework.data.redis.core.StringRedisTemplate redis, RedisOutboxKeys keys) - Parameters:
registry- Micrometer registry, ornullfor no-op moderedis- Redis template for the:pendinggauge poll; nevernullkeys- the key set (the pending key the gauge polls); nevernull
-
-
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 infindPendingBatchwould 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
Counts one newly-enqueued PENDING entry.- Parameters:
topic- the entry's Kafka topic
-
recordParkedFailed
Counts one entry PARKED toFAILED(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
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) Addscountto the retention-deleted counter (refinement #9).- Parameters:
count- number of SENT entries reaped this sweep
-
recordRepaired
Counts one applied repair, tagged by inconsistency class (refinement #10).- Parameters:
inconsistencyClass-"zrem_orphan"or"zadd_orphan"
-