From e21ba0f650b765b672f07b2d94b67f1407bfb176 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sat, 1 Jul 2023 23:11:27 +0200 Subject: [PATCH] add a test function to reqwest spans --- Cargo.toml | 3 +++ src/main.rs | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 56de612..ee5bc04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,6 @@ tracing-subscriber = "0.3" serde = { version = "1.0", features=["derive", "default"] } serde_json = "1.0" + +reqwest = "0.11" +tokio = { version = "1.29", features=["macros", "rt", "default", "tracing", "rt-multi-thread"] } diff --git a/src/main.rs b/src/main.rs index 52e3222..cd09c34 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,12 +8,22 @@ use tracing_subscriber::Registry; use appmap_tracing_test::appmap_definition::*; use appmap_tracing_test::*; +use reqwest; -pub fn main() -> Result<(), Box> { +#[tokio::main] +pub async fn main() -> Result<(), Box> { init_tracing(); sample_json()?; test_sub_mod(); + test_reqwest(true).await?; + Ok(()) +} + +#[instrument] +async fn test_reqwest(test_param: bool) -> Result<(), Box> { + let result = reqwest::get("http://google.com").await?; + println!("result: {:?}", result); Ok(()) }