Skip to content

Commit

Permalink
vastly reduce the number of traces sent (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn authored Oct 22, 2023
1 parent 622c343 commit 3e46d71
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions crates/corro-agent/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tokio::{
sync::{mpsc, Mutex, RwLock},
time::error::Elapsed,
};
use tracing::{debug, info_span, warn, Instrument};
use tracing::{debug, debug_span, warn, Instrument};

use crate::api::peer::gossip_client_endpoint;

Expand Down Expand Up @@ -95,7 +95,7 @@ impl Transport {

let mut stream = match conn
.open_uni()
.instrument(info_span!("quic_open_uni"))
.instrument(debug_span!("quic_open_uni"))
.await
{
Ok(stream) => stream,
Expand All @@ -106,31 +106,31 @@ impl Transport {
debug!("retryable error attempting to open unidirectional stream: {e}");
let conn = self.connect(addr).await?;
conn.open_uni()
.instrument(info_span!("quic_open_uni"))
.instrument(debug_span!("quic_open_uni"))
.await?
}
};

stream
.write_chunk(data)
.instrument(info_span!("quic_write_chunk"))
.instrument(debug_span!("quic_write_chunk"))
.await?;

stream
.finish()
.instrument(info_span!("quic_finish"))
.instrument(debug_span!("quic_finish"))
.await?;

Ok(())
}

#[tracing::instrument(skip(self), err)]
#[tracing::instrument(skip(self), level = "debug", err)]
pub async fn open_bi(
&self,
addr: SocketAddr,
) -> Result<(SendStream, RecvStream), TransportError> {
let conn = self.connect(addr).await?;
match conn.open_bi().instrument(info_span!("quic_open_bi")).await {
match conn.open_bi().instrument(debug_span!("quic_open_bi")).await {
Ok(send_recv) => return Ok(send_recv),
Err(e @ ConnectionError::VersionMismatch) => {
return Err(e.into());
Expand All @@ -144,7 +144,7 @@ impl Transport {
let conn = self.connect(addr).await?;
Ok(conn
.open_bi()
.instrument(info_span!("quic_open_bi"))
.instrument(debug_span!("quic_open_bi"))
.await?)
}

Expand Down Expand Up @@ -183,7 +183,7 @@ impl Transport {
Err(e.into())
}
}
}.instrument(info_span!("quic_connect", %addr, rtt = tracing::field::Empty)).await
}.instrument(debug_span!("quic_connect", %addr, rtt = tracing::field::Empty)).await
}

// this shouldn't block for long...
Expand Down
6 changes: 3 additions & 3 deletions crates/corro-types/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,19 @@ impl SplitPool {
}

// get a high priority write connection (e.g. client input)
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), level = "debug")]
pub async fn write_priority(&self) -> Result<WriteConn, PoolError> {
self.write_inner(&self.0.priority_tx, "priority").await
}

// get a normal priority write connection (e.g. sync process)
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), level = "debug")]
pub async fn write_normal(&self) -> Result<WriteConn, PoolError> {
self.write_inner(&self.0.normal_tx, "normal").await
}

// get a low priority write connection (e.g. background tasks)
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self), level = "debug")]
pub async fn write_low(&self) -> Result<WriteConn, PoolError> {
self.write_inner(&self.0.low_tx, "low").await
}
Expand Down
2 changes: 1 addition & 1 deletion crates/corro-types/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl From<SyncStateV1> for SyncMessage {
}

// generates a `SyncMessage` to tell another node what versions we're missing
#[tracing::instrument(skip_all)]
#[tracing::instrument(skip_all, level = "debug")]
pub async fn generate_sync(bookie: &Bookie, actor_id: ActorId) -> SyncStateV1 {
let mut state = SyncStateV1 {
actor_id,
Expand Down

0 comments on commit 3e46d71

Please sign in to comment.