FabricMetrics

Struct FabricMetrics 

Source
pub struct FabricMetrics {
Show 62 fields pub leases_active: MetricGauge, pub leases_total: MetricCounter, pub leases_expired: MetricCounter, pub leases_fenced: MetricCounter, pub ops_total: MetricCounter, pub ops_errors: MetricCounter, pub bytes_read: MetricCounter, pub bytes_written: MetricCounter, pub rewrites_total: MetricCounter, pub op_latency: MetricHistogram, pub leases_revoked: MetricCounter, pub bind_latency: MetricHistogram, pub renew_latency: MetricHistogram, pub revoke_latency: MetricHistogram, pub teardown_latency: MetricHistogram, pub auth_failures: MetricCounter, pub replay_rejections: MetricCounter, pub token_validations: MetricCounter, pub token_failures: MetricCounter, pub stale_access_rejections: MetricCounter, pub control_latency: MetricHistogram, pub dataplane_latency: MetricHistogram, pub tasklet_submit_latency: MetricHistogram, pub tasklet_exec_latency: MetricHistogram, pub tasklet_submits: MetricCounter, pub tasklet_completions: MetricCounter, pub tasklet_failures: MetricCounter, pub tasklet_duration: MetricHistogram, pub module_cache_hits: MetricCounter, pub module_cache_misses: MetricCounter, pub module_cache_stores: MetricCounter, pub module_cache_hash_mismatches: MetricCounter, pub audit_capability_issued: MetricCounter, pub audit_capability_revoked: MetricCounter, pub audit_lease_allocated: MetricCounter, pub audit_lease_renewed: MetricCounter, pub audit_lease_released: MetricCounter, pub audit_lease_expired: MetricCounter, pub audit_lease_fenced: MetricCounter, pub audit_lease_torndown: MetricCounter, pub audit_admission_decided: MetricCounter, pub audit_preempted: MetricCounter, pub audit_drain_initiated: MetricCounter, pub audit_chain_anchored: MetricCounter, pub audit_soft_mode_enabled: MetricCounter, pub audit_tenant_created: MetricCounter, pub audit_tenant_deleted: MetricCounter, pub audit_tenant_quota_updated: MetricCounter, pub audit_provider_conformance_recorded: MetricCounter, pub audit_provider_bootstrap_token_issued: MetricCounter, pub audit_provider_bootstrap_exchanged: MetricCounter, pub audit_provider_cell_identity_issued: MetricCounter, pub audit_provider_cell_identity_rotated: MetricCounter, pub audit_provider_cell_identity_revoked: MetricCounter, pub audit_bearer_token_issued: MetricCounter, pub audit_bearer_token_revoked: MetricCounter, pub audit_scheduler_promoted: MetricCounter, pub audit_billing_rate_card_installed: MetricCounter, pub audit_edge_rewritten: MetricCounter, pub audit_records_emitted: MetricCounter, pub audit_jsonl_writes: MetricCounter, pub audit_jsonl_write_failed: MetricCounter,
}
Expand description

Global fabric metrics registry.

Tracks system-wide counters and gauges for lease lifecycles, data-plane operations, and graph rewrites. Access the process-wide singleton via FabricMetrics::global().

§Examples

use grafos_observe::FabricMetrics;

let m = FabricMetrics::global();
m.leases_total.inc();
m.leases_active.inc();
m.ops_total.add(5);
m.bytes_read.add(1024);
m.op_latency.observe(300);

Fields§

§leases_active: MetricGauge

Currently active leases (gauge — goes up on acquire, down on drop/expire).

§leases_total: MetricCounter

Total leases ever created (counter).

§leases_expired: MetricCounter

Total leases that expired (counter).

§leases_fenced: MetricCounter

Total leases that entered fenced state (counter).

§ops_total: MetricCounter

Total data-plane operations completed (counter).

§ops_errors: MetricCounter

Total data-plane operations that failed (counter).

§bytes_read: MetricCounter

Total bytes read across all data-plane operations (counter).

§bytes_written: MetricCounter

Total bytes written across all data-plane operations (counter).

§rewrites_total: MetricCounter

Total graph rewrites initiated (counter).

§op_latency: MetricHistogram

Histogram of operation latencies in microseconds.

§leases_revoked: MetricCounter

Total leases explicitly revoked (counter) — distinct from expired.

§bind_latency: MetricHistogram

Histogram of lease bind latency in microseconds.

§renew_latency: MetricHistogram

Histogram of lease renewal latency in microseconds.

§revoke_latency: MetricHistogram

Histogram of lease revocation latency in microseconds.

§teardown_latency: MetricHistogram

Histogram of teardown execution latency in microseconds.

§auth_failures: MetricCounter

Total authentication failures (counter).

§replay_rejections: MetricCounter

Total anti-replay cache rejections (counter).

§token_validations: MetricCounter

Total capability token validations (counter).

§token_failures: MetricCounter

Total capability token validation failures (counter).

§stale_access_rejections: MetricCounter

Total stale access attempts after revoke/expiry (counter).

§control_latency: MetricHistogram

Histogram of control-plane operation latencies in microseconds.

§dataplane_latency: MetricHistogram

Histogram of dataplane operation latencies in microseconds.

§tasklet_submit_latency: MetricHistogram

Histogram of tasklet submit (full dispatch) latencies in microseconds.

§tasklet_exec_latency: MetricHistogram

Histogram of tasklet execution-only latencies in microseconds.

§tasklet_submits: MetricCounter

Total tasklet submissions received (counter).

§tasklet_completions: MetricCounter

Total tasklet executions that completed successfully (counter).

§tasklet_failures: MetricCounter

Total tasklet executions that failed (counter).

§tasklet_duration: MetricHistogram

Histogram of tasklet wall-clock duration in microseconds.

§module_cache_hits: MetricCounter

Total module cache hits (counter).

§module_cache_misses: MetricCounter

Total module cache misses (counter).

§module_cache_stores: MetricCounter

Total module cache stores (counter).

§module_cache_hash_mismatches: MetricCounter

Total module cache hash mismatches (counter).

§audit_capability_issued: MetricCounter

Total CapabilityIssued audit records emitted (counter).

§audit_capability_revoked: MetricCounter

Total CapabilityRevoked audit records emitted (counter).

§audit_lease_allocated: MetricCounter

Total LeaseAllocated audit records emitted (counter).

§audit_lease_renewed: MetricCounter

Total LeaseRenewed audit records emitted (counter).

§audit_lease_released: MetricCounter

Total LeaseReleased audit records emitted (counter).

§audit_lease_expired: MetricCounter

Total LeaseExpired audit records emitted (counter).

§audit_lease_fenced: MetricCounter

Total LeaseFenced audit records emitted (counter).

§audit_lease_torndown: MetricCounter

Total LeaseTorndown audit records emitted (counter).

§audit_admission_decided: MetricCounter

Total AdmissionDecided audit records emitted (counter).

§audit_preempted: MetricCounter

Total Preempted audit records emitted (counter).

§audit_drain_initiated: MetricCounter

Total DrainInitiated audit records emitted (counter).

§audit_chain_anchored: MetricCounter

Total ChainAnchored audit records emitted (counter). A non-zero value indicates the chain has been anchored at least once — operators monitor this for key-rotation boundaries.

§audit_soft_mode_enabled: MetricCounter

Total SoftModeEnabled audit records emitted (counter). Should normally be ZERO in production. Any non-zero value means a weaker-mode toggle was enabled and warrants operator attention.

§audit_tenant_created: MetricCounter

Phase 218–222 / slice 77 — total TenantCreated audit records emitted (counter). Tenant-CRUD typed kinds were added in Stage 2a of the audit-surface migration; producers dual-write to both this typed counter and the older enterprise_audit log during Stage 2.

§audit_tenant_deleted: MetricCounter

Phase 218–222 / slice 77 — total TenantDeleted audit records emitted (counter).

§audit_tenant_quota_updated: MetricCounter

Phase 218–222 / slice 77 — total TenantQuotaUpdated audit records emitted (counter).

§audit_provider_conformance_recorded: MetricCounter

Phase 218–222 / slice 79 — total ProviderConformanceRecorded audit records emitted (counter). Stage 2b of the audit-surface migration: the orchestrator dual-writes this typed counter alongside the older enterprise_audit kind=admin, outcome="provider_conformance_recorded" row.

§audit_provider_bootstrap_token_issued: MetricCounter

Phase 218–222 / slice 79 — total ProviderBootstrapTokenIssued audit records emitted.

§audit_provider_bootstrap_exchanged: MetricCounter

Phase 218–222 / slice 79 — total ProviderBootstrapExchanged audit records emitted.

§audit_provider_cell_identity_issued: MetricCounter

Phase 218–222 / slice 79 — total ProviderCellIdentityIssued audit records emitted.

§audit_provider_cell_identity_rotated: MetricCounter

Phase 218–222 / slice 79 — total ProviderCellIdentityRotated audit records emitted.

§audit_provider_cell_identity_revoked: MetricCounter

Phase 218–222 / slice 79 — total ProviderCellIdentityRevoked audit records emitted.

§audit_bearer_token_issued: MetricCounter

Phase 218–222 / slice 80 — total BearerTokenIssued audit records emitted (counter). Stage 2c of the audit-surface migration: cell-side and orchestrator-side mint paths dual- write this typed counter alongside the older enterprise_audit kind=token, outcome="created" row. Distinct from audit_capability_issued: bearer tokens are HTTP Authorization-shaped admin/tenant API keys (not lease-bound capability tokens). Operators monitoring token churn or alerting on suspicious mint cadence read this counter.

§audit_bearer_token_revoked: MetricCounter

Phase 218–222 / slice 80 — total BearerTokenRevoked audit records emitted (counter). Distinct from audit_capability_revoked (lease-bound capability revoke). Operators monitoring token revocation rate or alerting on mass-revoke incidents read this counter.

§audit_scheduler_promoted: MetricCounter

Phase 218–222 / slice 81 — total SchedulerPromoted audit records emitted (counter). Stage 2 mop-up of the audit-surface migration: the cell-side handle_promote dual-writes this typed counter alongside the older enterprise_audit kind=admin, outcome="promoted" row. A non-zero value (and especially a sustained rate) is operator-relevant: each emit represents a leadership transition.

§audit_billing_rate_card_installed: MetricCounter

Phase 218–222 / slice 81 — total BillingRateCardInstalled audit records emitted (counter). Stage 2 mop-up: the only Billing-category producer. Lifecycle-axis, low-volume. Operators alerting on rate-card swaps (a billing-impacting admin action) read this counter.

§audit_edge_rewritten: MetricCounter

Slice 261 (EdgeRecord audit-chain integration arc) — total EdgeRewritten audit records emitted (counter). One emit per affected edge per committed rewrite (producer wiring in slice 262). High-volume relative to other audit kinds because a rewrite typically touches multiple edges; operators reading this counter expect throughput proportional to graph mutation rate.

§audit_records_emitted: MetricCounter

Total audit records emitted across all kinds (counter). Equal to the sum of the per-kind counters; exposed separately for cheap “total emit rate” dashboards.

§audit_jsonl_writes: MetricCounter

Phase 219 slice 23 — total audit records persisted to the JSONL sink (counter). Bumps once per successful grafos_audit::write_record call. Difference from audit_records_emitted indicates JSONL lag or the daemon running without --audit-jsonl-path.

§audit_jsonl_write_failed: MetricCounter

Phase 219 slice 23 — total audit JSONL writes that failed (counter). Bumps once per write_record Err. Operator attention warranted; chain integrity is preserved but the downstream collector is missing records.

Implementations§

Source§

impl FabricMetrics

Source

pub const fn new() -> Self

Create a new metrics instance with all values at zero.

Source

pub fn count_audit_emit(&self, kind: AuditEventKind)

Phase 219 slice 20 — bump the per-kind audit-emit counter for kind, plus the overall audit_records_emitted counter. Callers (typically fabricbiosd’s emit_*_audit helpers and the tick thread’s inline emit) call this on every successful assemble_record so the Prometheus dashboard sees the rate. The match arms cover every AuditEventKind variant — adding a new variant in grafos-core::policy_vocab MUST also add the corresponding counter and an arm here, otherwise the new kind’s emit rate is invisible.

Source

pub fn global() -> &'static FabricMetrics

Access the global metrics instance.

Trait Implementations§

Source§

impl Default for FabricMetrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.