Skip to main content

init_telemetry

Function init_telemetry 

Source
pub fn init_telemetry()
Expand description

Initializes the telemetry system.

Examples found in repository?
examples/usage_example.rs (line 64)
58async fn run_client() -> Result<(), ServerlessError> {
59    // Initialize logging
60    let config = serverless_fn::config::Config::from_env();
61    config.init_logging();
62
63    // Initialize telemetry if enabled
64    serverless_fn::telemetry::init_telemetry();
65
66    // Call the serverless function as if it were a regular function
67    let posts = read_posts(3, "my search".to_string()).await?;
68    println!("Retrieved {} posts", posts.len());
69
70    for post in &posts {
71        println!("Post {}: {}", post.id, post.title);
72    }
73
74    // Call another function
75    let new_post =
76        create_post("New Post Title".to_string(), "New Post Content".to_string()).await?;
77
78    println!("Created post: {}", new_post.title);
79
80    Ok(())
81}