aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-18 20:23:10 +0100
committerAlex Auvolat <alex@adnab.me>2022-02-18 20:23:10 +0100
commit109d6c143d01b2d59027d45738692fa8ef6253ee (patch)
treee3b34aa1e68e9b03d0ec79e8e2d8008b6e3559e8 /src
parentfb6b4dc9a95f4268775e674323a2b84c7b4ae7f0 (diff)
downloadnetapp-109d6c143d01b2d59027d45738692fa8ef6253ee.tar.gz
netapp-109d6c143d01b2d59027d45738692fa8ef6253ee.zip
Add length of query to span
Diffstat (limited to 'src')
-rw-r--r--src/client.rs8
-rw-r--r--src/server.rs1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/client.rs b/src/client.rs
index e08b30b..d6caf68 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -14,7 +14,7 @@ use tokio_util::compat::*;
#[cfg(feature = "telemetry")]
use opentelemetry::{
trace::{FutureExt, Span, SpanKind, TraceContextExt, Tracer},
- Context,
+ Context, KeyValue,
};
#[cfg(feature = "telemetry")]
use opentelemetry_contrib::trace::propagator::binary::*;
@@ -136,7 +136,7 @@ impl ClientConn {
cfg_if::cfg_if! {
if #[cfg(feature = "telemetry")] {
let tracer = opentelemetry::global::tracer("netapp");
- let span = tracer.span_builder(format!("RPC >> {}", path))
+ let mut span = tracer.span_builder(format!("RPC >> {}", path))
.with_kind(SpanKind::Server)
.start(&tracer);
let propagator = BinaryPropagator::new();
@@ -174,6 +174,10 @@ impl ClientConn {
}
trace!("request: query_send {}, {} bytes", id, bytes.len());
+
+ #[cfg(feature = "telemetry")]
+ span.set_attribute(KeyValue::new("len_query", bytes.len() as i64));
+
query_send.send((id, prio, bytes))?;
cfg_if::cfg_if! {
diff --git a/src/server.rs b/src/server.rs
index 8b60e17..7bf17df 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -161,6 +161,7 @@ impl ServerConn {
.start(&tracer)
};
span.set_attribute(KeyValue::new("path", path.to_string()));
+ span.set_attribute(KeyValue::new("len_query", data.len() as i64));
handler.handle(data, self.peer_id)
.with_context(Context::current_with_span(span))