Skip to main content

ResourceTracker

Struct ResourceTracker 

Source
pub(crate) struct ResourceTracker {
Show 19 fields pub(crate) config: Config, pub(crate) out_file: Option<BufWriter<File>>, pub(crate) interval: Duration, pub(crate) cpu: CpuCollector, pub(crate) memory: MemoryCollector, pub(crate) network: NetworkCollector, pub(crate) disk: DiskCollector, pub(crate) gpu: GpuCollector, pub(crate) host_info: HostInfo, pub(crate) cloud_info: Option<CloudInfo>, pub(crate) cloud_rx: Option<Receiver<CloudInfo>>, pub(crate) child: Option<Child>, pub(crate) sentinel: Option<SentinelClient>, pub(crate) run_ctx_arc: Option<Arc<Mutex<RunContext>>>, pub(crate) sample_buffer: Option<Arc<Mutex<Vec<Sample>>>>, pub(crate) upload_shutdown_flag: Option<Arc<AtomicBool>>, pub(crate) upload_handle: Option<JoinHandle<Vec<String>>>, pub(crate) unflushed: Vec<Sample>, pub(crate) prev_loop_start: Option<Instant>,
}

Fields§

§config: Config§out_file: Option<BufWriter<File>>§interval: Duration§cpu: CpuCollector§memory: MemoryCollector§network: NetworkCollector§disk: DiskCollector§gpu: GpuCollector§host_info: HostInfo§cloud_info: Option<CloudInfo>§cloud_rx: Option<Receiver<CloudInfo>>§child: Option<Child>§sentinel: Option<SentinelClient>§run_ctx_arc: Option<Arc<Mutex<RunContext>>>§sample_buffer: Option<Arc<Mutex<Vec<Sample>>>>§upload_shutdown_flag: Option<Arc<AtomicBool>>§upload_handle: Option<JoinHandle<Vec<String>>>§unflushed: Vec<Sample>§prev_loop_start: Option<Instant>

Implementations§

Source§

impl ResourceTracker

Source

pub(crate) fn new() -> Self

Source

pub(crate) fn warmup_collectors(&mut self)

Source

pub(crate) fn spawn_tracked_command(&mut self)

Source

pub(crate) fn mask_sensitive_data_in_command(&mut self)

Source

pub(crate) fn try_redact(raw: &str) -> Option<String>

Source

pub(crate) fn mask_first_word(raw: &str, mask: &str) -> Option<String>

Source

pub(crate) fn setup_sentinel(&mut self)

Source

pub(crate) fn emit_csv_header(&mut self)

Source

pub(crate) fn renice_tracker(&self)

Source

pub(crate) fn poll_cloud_info(&mut self)

Source

pub(crate) fn collect_sample(&mut self) -> Sample

Source

pub(crate) fn emit_sample(&mut self, sample: &Sample)

Source

pub(crate) fn buffer_sample(&mut self, sample: Sample)

Source

pub(crate) fn check_child_exit(&mut self) -> Option<i32>

Source

pub(crate) fn check_signal(&self) -> bool

Source

pub(crate) fn sleep_until_next_interval(&self, loop_start: Instant)

Source

pub(crate) fn shutdown(&mut self, exit_code: i32) -> !

Source

pub(crate) fn run(self) -> !

Source

pub(crate) fn create_sink(config: &Config) -> Option<BufWriter<File>>

Source

pub(crate) fn graceful_shutdown( exit_code: i32, sentinel: Option<&SentinelClient>, run_ctx: Option<Arc<Mutex<RunContext>>>, shutdown_flag: Option<Arc<AtomicBool>>, upload_handle: Option<JoinHandle<Vec<String>>>, remaining: Vec<Sample>, interval_secs: u64, ) -> !

Source

pub(crate) fn emit_metric_line( config: &Config, out_file: &mut Option<BufWriter<File>>, msg: &str, )

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.