fix traces

This commit is contained in:
John Smith 2023-06-24 20:29:36 -04:00
parent c8624a73a2
commit b1df2c9d2d
5 changed files with 40 additions and 4 deletions

View File

@ -3,7 +3,7 @@ use super::*;
impl RPCProcessor {
// Sends a high level app request and wait for response
// Can be sent via all methods including relays and routes
#[instrument(level = "trace", skip(self, message), ret, err)]
#[instrument(level = "trace", skip(self, message), fields(message.len = message.len(), ret.latency, ret.len), err)]
pub async fn rpc_call_app_call(
self,
dest: Destination,
@ -38,6 +38,8 @@ impl RPCProcessor {
let a_message = app_call_a.destructure();
tracing::Span::current().record("ret.latency", latency.as_u64());
tracing::Span::current().record("ret.len", a_message.len());
Ok(NetworkResult::value(Answer::new(latency, a_message)))
}

View File

@ -3,7 +3,7 @@ use super::*;
impl RPCProcessor {
// Sends a high level app message
// Can be sent via all methods including relays and routes
#[instrument(level = "trace", skip(self, message), ret, err)]
#[instrument(level = "trace", skip(self, message), fields(message.len = message.len()), err)]
pub async fn rpc_call_app_message(
self,
dest: Destination,

View File

@ -7,7 +7,7 @@ impl RPCProcessor {
/// Because this leaks information about the identity of the node itself,
/// replying to this request received over a private route will leak
/// the identity of the node and defeat the private route.
#[instrument(level = "trace", skip(self), ret, err)]
#[instrument(level = "trace", skip(self), err)]
pub async fn rpc_call_find_node(
self,
dest: Destination,

View File

@ -15,7 +15,13 @@ impl RPCProcessor {
/// Because this leaks information about the identity of the node itself,
/// replying to this request received over a private route will leak
/// the identity of the node and defeat the private route.
#[instrument(level = "trace", skip(self), ret, err)]
#[instrument(level = "trace", skip(self, last_descriptor),
fields(ret.value.data.len,
ret.value.data.seq,
ret.value.data.writer,
ret.peers.len,
ret.latency
),err)]
pub async fn rpc_call_get_value(
self,
dest: Destination,
@ -101,6 +107,14 @@ impl RPCProcessor {
return Ok(NetworkResult::invalid_message("non-closer peers returned"));
}
tracing::Span::current().record("ret.latency", latency.as_u64());
if let Some(value) = &value {
tracing::Span::current().record("ret.value.data.len", value.value_data().data().len());
tracing::Span::current().record("ret.value.data.seq", value.value_data().seq());
tracing::Span::current().record("ret.value.data.writer", value.value_data().writer().to_string());
}
tracing::Span::current().record("ret.peers.len", peers.len());
Ok(NetworkResult::value(Answer::new(
latency,
GetValueAnswer {

View File

@ -14,6 +14,17 @@ impl RPCProcessor {
/// Because this leaks information about the identity of the node itself,
/// replying to this request received over a private route will leak
/// the identity of the node and defeat the private route.
#[instrument(level = "trace", skip(self, value, descriptor),
fields(value.data.len = value.value_data().data().len(),
value.data.seq = value.value_data().seq(),
value.data.writer = value.value_data().writer().to_string(),
ret.set,
ret.value.data.len,
ret.value.data.seq,
ret.value.data.writer,
ret.peers.len,
ret.latency
), err)]
pub async fn rpc_call_set_value(
self,
dest: Destination,
@ -107,6 +118,15 @@ impl RPCProcessor {
return Ok(NetworkResult::invalid_message("non-closer peers returned"));
}
tracing::Span::current().record("ret.latency", latency.as_u64());
tracing::Span::current().record("ret.set", set);
if let Some(value) = &value {
tracing::Span::current().record("ret.value.data.len", value.value_data().data().len());
tracing::Span::current().record("ret.value.data.seq", value.value_data().seq());
tracing::Span::current().record("ret.value.data.writer", value.value_data().writer().to_string());
}
tracing::Span::current().record("ret.peers.len", peers.len());
Ok(NetworkResult::value(Answer::new(
latency,
SetValueAnswer { set, value, peers },