From 2792f5075dca1296e3456c9fe2b9d4063b2c5bbe Mon Sep 17 00:00:00 2001 From: "Aode (Lion)" Date: Tue, 21 Sep 2021 11:21:06 -0500 Subject: [PATCH] Enable tracing AWC --- Cargo.lock | 22 +++++++++++++++++++--- Cargo.toml | 5 +++-- src/requests.rs | 10 +++++++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 55d23b4..69ff7a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1023,9 +1023,9 @@ dependencies = [ [[package]] name = "http-signature-normalization-actix" -version = "0.5.0-beta.8" +version = "0.5.0-beta.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a7b8fe1ff48e38857dfb8915a4ca54c02ca8f74ac646f01bb78d0d62533c5c" +checksum = "8543f90115f95ed9f2380f818297f3aa47dadbc9ca5b9d232fa81bbb3fa70702" dependencies = [ "actix-web", "awc", @@ -1941,7 +1941,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "relay" -version = "0.3.0" +version = "0.3.2" dependencies = [ "activitystreams", "activitystreams-ext", @@ -1977,6 +1977,7 @@ dependencies = [ "toml", "tracing", "tracing-actix-web", + "tracing-awc", "tracing-error", "tracing-futures", "tracing-log", @@ -2812,6 +2813,21 @@ dependencies = [ "syn", ] +[[package]] +name = "tracing-awc" +version = "0.1.0-beta.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97e7ee4c4b5414ec091e5d6be8194f87c680332f549dd2a73e4c506d0a9b84a" +dependencies = [ + "actix-http", + "awc", + "bytes", + "futures-core", + "serde 1.0.130", + "tracing", + "tracing-futures", +] + [[package]] name = "tracing-core" version = "0.1.20" diff --git a/Cargo.toml b/Cargo.toml index d9642e6..20b3dba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "relay" description = "A simple activitypub relay" -version = "0.3.1" +version = "0.3.2" authors = ["asonix "] license-file = "LICENSE" readme = "README.md" @@ -42,6 +42,7 @@ sled = "0.34.6" structopt = "0.3.12" thiserror = "1.0" tracing = "0.1" +tracing-awc = "0.1.0-beta.4" tracing-error = "0.1" tracing-futures = "0.2" tracing-log = "0.1" @@ -58,7 +59,7 @@ features = [ ] [dependencies.http-signature-normalization-actix] -version = "0.5.0-beta.8" +version = "0.5.0-beta.9" default-features = false features = ["sha-2"] diff --git a/src/requests.rs b/src/requests.rs index bf8a638..216195c 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -19,6 +19,7 @@ use std::{ time::SystemTime, }; use tracing::{debug, info, warn}; +use tracing_awc::Propagate; #[derive(Clone)] pub(crate) struct Breakers { @@ -250,6 +251,7 @@ impl Requests { move |signing_string| signer.sign(signing_string), ) .await? + .propagate() .send() .await; @@ -307,6 +309,7 @@ impl Requests { move |signing_string| signer.sign(signing_string), ) .await? + .propagate() .send() .await; @@ -367,7 +370,7 @@ impl Requests { let item_string = serde_json::to_string(item)?; let client: Client = self.client.borrow().clone(); - let res = client + let (req, body) = client .post(inbox.as_str()) .insert_header(("Accept", "application/activity+json")) .insert_header(("Content-Type", "application/activity+json")) @@ -380,8 +383,9 @@ impl Requests { move |signing_string| signer.sign(signing_string), ) .await? - .send() - .await; + .split(); + + let res = req.propagate().send_body(body).await; if res.is_err() { self.count_err();