mirror of https://github.com/LemmyNet/lemmy.git
Propogate span information to blocking operations
parent
8aa0041b3d
commit
8b170096f1
|
@ -1779,6 +1779,7 @@ dependencies = [
|
|||
"lemmy_utils",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
|
|
@ -23,4 +23,5 @@ diesel = "1.4.8"
|
|||
actix-web = { version = "4.0.0-beta.9", default-features = false, features = ["cookies"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
serde_json = { version = "1.0.68", features = ["preserve_order"] }
|
||||
tracing = "0.1.29"
|
||||
url = "2.2.2"
|
||||
|
|
|
@ -32,9 +32,12 @@ where
|
|||
T: Send + 'static,
|
||||
{
|
||||
let pool = pool.clone();
|
||||
let blocking_span = tracing::info_span!("blocking operation");
|
||||
let res = actix_web::web::block(move || {
|
||||
let entered = blocking_span.enter();
|
||||
let conn = pool.get()?;
|
||||
let res = (f)(&conn);
|
||||
drop(entered);
|
||||
Ok(res) as Result<T, LemmyError>
|
||||
})
|
||||
.await?;
|
||||
|
|
Loading…
Reference in New Issue