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: MetricGaugeCurrently active leases (gauge — goes up on acquire, down on drop/expire).
leases_total: MetricCounterTotal leases ever created (counter).
leases_expired: MetricCounterTotal leases that expired (counter).
leases_fenced: MetricCounterTotal leases that entered fenced state (counter).
ops_total: MetricCounterTotal data-plane operations completed (counter).
ops_errors: MetricCounterTotal data-plane operations that failed (counter).
bytes_read: MetricCounterTotal bytes read across all data-plane operations (counter).
bytes_written: MetricCounterTotal bytes written across all data-plane operations (counter).
rewrites_total: MetricCounterTotal graph rewrites initiated (counter).
op_latency: MetricHistogramHistogram of operation latencies in microseconds.
leases_revoked: MetricCounterTotal leases explicitly revoked (counter) — distinct from expired.
bind_latency: MetricHistogramHistogram of lease bind latency in microseconds.
renew_latency: MetricHistogramHistogram of lease renewal latency in microseconds.
revoke_latency: MetricHistogramHistogram of lease revocation latency in microseconds.
teardown_latency: MetricHistogramHistogram of teardown execution latency in microseconds.
auth_failures: MetricCounterTotal authentication failures (counter).
replay_rejections: MetricCounterTotal anti-replay cache rejections (counter).
token_validations: MetricCounterTotal capability token validations (counter).
token_failures: MetricCounterTotal capability token validation failures (counter).
stale_access_rejections: MetricCounterTotal stale access attempts after revoke/expiry (counter).
control_latency: MetricHistogramHistogram of control-plane operation latencies in microseconds.
dataplane_latency: MetricHistogramHistogram of dataplane operation latencies in microseconds.
tasklet_submit_latency: MetricHistogramHistogram of tasklet submit (full dispatch) latencies in microseconds.
tasklet_exec_latency: MetricHistogramHistogram of tasklet execution-only latencies in microseconds.
tasklet_submits: MetricCounterTotal tasklet submissions received (counter).
tasklet_completions: MetricCounterTotal tasklet executions that completed successfully (counter).
tasklet_failures: MetricCounterTotal tasklet executions that failed (counter).
tasklet_duration: MetricHistogramHistogram of tasklet wall-clock duration in microseconds.
module_cache_hits: MetricCounterTotal module cache hits (counter).
module_cache_misses: MetricCounterTotal module cache misses (counter).
module_cache_stores: MetricCounterTotal module cache stores (counter).
module_cache_hash_mismatches: MetricCounterTotal module cache hash mismatches (counter).
audit_capability_issued: MetricCounterTotal CapabilityIssued audit records emitted (counter).
audit_capability_revoked: MetricCounterTotal CapabilityRevoked audit records emitted (counter).
audit_lease_allocated: MetricCounterTotal LeaseAllocated audit records emitted (counter).
audit_lease_renewed: MetricCounterTotal LeaseRenewed audit records emitted (counter).
audit_lease_released: MetricCounterTotal LeaseReleased audit records emitted (counter).
audit_lease_expired: MetricCounterTotal LeaseExpired audit records emitted (counter).
audit_lease_fenced: MetricCounterTotal LeaseFenced audit records emitted (counter).
audit_lease_torndown: MetricCounterTotal LeaseTorndown audit records emitted (counter).
audit_admission_decided: MetricCounterTotal AdmissionDecided audit records emitted (counter).
audit_preempted: MetricCounterTotal Preempted audit records emitted (counter).
audit_drain_initiated: MetricCounterTotal DrainInitiated audit records emitted (counter).
audit_chain_anchored: MetricCounterTotal 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: MetricCounterTotal 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: MetricCounterPhase 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: MetricCounterPhase 218–222 / slice 77 — total TenantDeleted audit
records emitted (counter).
audit_tenant_quota_updated: MetricCounterPhase 218–222 / slice 77 — total TenantQuotaUpdated audit
records emitted (counter).
audit_provider_conformance_recorded: MetricCounterPhase 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: MetricCounterPhase 218–222 / slice 79 — total
ProviderBootstrapTokenIssued audit records emitted.
audit_provider_bootstrap_exchanged: MetricCounterPhase 218–222 / slice 79 — total ProviderBootstrapExchanged
audit records emitted.
audit_provider_cell_identity_issued: MetricCounterPhase 218–222 / slice 79 — total ProviderCellIdentityIssued
audit records emitted.
audit_provider_cell_identity_rotated: MetricCounterPhase 218–222 / slice 79 — total ProviderCellIdentityRotated
audit records emitted.
audit_provider_cell_identity_revoked: MetricCounterPhase 218–222 / slice 79 — total ProviderCellIdentityRevoked
audit records emitted.
audit_bearer_token_issued: MetricCounterPhase 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: MetricCounterPhase 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: MetricCounterPhase 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: MetricCounterPhase 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: MetricCounterSlice 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: MetricCounterTotal 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: MetricCounterPhase 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: MetricCounterPhase 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
impl FabricMetrics
Sourcepub fn count_audit_emit(&self, kind: AuditEventKind)
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.
Sourcepub fn global() -> &'static FabricMetrics
pub fn global() -> &'static FabricMetrics
Access the global metrics instance.