simplify tracing

This commit is contained in:
John Smith
2023-06-24 22:59:51 -04:00
parent c8fdded5a7
commit 234f048241
38 changed files with 197 additions and 114 deletions

View File

@@ -518,7 +518,10 @@ impl RoutingTable {
}
/// Look up the best way for two nodes to reach each other over a specific routing domain
#[instrument(level = "trace", skip(self), ret)]
#[cfg_attr(
feature = "verbose-tracing",
instrument(level = "trace", skip(self), ret)
)]
pub fn get_contact_method(
&self,
routing_domain: RoutingDomain,
@@ -1028,7 +1031,7 @@ impl RoutingTable {
.sort_and_clean_closest_noderefs(node_id, closest_nodes)
}
#[instrument(level = "trace", skip(self), ret)]
#[instrument(level = "trace", skip(self, peers), ret)]
pub fn register_find_node_answer(
&self,
crypto_kind: CryptoKind,

View File

@@ -533,7 +533,7 @@ impl RouteSpecStore {
}
/// validate data using a private route's key and signature chain
#[instrument(level = "trace", skip(self, data, callback), ret)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self, data, callback), ret))]
pub fn with_signature_validated_route<F,R>(
&self,
public_key: &TypedKey,
@@ -593,7 +593,7 @@ impl RouteSpecStore {
Some(callback(rssd, rsd))
}
#[instrument(level = "trace", skip(self), ret, err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self), ret, err))]
async fn test_allocated_route(&self, private_route_id: RouteId) -> EyreResult<bool> {
// Make loopback route to test with
let dest = {
@@ -716,7 +716,7 @@ impl RouteSpecStore {
}
/// Test an allocated route for continuity
#[instrument(level = "trace", skip(self), ret, err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self), ret, err))]
pub async fn test_route(&self, id: RouteId) -> EyreResult<bool> {
let is_remote = self.is_route_id_remote(&id);
if is_remote {
@@ -1083,7 +1083,7 @@ impl RouteSpecStore {
}
/// Get an allocated route that matches a particular safety spec
#[instrument(level = "trace", skip(self, inner, rti), ret, err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self, inner, rti), ret, err))]
fn get_route_for_safety_spec_inner(
&self,
inner: &mut RouteSpecStoreInner,
@@ -1154,7 +1154,7 @@ impl RouteSpecStore {
}
/// Get a private route to use for the answer to question
#[instrument(level = "trace", skip(self), ret, err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self), ret, err))]
pub fn get_private_route_for_safety_spec(
&self,
crypto_kind: CryptoKind,
@@ -1263,7 +1263,7 @@ impl RouteSpecStore {
/// Assemble a single private route for publication
/// Returns a PrivateRoute object for an allocated private route key
#[instrument(level = "trace", skip(self), err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self), err))]
pub fn assemble_private_route(
&self,
key: &PublicKey,
@@ -1290,7 +1290,7 @@ impl RouteSpecStore {
/// Assemble private route set for publication
/// Returns a vec of PrivateRoute objects for an allocated private route
#[instrument(level = "trace", skip(self), err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self), err))]
pub fn assemble_private_routes(
&self,
id: &RouteId,
@@ -1316,7 +1316,7 @@ impl RouteSpecStore {
/// Import a remote private route for compilation
/// It is safe to import the same route more than once and it will return the same route id
/// Returns a route set id
#[instrument(level = "trace", skip(self, blob), ret, err)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self, blob), ret, err))]
pub fn import_remote_private_route(&self, blob: Vec<u8>) -> EyreResult<RouteId> {
let cur_ts = get_aligned_timestamp();
@@ -1347,7 +1347,7 @@ impl RouteSpecStore {
}
/// Release a remote private route that is no longer in use
#[instrument(level = "trace", skip(self), ret)]
#[cfg_attr(feature="verbose-tracing", instrument(level = "trace", skip(self), ret))]
pub fn release_remote_private_route(&self, id: RouteId) -> bool {
let inner = &mut *self.inner.lock();
inner.cache.remove_remote_private_route(id)

View File

@@ -207,7 +207,10 @@ impl RoutingTableInner {
true
}
#[instrument(level = "trace", skip(self), ret)]
#[cfg_attr(
feature = "verbose-tracing",
instrument(level = "trace", skip(self), ret)
)]
pub fn get_contact_method(
&self,
routing_domain: RoutingDomain,