Class PipelineCounters
failed() signalling a revoked token or a topic ACL change).
Three lightweight tallies are tracked:
published()— notifications actually accepted by ntfy: a successful individualAlertEngine.submit(io.github.pimak.ntfy.core.AlertEvent)publish and a successful storm-digest publish (the latter also covers the synchronous flush onAlertEngine.stop()).suppressed()— events the rate-limiter gate rejected (over the per-window allowance). This is the only increment site, so it is disjoint fromfailed()and never double-counts.failed()— failed publish attempts: an unsuccessful individual publish, an unexpected exception during an individual publish, and an unsuccessful digest publish.
Pulled, never logged. The engine only ever increments these; nothing here is
emitted through Diagnostics or any logger, so surfacing them cannot re-enter the logging
pipeline and the loop-safe design is preserved. Callers read the values on demand.
Monotonicity. The increment methods are package-private, so only the engine
mutates the counters; external callers can only read. Backed by plain AtomicLong, the
class holds no threads, resources, or static initializers and is GraalVM native-image safe. When
an adapter injects a single PipelineCounters instance into every engine it builds (as the
Logback appender does), the counters accumulate monotonically across engine
start()/stop() cycles and LoggerContext resets for the adapter's whole lifetime.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAn immutable, point-in-time triple of the three counters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongfailed()Failed publish attempts (individual publish failure/exception + digest publish failure).longNotifications actually accepted by ntfy (individual + digest publishes).snapshot()A single read of all three counters.longEvents rejected by the rate-limiter gate (over the per-window allowance).
-
Constructor Details
-
PipelineCounters
public PipelineCounters()
-
-
Method Details
-
published
public long published()Notifications actually accepted by ntfy (individual + digest publishes). -
suppressed
public long suppressed()Events rejected by the rate-limiter gate (over the per-window allowance). -
failed
public long failed()Failed publish attempts (individual publish failure/exception + digest publish failure). -
snapshot
A single read of all three counters. The reads are not taken under a common lock, so the triple is only near-atomic — adequate for observability where operators track rates/deltas, not exact cross-counter consistency at an instant.
-