forked from lx/netapp
Add length of query to span
This commit is contained in:
parent
fb6b4dc9a9
commit
109d6c143d
2 changed files with 7 additions and 2 deletions
|
@ -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! {
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue