Skip to main content

reifydb_profiler/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4//! Always-on profiler primitives. Builds on `tracing` to capture per-scope span records without allocating on the hot
5//! path. `ProfilerLayer` is a `tracing_subscriber::Layer` that intercepts spans matching a curated set of
6//! `ProfilerCategory` prefixes, extracts numeric fields through reusable thread-local visitors, and appends a
7//! fixed-size `MinimalSpanRecord` to scope-local state. `ProfilerScope::start` opens a scope; `ScopeHandle::finish`
8//! drains the accumulated records, builds a `ProfilerSummary` for the caller, and hands the batch to a `ProfilerSink`
9//! for downstream delivery (in production this is `sub-profiler`'s EventBus bridge).
10//!
11//! This crate stays free of any metric or IoC dependency so the layer can be embedded in tests with a `NoopSink` and
12//! so the rest of the workspace can use the data model without pulling in the subsystem.
13
14#![cfg_attr(not(debug_assertions), deny(clippy::disallowed_methods))]
15#![cfg_attr(debug_assertions, warn(clippy::disallowed_methods))]
16#![cfg_attr(not(debug_assertions), deny(warnings))]
17#![allow(clippy::tabs_in_doc_comments)]
18
19pub mod callsite;
20pub mod category;
21pub mod event;
22pub mod format;
23pub mod intern;
24pub mod layer;
25pub mod percentile;
26pub mod record;
27pub mod scope;
28pub mod sink;
29pub mod summary;
30pub mod visit;