Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vastly reduce the number of traces sent #80

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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