Skip to main content

Module layer

Module layer 

Source
Expand description

Tracing subscriber layer that captures fraiseql::mutation_audit events.

Install this layer alongside your normal subscriber to automatically feed the UsageAggregator from every mutation executed by the runtime:

ⓘ
use std::sync::Arc;
use tracing_subscriber::{layer::SubscriberExt, Registry};
use fraiseql_server::usage::{aggregator::UsageAggregator, layer::MutationAuditLayer};

let aggregator = Arc::new(UsageAggregator::new());
let subscriber = Registry::default()
    .with(MutationAuditLayer::new(Arc::clone(&aggregator)));
tracing::subscriber::set_global_default(subscriber).unwrap();

Structs§

MutationAuditLayer
Tracing Layer that feeds UsageAggregator from mutation audit events.