Enable tracing AWC

This commit is contained in:
Aode (Lion) 2021-09-21 11:21:06 -05:00
parent 37d197b8dc
commit 2792f5075d
3 changed files with 29 additions and 8 deletions

22
Cargo.lock generated
View file

@ -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"

View file

@ -1,7 +1,7 @@
[package]
name = "relay"
description = "A simple activitypub relay"
version = "0.3.1"
version = "0.3.2"
authors = ["asonix <asonix@asonix.dog>"]
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"]

View file

@ -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();