Skip to content

Commit e3a8454

Browse files
committed
Add more instrumentation
1 parent 568a3b0 commit e3a8454

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

linera-core/src/chain_worker/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ where
103103
}
104104

105105
/// Handles a request and applies it to the chain state.
106-
#[instrument(skip_all)]
106+
#[instrument(skip_all, fields(chain_id = %self.chain_id()))]
107107
pub async fn handle_request(&mut self, request: ChainWorkerRequest<StorageClient::Context>) {
108108
tracing::trace!("Handling chain worker request: {request:?}");
109109
// TODO(#2237): Spawn concurrent tasks for read-only operations

linera-service/src/proxy/grpc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ where
303303
}
304304
}
305305

306+
#[instrument(skip_all, fields(remote_addr = ?request.remote_addr(), chain_id = ?request.get_ref().chain_id()))]
306307
fn worker_client<R>(
307308
&self,
308309
request: Request<R>,

linera-storage/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ linera-views.workspace = true
4545
papaya.workspace = true
4646
prometheus.workspace = true
4747
serde.workspace = true
48+
tracing.workspace = true
4849

4950
[dev-dependencies]
5051
anyhow.workspace = true

linera-storage/src/db_storage.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use linera_views::{
2828
ViewError,
2929
};
3030
use serde::{Deserialize, Serialize};
31+
use tracing::instrument;
3132
#[cfg(with_testing)]
3233
use {
3334
futures::channel::oneshot::{self, Receiver},
@@ -544,6 +545,7 @@ where
544545
&self.clock
545546
}
546547

548+
#[instrument(skip_all, fields(chain_id = %chain_id))]
547549
async fn load_chain(
548550
&self,
549551
chain_id: ChainId,
@@ -563,6 +565,7 @@ where
563565
ChainStateView::load(context).await
564566
}
565567

568+
#[instrument(skip_all, fields(blob_id = %blob_id))]
566569
async fn contains_blob(&self, blob_id: BlobId) -> Result<bool, ViewError> {
567570
let store = self.database.open_shared(&[])?;
568571
let blob_key = bcs::to_bytes(&BaseKey::Blob(blob_id))?;
@@ -572,6 +575,7 @@ where
572575
Ok(test)
573576
}
574577

578+
#[instrument(skip_all, fields(blob_count = blob_ids.len()))]
575579
async fn missing_blobs(&self, blob_ids: &[BlobId]) -> Result<Vec<BlobId>, ViewError> {
576580
let store = self.database.open_shared(&[])?;
577581
let mut keys = Vec::new();
@@ -602,6 +606,7 @@ where
602606
Ok(test)
603607
}
604608

609+
#[instrument(skip_all, fields(hash = %hash))]
605610
async fn read_confirmed_block(
606611
&self,
607612
hash: CryptoHash,
@@ -616,6 +621,7 @@ where
616621
Ok(value)
617622
}
618623

624+
#[instrument(skip_all, fields(blob_id = %blob_id))]
619625
async fn read_blob(&self, blob_id: BlobId) -> Result<Option<Blob>, ViewError> {
620626
let store = self.database.open_shared(&[])?;
621627
let blob_key = bcs::to_bytes(&BaseKey::Blob(blob_id))?;
@@ -682,6 +688,7 @@ where
682688
Ok(blob_states)
683689
}
684690

691+
#[instrument(skip_all, fields(blob_id = %blob.id()))]
685692
async fn write_blob(&self, blob: &Blob) -> Result<(), ViewError> {
686693
let mut batch = Batch::new();
687694
batch.add_blob(blob)?;
@@ -996,6 +1003,7 @@ where
9961003
Ok(())
9971004
}
9981005

1006+
#[instrument(skip_all, fields(batch_size = batch.key_value_bytes.len()))]
9991007
async fn write_batch(&self, batch: Batch) -> Result<(), ViewError> {
10001008
if batch.key_value_bytes.is_empty() {
10011009
return Ok(());

0 commit comments

Comments
 (0)