Skip to main content

EngineMetrics

Struct EngineMetrics 

Source
pub struct EngineMetrics { /* private fields */ }
Expand description

Process-global engine metrics counters.

Access via EngineMetrics::global(). The global instance is initialised once on first access using OnceLock and lives for the process lifetime.

§Counter naming (maps 1:1 to Prometheus metric names)

MethodPrometheus metricLabels
process_initiatedmakod_process_initiated_totalfamily
process_completedmakod_process_completed_totalfamily, result
validation_failedmakod_validation_failed_totalmessage_type, release
outbox_delivery_attemptedmakod_outbox_delivery_attempts_totalresult
deadline_firedmakod_deadline_fired_totalfamily
dead_letter_recordedmakod_dead_letter_recorded_totalreason

For makod_dead_letter_recorded_total, the reason label is:

  • unknown_pid:<N> when DeadLetterReason::UnknownPid(N) — one label per distinct PID, enabling per-PID alerting
  • a short category string (unknown_conversation, version_mismatch, etc.) for all other reason variants

Implementations§

Source§

impl EngineMetrics

Source

pub fn global() -> &'static Self

Return the process-global EngineMetrics instance.

The instance is initialised lazily on first call. Subsequent calls return the same instance with zero allocation.

Source

pub fn process_initiated(&self, family: &str)

Increment makod_process_initiated_total{family=<family>}.

Call once when a domain workflow receives its first initiating command (e.g. LfAnmeldungCommand::InitiateAnmeldung).

family is the EngineModule::name value ("gpke", "wim", etc.).

Source

pub fn process_completed(&self, family: &str, outcome: ProcessOutcome)

Increment makod_process_completed_total{family=<family>,result=<result>}.

Call once when a workflow transitions to a terminal state (Active, Rejected, timeout, or cancellation).

Source

pub fn validation_failed(&self, message_type: &str, release: &str)

Increment makod_validation_failed_total{message_type=<type>,release=<rel>}.

Call when an inbound message fails validate() or validate_against().

Source

pub fn outbox_delivery_attempted(&self, result: &str)

Increment makod_outbox_delivery_attempts_total{result=<result>}.

Call in the AS4 sender after every delivery attempt. result should be one of "ok", "transport_error", "partner_unknown".

Source

pub fn deadline_fired(&self, family: &str)

Increment makod_deadline_fired_total{family=<family>}.

Call in the deadline scheduler when it dispatches a TimeoutExpired.

Source

pub fn dead_letter_recorded(&self, reason: &str)

Increment makod_dead_letter_recorded_total{reason=<reason>}.

Call in the dead-letter sink when reject() is invoked. reason should match DeadLetterReason’s label string.

Source

pub fn snapshot(&self) -> MetricsSnapshot

Return a snapshot of all counters as a MetricsSnapshot.

This is a read-only operation that does not reset any counters. Counters are monotonically increasing; Prometheus’s rate() handles counter resets on process restart automatically.

Auto Trait Implementations§

Blanket Implementations§

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

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

Source§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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