Skip to main content

Rejects

Struct Rejects 

Source
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 str

The signal these count for, so the endpoints can name them.

§shed: AtomicU64

Exports refused before the queue, because it was full.

§failed: AtomicU64

Exports accepted and then NACKed, because the write did not land.

§refused: AtomicU64

Exports refused permanently, whose records are gone: the client is told not to retry, so this is the only counter that measures lost data.

§published: AtomicU64

Blocks and rows that reached the disk, and the bytes they took there.

§rows: AtomicU64§bytes: AtomicU64§open_since: AtomicU64

Unix 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: AtomicU64

Unix 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: AtomicU64

Rate-limit gates, one per line that can fire per export.

§refuse_warned: AtomicU64

Implementations§

Source§

impl Rejects

Source

const fn new(signal: &'static str) -> Self

Source

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.

Source

fn set_open_since(&self, shard: usize, at: u64)

Report when shard’s open block took its first row, or 0 for “nothing open”.

Source

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.

Source

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.

Source

fn record_shed(&self)

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more