init

Function init 

Source
pub fn init() -> TelemetryBuilder
Expand description

Initialize telemetry for your application

§Example

use telemetry_kit::prelude::*;

let _guard = telemetry_kit::init()
    .service_name("my-app")
    .init();
Examples found in repository?
examples/basic.rs (line 44)
10fn main() {
11    println!("telemetry-kit v{}", env!("CARGO_PKG_VERSION"));
12    println!();
13    println!("This is a placeholder example.");
14    println!("The actual implementation is under development.");
15    println!();
16    
17    // This is how it will work in v0.1.0+:
18    println!("Example of planned API:");
19    println!();
20    println!(r#"
21    use telemetry_kit::prelude::*;
22
23    #[tokio::main]
24    async fn main() -> Result<(), Box<dyn std::error::Error>> {{
25        let _guard = telemetry_kit::init()
26            .service_name("my-app")
27            .endpoint("https://telemetry.myapp.com")
28            .anonymous()
29            .init()?;
30        
31        do_work().await?;
32        
33        Ok(())
34    }}
35
36    #[instrument]
37    async fn do_work() -> Result<(), Box<dyn std::error::Error>> {{
38        // Your code here - automatically instrumented!
39        Ok(())
40    }}
41    "#);
42    
43    // Current minimal implementation:
44    let _guard = telemetry_kit::init()
45        .service_name("basic-example")
46        .init();
47    
48    println!();
49    println!("✓ Basic initialization successful (placeholder)");
50}