near_async/instrumentation/
mod.rs

1use near_time::Clock;
2
3use crate::instrumentation::{data::ALL_ACTOR_INSTRUMENTATIONS, reader::InstrumentedThreadsView};
4
5pub(crate) mod data;
6mod instrumented_window;
7mod metrics;
8pub mod queue;
9pub mod reader;
10#[cfg(test)]
11pub(crate) mod test_utils;
12#[cfg(feature = "actor_instrumentation_testing")]
13pub mod testing;
14#[cfg(test)]
15mod tests;
16pub(crate) mod writer;
17
18pub use data::InstrumentedThread;
19pub use writer::InstrumentedThreadWriter;
20pub use writer::InstrumentedThreadWriterSharedPart;
21
22/// Window size. Windows are aligned to whole multiples of this size since UNIX epoch,
23/// regardless of when the actor thread started.
24pub const WINDOW_SIZE_NS: u64 = 500_000_000; // 500ms
25/// Number of most recent windows to maintain stats for.
26const NUM_WINDOWS: usize = 60; // keep stats for the last 30 seconds
27
28pub fn all_actor_instrumentations_view(clock: &Clock) -> InstrumentedThreadsView {
29    ALL_ACTOR_INSTRUMENTATIONS.to_view(clock)
30}