pub struct TelemetryBuilder {}Expand description
Builder for configuring telemetry
Implementations§
Source§impl TelemetryBuilder
impl TelemetryBuilder
Sourcepub fn service_name(self, _name: impl Into<String>) -> Self
pub fn service_name(self, _name: impl Into<String>) -> Self
Set the service name
Examples found in repository?
examples/basic.rs (line 45)
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}Sourcepub fn init(self) -> Result<TelemetryGuard, TelemetryError>
pub fn init(self) -> Result<TelemetryGuard, TelemetryError>
Initialize telemetry (placeholder)
§Errors
Currently returns Ok(()), but will return errors for invalid configuration in future versions.
Examples found in repository?
examples/basic.rs (line 46)
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}Trait Implementations§
Auto Trait Implementations§
impl Freeze for TelemetryBuilder
impl RefUnwindSafe for TelemetryBuilder
impl Send for TelemetryBuilder
impl Sync for TelemetryBuilder
impl Unpin for TelemetryBuilder
impl UnwindSafe for TelemetryBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more