pub struct Rejects {Show 13 fields
pub signal: &'static str,
pub shed: AtomicU64,
pub failed: AtomicU64,
pub refused: AtomicU64,
pub published: AtomicU64,
pub rows: AtomicU64,
pub bytes: AtomicU64,
pub open_since: AtomicU64,
pub stalled_since: AtomicU64,
shard_open_since: [AtomicU64; 16],
shard_stalled_since: [AtomicU64; 16],
warned: AtomicU64,
refuse_warned: AtomicU64,
}Expand description
What each signal has refused, published and been stuck on, since start.
A handful of counters and one warn a second, not a metrics subsystem. An
exporter being NACKed already logs Mira’s own reason on its side; what only
the server can say is the rate and how long it has been going on, which is
what an operator reads out of /health, /readyz and /api/v1/stats (see
main) when deciding whether to grow the disk or the node.
Static because those three endpoints need all three signals at once and nothing else ever reads them: threading a handle per signal through two routers to reach one probe would be more plumbing than the numbers are worth.
Fields§
§signal: &'static strThe signal these count for, so the endpoints can name them.
shed: AtomicU64Exports refused before the queue, because it was full.
failed: AtomicU64Exports accepted and then NACKed, because the write did not land.
refused: AtomicU64Exports refused permanently, whose records are gone: the client is told not to retry, so this is the only counter that measures lost data.
published: AtomicU64Blocks and rows that reached the disk, and the bytes they took there.
rows: AtomicU64§bytes: AtomicU64§open_since: AtomicU64Unix second the oldest currently open block of this signal took its
first row, or 0 if nothing is open. An age that keeps growing past
max_block_age is a flusher that is not flushing.
Derived from shard_open_since and not
written directly by a
flusher: with more than one shard per signal, a shard that has just
sealed would otherwise clear a sibling’s clock and the stuck flusher
this number exists to expose would read as healthy. The oldest of them,
because the question it answers is “is anything stuck”.
stalled_since: AtomicU64Unix second of the first publish failure in the current run of them, or 0
if the last publish worked. See UNREADY_AFTER. Derived like
open_since, and for the same reason.
shard_open_since: [AtomicU64; 16]What each flusher shard actually writes; the two above are the oldest of each.
Fixed arrays rather than ones sized at spawn: these live in a static
that outlives every flusher and is re-entered by the next test in the
process, so a OnceLock sized by whoever spawned first would be the
wrong length for whoever spawns second. MAX_SHARDS pairs is 256
bytes a signal.
shard_stalled_since: [AtomicU64; 16]§warned: AtomicU64Rate-limit gates, one per line that can fire per export.
refuse_warned: AtomicU64Implementations§
Source§impl Rejects
impl Rejects
const fn new(signal: &'static str) -> Self
Sourcefn oldest(slots: &[AtomicU64; 16]) -> u64
fn oldest(slots: &[AtomicU64; 16]) -> u64
The oldest non-zero timestamp any shard is reporting, or 0 if none is.
Recomputed on every write rather than on every read because the readers
are /healthz, /metrics and the TUI — three calls a second between
them against a hot loop — and MAX_SHARDS relaxed loads is cheaper
than the branch that would decide when to skip it.
Sourcefn set_open_since(&self, shard: usize, at: u64)
fn set_open_since(&self, shard: usize, at: u64)
Report when shard’s open block took its first row, or 0 for “nothing
open”.
Sourcefn mark_stalled(&self, shard: usize)
fn mark_stalled(&self, shard: usize)
Start the clock on a run of failures in shard, or leave it where it is.
Not a store: readiness is about how long this has been going on, so
the timestamp that matters is the first failure of the run, not the
latest. One flusher owns each shard slot, so the compare-exchange cannot
lose a race — it is here to keep the first value.
Sourcefn clear_stalled(&self, shard: usize)
fn clear_stalled(&self, shard: usize)
shard stored a block, so its run of failures is over. The signal is
only unstalled once every shard’s is.
fn record_shed(&self)
Auto Trait Implementations§
impl !Freeze for Rejects
impl RefUnwindSafe for Rejects
impl Send for Rejects
impl Sync for Rejects
impl Unpin for Rejects
impl UnsafeUnpin for Rejects
impl UnwindSafe for Rejects
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].