forked from mirrors/relay
Enable tracing AWC
This commit is contained in:
parent
37d197b8dc
commit
2792f5075d
3 changed files with 29 additions and 8 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -1023,9 +1023,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-signature-normalization-actix"
|
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"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41a7b8fe1ff48e38857dfb8915a4ca54c02ca8f74ac646f01bb78d0d62533c5c"
|
checksum = "8543f90115f95ed9f2380f818297f3aa47dadbc9ca5b9d232fa81bbb3fa70702"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"awc",
|
"awc",
|
||||||
|
@ -1941,7 +1941,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "relay"
|
name = "relay"
|
||||||
version = "0.3.0"
|
version = "0.3.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitystreams",
|
"activitystreams",
|
||||||
"activitystreams-ext",
|
"activitystreams-ext",
|
||||||
|
@ -1977,6 +1977,7 @@ dependencies = [
|
||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-actix-web",
|
"tracing-actix-web",
|
||||||
|
"tracing-awc",
|
||||||
"tracing-error",
|
"tracing-error",
|
||||||
"tracing-futures",
|
"tracing-futures",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
|
@ -2812,6 +2813,21 @@ dependencies = [
|
||||||
"syn",
|
"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]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.20"
|
version = "0.1.20"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "relay"
|
name = "relay"
|
||||||
description = "A simple activitypub relay"
|
description = "A simple activitypub relay"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
license-file = "LICENSE"
|
license-file = "LICENSE"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -42,6 +42,7 @@ sled = "0.34.6"
|
||||||
structopt = "0.3.12"
|
structopt = "0.3.12"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
|
tracing-awc = "0.1.0-beta.4"
|
||||||
tracing-error = "0.1"
|
tracing-error = "0.1"
|
||||||
tracing-futures = "0.2"
|
tracing-futures = "0.2"
|
||||||
tracing-log = "0.1"
|
tracing-log = "0.1"
|
||||||
|
@ -58,7 +59,7 @@ features = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies.http-signature-normalization-actix]
|
[dependencies.http-signature-normalization-actix]
|
||||||
version = "0.5.0-beta.8"
|
version = "0.5.0-beta.9"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["sha-2"]
|
features = ["sha-2"]
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ use std::{
|
||||||
time::SystemTime,
|
time::SystemTime,
|
||||||
};
|
};
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{debug, info, warn};
|
||||||
|
use tracing_awc::Propagate;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct Breakers {
|
pub(crate) struct Breakers {
|
||||||
|
@ -250,6 +251,7 @@ impl Requests {
|
||||||
move |signing_string| signer.sign(signing_string),
|
move |signing_string| signer.sign(signing_string),
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
|
.propagate()
|
||||||
.send()
|
.send()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -307,6 +309,7 @@ impl Requests {
|
||||||
move |signing_string| signer.sign(signing_string),
|
move |signing_string| signer.sign(signing_string),
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
|
.propagate()
|
||||||
.send()
|
.send()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -367,7 +370,7 @@ impl Requests {
|
||||||
let item_string = serde_json::to_string(item)?;
|
let item_string = serde_json::to_string(item)?;
|
||||||
|
|
||||||
let client: Client = self.client.borrow().clone();
|
let client: Client = self.client.borrow().clone();
|
||||||
let res = client
|
let (req, body) = client
|
||||||
.post(inbox.as_str())
|
.post(inbox.as_str())
|
||||||
.insert_header(("Accept", "application/activity+json"))
|
.insert_header(("Accept", "application/activity+json"))
|
||||||
.insert_header(("Content-Type", "application/activity+json"))
|
.insert_header(("Content-Type", "application/activity+json"))
|
||||||
|
@ -380,8 +383,9 @@ impl Requests {
|
||||||
move |signing_string| signer.sign(signing_string),
|
move |signing_string| signer.sign(signing_string),
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.send()
|
.split();
|
||||||
.await;
|
|
||||||
|
let res = req.propagate().send_body(body).await;
|
||||||
|
|
||||||
if res.is_err() {
|
if res.is_err() {
|
||||||
self.count_err();
|
self.count_err();
|
||||||
|
|
Loading…
Reference in a new issue