Skip to main content

sentinel_core/
lib.rs

1//! sentinel-core: core library for perf-sentinel.
2//!
3//! Provides the analysis pipeline for detecting performance anti-patterns
4//! in runtime traces (SQL queries, HTTP calls).
5
6// This crate contains no `unsafe` code and is meant to stay that way: the
7// analysis pipeline is pure data processing. `forbid` (not `deny`) so the
8// guarantee cannot be locally overridden by an inner `allow`. The single
9// `unsafe` FFI call in the workspace (libc::getrusage) lives in the CLI
10// crate, where it is isolated and documented with its SAFETY invariants.
11#![forbid(unsafe_code)]
12#![warn(clippy::pedantic)]
13#![allow(clippy::cast_possible_truncation)] // u128 -> u64 for elapsed_ms
14#![allow(clippy::cast_precision_loss)] // usize -> f64 for ratios
15#![allow(clippy::similar_names)] // min_ts/min_ms, max_ts/max_ms are clear
16
17pub mod acknowledgments;
18pub mod calibrate;
19pub mod config;
20pub mod correlate;
21#[cfg(feature = "daemon")]
22pub mod daemon;
23pub mod detect;
24pub mod diff;
25pub mod event;
26pub mod explain;
27#[cfg(any(feature = "daemon", feature = "tempo"))]
28pub mod http_client;
29pub mod ingest;
30pub mod normalize;
31pub mod pipeline;
32pub mod quality_gate;
33pub mod report;
34pub mod score;
35#[cfg(any(feature = "daemon", feature = "tempo"))]
36pub(crate) mod shutdown;
37// Hidden: benchmark and fixture tooling, not a supported library API.
38#[doc(hidden)]
39pub mod synth;
40pub mod text_safety;
41pub(crate) mod time;
42
43#[cfg(test)]
44pub(crate) mod test_helpers;
45
46// Re-export the interpretation helper so the CLI and downstream consumers
47// can write `sentinel_core::InterpretationLevel::for_iis(...)` without
48// having to know it lives under `report::interpret::`.
49pub use report::interpret::InterpretationLevel;
50
51// Re-export the daemon error types for consistency with `InterpretationLevel`.
52// Downstream consumers (the CLI, any library user) can now write
53// `sentinel_core::DaemonError` / `sentinel_core::TlsConfigError` without
54// having to know the module structure. Gated on `daemon` since the daemon
55// module itself is gated.
56#[cfg(feature = "daemon")]
57pub use daemon::{DaemonError, TlsConfigError};