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)
| Method | Prometheus metric | Labels |
|---|---|---|
process_initiated | makod_process_initiated_total | family |
process_completed | makod_process_completed_total | family, result |
validation_failed | makod_validation_failed_total | message_type, release |
outbox_delivery_attempted | makod_outbox_delivery_attempts_total | result |
deadline_fired | makod_deadline_fired_total | family |
dead_letter_recorded | makod_dead_letter_recorded_total | reason |
For makod_dead_letter_recorded_total, the reason label is:
unknown_pid:<N>whenDeadLetterReason::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
impl EngineMetrics
Sourcepub fn global() -> &'static Self
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.
Sourcepub fn process_initiated(&self, family: &str)
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.).
Sourcepub fn process_completed(&self, family: &str, outcome: ProcessOutcome)
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).
Sourcepub fn validation_failed(&self, message_type: &str, release: &str)
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().
Sourcepub fn outbox_delivery_attempted(&self, result: &str)
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".
Sourcepub fn deadline_fired(&self, family: &str)
pub fn deadline_fired(&self, family: &str)
Increment makod_deadline_fired_total{family=<family>}.
Call in the deadline scheduler when it dispatches a TimeoutExpired.
Sourcepub fn dead_letter_recorded(&self, reason: &str)
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.
Sourcepub fn snapshot(&self) -> MetricsSnapshot
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.