Skip to content

Commit

Permalink
fix(iroh-net): better logging for pkarr publish (#2208)
Browse files Browse the repository at this point in the history
## Description

log the info we publish to pkarr, and a span for identification in tests
  • Loading branch information
Frando authored Apr 18, 2024
1 parent 6d36d00 commit 0f624cc
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions iroh-net/src/discovery/pkarr_publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tokio::{
task::JoinHandle,
time::{Duration, Instant},
};
use tracing::{debug, info, warn};
use tracing::{debug, error_span, info, warn, Instrument};
use url::Url;
use watchable::{Watchable, Watcher};

Expand Down Expand Up @@ -69,7 +69,11 @@ impl PkarrPublisher {
pkarr_client,
republish_interval,
};
let join_handle = tokio::task::spawn(service.run());
let join_handle = tokio::task::spawn(
service
.run()
.instrument(error_span!("pkarr_publish", me=%node_id.fmt_short())),
);
Self {
watchable,
node_id,
Expand Down Expand Up @@ -153,7 +157,13 @@ impl PublisherService {
}

async fn publish_current(&self, info: NodeInfo) -> Result<()> {
info!("Publish node info to pkarr");
info!(
relay_url = ?info
.relay_url
.as_ref()
.map(|s| s.as_str()),
"Publish node info to pkarr"
);
let signed_packet = info.to_pkarr_signed_packet(&self.secret_key, self.ttl)?;
self.pkarr_client.publish(&signed_packet).await?;
Ok(())
Expand Down

0 comments on commit 0f624cc

Please sign in to comment.