MARS documentation
Rust librariesmars-server

mars-server · observability

Public declarations and documentation for mars-server::observability.

Package: mars-server · Workspace version: 0.1.0 · Module: observability

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

observability::HTTP_REQUESTS_TOTAL

Counter: mars_http_requests_total{method, route, status}.

pub const HTTP_REQUESTS_TOTAL: &str;

Source line: 51.

observability::HTTP_REQUEST_DURATION_SECONDS

Histogram: mars_http_request_duration_seconds{method, route}.

pub const HTTP_REQUEST_DURATION_SECONDS: &str;

Source line: 53.

observability::ENTRIES_CREATED_TOTAL

Counter: mars_entries_created_total{entry_type}.

pub const ENTRIES_CREATED_TOTAL: &str;

Source line: 56.

observability::ENTRIES_UPDATED_TOTAL

Counter: mars_entries_updated_total{entry_type}.

pub const ENTRIES_UPDATED_TOTAL: &str;

Source line: 58.

observability::ENTRIES_REVOKED_TOTAL

Counter: mars_entries_revoked_total.

pub const ENTRIES_REVOKED_TOTAL: &str;

Source line: 60.

observability::VALIDATION_REJECTIONS_TOTAL

Counter: mars_validation_rejections_total{reason}.

Canonical reason labels: schema, signature, hash, bond, sequence, did_format.

pub const VALIDATION_REJECTIONS_TOTAL: &str;

Source line: 66.

observability::ANCHOR_SUBMISSIONS_TOTAL

Counter: mars_anchor_submissions_total{outcome}.

Canonical outcome labels: submitted, confirmed, failed.

pub const ANCHOR_SUBMISSIONS_TOTAL: &str;

Source line: 71.

observability::ANCHOR_CONFIRM_LATENCY_SECONDS

Histogram: mars_anchor_confirm_latency_seconds.

pub const ANCHOR_CONFIRM_LATENCY_SECONDS: &str;

Source line: 74.

observability::ANCHOR_OUTBOX_BACKLOG

Gauge: non-terminal anchor intents.

pub const ANCHOR_OUTBOX_BACKLOG: &str;

Source line: 76.

observability::ANCHOR_OUTBOX_OLDEST_AGE_SECONDS

Gauge: age of the oldest non-terminal anchor intent.

pub const ANCHOR_OUTBOX_OLDEST_AGE_SECONDS: &str;

Source line: 78.

observability::ANCHOR_OUTBOX_ATTEMPTS

Gauge: durable submission-attempt count across the outbox.

pub const ANCHOR_OUTBOX_ATTEMPTS: &str;

Source line: 80.

observability::ANCHOR_OUTBOX_MAX_ATTEMPTS

Gauge: maximum attempts observed on one intent.

pub const ANCHOR_OUTBOX_MAX_ATTEMPTS: &str;

Source line: 82.

observability::ANCHOR_OUTBOX_STATE

Gauge: current intent count labelled by bounded outbox state.

pub const ANCHOR_OUTBOX_STATE: &str;

Source line: 84.

observability::ANCHOR_OUTBOX_RETAINED_TERMINAL

Gauge: confirmed/abandoned rows still retained in the hot outbox.

pub const ANCHOR_OUTBOX_RETAINED_TERMINAL: &str;

Source line: 86.

observability::ANCHOR_OUTBOX_ARCHIVED_TERMINAL

Gauge: cumulative archived terminal rows labelled by terminal state.

pub const ANCHOR_OUTBOX_ARCHIVED_TERMINAL: &str;

Source line: 88.

observability::ANCHOR_WORKER_DEGRADED

Gauge: anchor worker degraded state (1 degraded, 0 healthy).

pub const ANCHOR_WORKER_DEGRADED: &str;

Source line: 90.

observability::ANCHOR_WORKER_CONSECUTIVE_FAILURES

Gauge: consecutive failed anchor supervisor passes.

pub const ANCHOR_WORKER_CONSECUTIVE_FAILURES: &str;

Source line: 92.

observability::ANCHOR_WORKER_ERRORS_TOTAL

Counter: bounded anchor worker infrastructure error source.

pub const ANCHOR_WORKER_ERRORS_TOTAL: &str;

Source line: 94.

observability::SIGIL_SHADOW_PARITY_TOTAL

Counter: deterministic Sigil would-submit parity checks.

pub const SIGIL_SHADOW_PARITY_TOTAL: &str;

Source line: 96.

observability::LEDGER_CHAIN_INTEGRITY

Gauge: immutable chain integrity (1 valid, 0 invalid).

pub const LEDGER_CHAIN_INTEGRITY: &str;

Source line: 98.

observability::SEARCH_QUERIES_TOTAL

Counter: completed search queries by bounded backend and plan.

pub const SEARCH_QUERIES_TOTAL: &str;

Source line: 100.

observability::SEARCH_QUERY_DURATION_SECONDS

Histogram: storage query latency by bounded backend and plan.

pub const SEARCH_QUERY_DURATION_SECONDS: &str;

Source line: 102.

observability::SEARCH_RESULTS

Histogram: number of entries returned by each search page.

pub const SEARCH_RESULTS: &str;

Source line: 104.

observability::SEARCH_PARTIAL_RESULTS_TOTAL

Counter: search pages with another keyset page available.

pub const SEARCH_PARTIAL_RESULTS_TOTAL: &str;

Source line: 106.

observability::FEDERATION_REQUEST_DURATION_SECONDS

Histogram: signed federation request latency by bounded operation/outcome.

pub const FEDERATION_REQUEST_DURATION_SECONDS: &str;

Source line: 108.

observability::FEDERATION_ERRORS_TOTAL

Counter: federation request failures by bounded operation/class.

pub const FEDERATION_ERRORS_TOTAL: &str;

Source line: 110.

observability::FEDERATION_BREAKER_STATE

Gauge: durable peer count by breaker state.

pub const FEDERATION_BREAKER_STATE: &str;

Source line: 112.

observability::FEDERATION_LAG

Gauge: aggregate durable federation sequence lag.

pub const FEDERATION_LAG: &str;

Source line: 114.

observability::FEDERATION_QUARANTINES

Gauge: durable quarantined payload count.

pub const FEDERATION_QUARANTINES: &str;

Source line: 116.

observability::FEDERATION_PARTIAL_PEERS

Histogram: failed/omitted peers on partial federated discovery pages.

pub const FEDERATION_PARTIAL_PEERS: &str;

Source line: 118.

observability::RATE_LIMITED_TOTAL

Counter: mars_rate_limited_total{bucket}.

Canonical bucket labels: read, write, query, auth, websocket.

pub const RATE_LIMITED_TOTAL: &str;

Source line: 123.

observability::AUTH_REJECTIONS_TOTAL

Counter: mars_auth_rejections_total{reason}.

Canonical reason labels:

  • token_missing — the request carried neither a bearer token nor a mars_session cookie.
  • token_invalid — the supplied token did not resolve to an active session (expired, revoked, or never minted).
  • verify_failed — POST /v1/auth/siws/verify failed (bad transcript, nonce mismatch, signature error, expired challenge, etc.).
  • audience_mismatch — the verify request body's audience did not match the stored challenge audience.
  • publisher_mismatch — a write request was authorised, but the entry body's publisher_did did not equal the session's hmr_did.
pub const AUTH_REJECTIONS_TOTAL: &str;

Source line: 138.

observability::init_metrics

Install the Prometheus exporter on addr and register all metric descriptions.

Builds a PrometheusRecorder configured to expose /metrics over HTTP on addr, installs it as the global metrics recorder for the process, and spawns the exposition listener as a background task on the current Tokio runtime.

Must be called from within a running Tokio runtime.

Errors

Returns an error if the exporter cannot bind to addr, if the global recorder has already been installed, or if no Tokio runtime is active.

pub fn init_metrics(addr: SocketAddr) -> anyhow::Result<PrometheusHandle>;

Source line: 158.

observability::ValidationReason

Canonical reason labels for mars_validation_rejections_total.

Keeping these as &'static str keeps the metric label set bounded.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ValidationReason {
    Schema,
    Signature,
    Hash,
    Bond,
    Sequence,
    DidFormat,
}

Source line: 326.

observability::ValidationReason::as_str

The string used as the reason label value.

pub const fn as_str(self) -> &'static str;

Source line: 337.

observability::record_validation_rejection

Increment the validation-rejection counter with a bounded reason label.

pub fn record_validation_rejection(reason: ValidationReason);

Source line: 350.

observability::RateLimitBucket

Canonical rate-limit buckets for mars_rate_limited_total.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RateLimitBucket {
    Read,
    Write,
    Query,
    Auth,
    WebSocket,
}

Source line: 360.

observability::RateLimitBucket::as_str

The string used as the bucket label value.

pub const fn as_str(self) -> &'static str;

Source line: 370.

observability::record_rate_limited

Increment the rate-limited counter for a given bucket.

pub fn record_rate_limited(bucket: RateLimitBucket);

Source line: 382.

observability::AuthRejectionReason

Canonical reason labels for mars_auth_rejections_total.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AuthRejectionReason {
    /// Request carried no bearer header and no `mars_session` cookie.
    TokenMissing,
    /// Token was present but did not resolve to an active session.
    TokenInvalid,
    /// `POST /v1/auth/siws/verify` rejected the signed response.
    VerifyFailed,
    /// `POST /v1/auth/siws/verify` body's audience did not match the
    /// stored challenge audience.
    AudienceMismatch,
    /// Write request authorised, but entry `publisher_did` did not equal
    /// the session's `hmr_did`.
    PublisherMismatch,
    /// Session was valid but did not grant the route's required capability.
    CapabilityMissing,
}

Source line: 392.

observability::AuthRejectionReason::as_str

pub const fn as_str(self) -> &'static str;

Source line: 410.

observability::record_auth_rejection

Increment mars_auth_rejections_total&#123;reason=...&#125;.

pub fn record_auth_rejection(reason: AuthRejectionReason);

Source line: 423.

observability::record_anchor_outcome

Increment one bounded anchor worker outcome.

pub fn record_anchor_outcome(outcome: &'static str);

Source line: 428.

observability::record_anchor_outbox_metrics

Publish the current durable outbox measurements.

pub fn record_anchor_outbox_metrics(stats: &crate::store::AnchorOutboxMetrics);

Source line: 433.

observability::record_anchor_worker_health

Publish process-local anchor supervisor health.

pub fn record_anchor_worker_health(degraded: bool, consecutive_failures: u32);

Source line: 458.

observability::AnchorWorkerErrorSource

Bounded sources for anchor worker infrastructure errors.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AnchorWorkerErrorSource {
    Claim,
    ClaimTransition,
    Metrics,
}

Source line: 465.

observability::record_anchor_worker_error

Increment one bounded anchor worker infrastructure error.

pub fn record_anchor_worker_error(source: AnchorWorkerErrorSource);

Source line: 482.

observability::record_sigil_shadow_parity

Record one bounded deterministic payload/result parity outcome.

pub fn record_sigil_shadow_parity(operation: &'static str, shadow: bool, matched: bool);

Source line: 487.

observability::record_chain_integrity

Publish one immutable-chain verification result.

pub fn record_chain_integrity(chain: &'static str, valid: bool);

Source line: 498.

observability::record_search_metrics

Record one completed storage-native MARS-QL execution.

pub fn record_search_metrics(page: &crate::search::QueryPage, elapsed_seconds: f64);

Source line: 503.

observability::record_federation_peer_request

Record one signed peer operation with bounded labels.

pub fn record_federation_peer_request(
    operation: &'static str,
    outcome: &'static str,
    elapsed_seconds: f64,
);

Source line: 535.

observability::record_federation_metrics

Publish durable aggregate peer/breaker/lag/quarantine state.

pub fn record_federation_metrics(stats: &crate::store::FederationMetrics);

Source line: 557.

observability::record_federation_partial_peers

Record one federated discovery partial-peer count.

pub fn record_federation_partial_peers(failed_peers: u32);

Source line: 571.

observability::track_http_metrics

Per-request middleware that bumps the HTTP request counter and observes the request duration.

Cardinality is bounded by using the matched route template (e.g. /v1/entries/&#123;did&#125;) rather than the concrete request URI. When no route matches (e.g. a 404 with no path), the literal unknown is used.

pub async fn track_http_metrics(req: Request, next: Next) -> Response;

Source line: 587.

Source provenance

Source: mars-server/src/observability/mod.rs · SHA-256 01e86d74dbcff6e5a79f910b7162d0f3dddf9694028a68287851102547df3ffa. Package overview.

On this page

observability::HTTP_REQUESTS_TOTALobservability::HTTP_REQUEST_DURATION_SECONDSobservability::ENTRIES_CREATED_TOTALobservability::ENTRIES_UPDATED_TOTALobservability::ENTRIES_REVOKED_TOTALobservability::VALIDATION_REJECTIONS_TOTALobservability::ANCHOR_SUBMISSIONS_TOTALobservability::ANCHOR_CONFIRM_LATENCY_SECONDSobservability::ANCHOR_OUTBOX_BACKLOGobservability::ANCHOR_OUTBOX_OLDEST_AGE_SECONDSobservability::ANCHOR_OUTBOX_ATTEMPTSobservability::ANCHOR_OUTBOX_MAX_ATTEMPTSobservability::ANCHOR_OUTBOX_STATEobservability::ANCHOR_OUTBOX_RETAINED_TERMINALobservability::ANCHOR_OUTBOX_ARCHIVED_TERMINALobservability::ANCHOR_WORKER_DEGRADEDobservability::ANCHOR_WORKER_CONSECUTIVE_FAILURESobservability::ANCHOR_WORKER_ERRORS_TOTALobservability::SIGIL_SHADOW_PARITY_TOTALobservability::LEDGER_CHAIN_INTEGRITYobservability::SEARCH_QUERIES_TOTALobservability::SEARCH_QUERY_DURATION_SECONDSobservability::SEARCH_RESULTSobservability::SEARCH_PARTIAL_RESULTS_TOTALobservability::FEDERATION_REQUEST_DURATION_SECONDSobservability::FEDERATION_ERRORS_TOTALobservability::FEDERATION_BREAKER_STATEobservability::FEDERATION_LAGobservability::FEDERATION_QUARANTINESobservability::FEDERATION_PARTIAL_PEERSobservability::RATE_LIMITED_TOTALobservability::AUTH_REJECTIONS_TOTALobservability::init_metricsErrorsobservability::ValidationReasonobservability::ValidationReason::as_strobservability::record_validation_rejectionobservability::RateLimitBucketobservability::RateLimitBucket::as_strobservability::record_rate_limitedobservability::AuthRejectionReasonobservability::AuthRejectionReason::as_strobservability::record_auth_rejectionobservability::record_anchor_outcomeobservability::record_anchor_outbox_metricsobservability::record_anchor_worker_healthobservability::AnchorWorkerErrorSourceobservability::record_anchor_worker_errorobservability::record_sigil_shadow_parityobservability::record_chain_integrityobservability::record_search_metricsobservability::record_federation_peer_requestobservability::record_federation_metricsobservability::record_federation_partial_peersobservability::track_http_metricsSource provenance