1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Dynamic tracing system that tends to be real-time.

#![warn(missing_docs)]

mod config;
mod env;
mod supervisor;
mod tracers;

pub use rill;
pub use rill_export;
pub use rill_protocol as protocol;
pub use tracers::*;

use anyhow::Error;
use meio::thread::ScopedRuntime;

/// The tracer.
pub struct RillRate {
    _scoped: ScopedRuntime,
}

impl RillRate {
    /// Creates an instance of `RillRate` tracer using environment vars.
    pub fn from_env(app_name: impl ToString) -> Result<Self, Error> {
        use supervisor::RillRate;
        let actor = RillRate::new(app_name.to_string());
        let _scoped = meio::thread::spawn(actor)?;
        Ok(Self { _scoped })
    }
}