From d5342264b82a59657b91c39760d646c625019dde Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Tue, 21 Nov 2023 11:21:14 +0100 Subject: [PATCH] record error on span::error (#140) --- src/extensions/client/mod.rs | 6 +++--- src/middlewares/mod.rs | 1 + src/server.rs | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/extensions/client/mod.rs b/src/extensions/client/mod.rs index 9213e9e..9a9ad0b 100644 --- a/src/extensions/client/mod.rs +++ b/src/extensions/client/mod.rs @@ -399,6 +399,7 @@ impl Client { } Err(err) => { span.set_status(opentelemetry::trace::Status::error(err.to_string())); + span.record_error(&err); } }); @@ -434,9 +435,8 @@ impl Client { span.set_status(opentelemetry::trace::Status::Ok); } Err(err) => { - span.set_status(opentelemetry::trace::Status::Error { - description: std::borrow::Cow::from(err.to_string()), - }); + span.set_status(opentelemetry::trace::Status::error(err.to_string())); + span.record_error(&err); } }); diff --git a/src/middlewares/mod.rs b/src/middlewares/mod.rs index 64ff9e9..52461f0 100644 --- a/src/middlewares/mod.rs +++ b/src/middlewares/mod.rs @@ -156,6 +156,7 @@ impl Middlewares anyhow::Result { } Err(err) => { span.set_status(opentelemetry::trace::Status::error(err.to_string())); + span.record_error(&err); } }); @@ -168,6 +169,7 @@ pub async fn build(config: Config) -> anyhow::Result { } Err(err) => { span.set_status(opentelemetry::trace::Status::error(format!("{:?}", err))); + span.record_error(&jsonrpsee::core::Error::Custom(format!("{:?}", err))); } });