observability: tracing gum, automatically cross ref traceID (#5079)

* add some gum

* bump expander

* gum

* fix all remaining issues

* last fixup

* Update node/gum/proc-macro/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* change

* netowrk

* fixins

* chore

* allow optional fmt str + args, prep for expr as kv field

* tracing -> gum rename fallout

* restrict further

* allow multiple levels of field accesses

* another round of docs and a slip of the pen

* update ADR

* fixup lock fiel

* use target: instead of target=

* minors

* fix

* chore

* Update node/gum/README.md

Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
Bernhard Schuster
2022-03-15 12:05:16 +01:00
committed by GitHub
parent fa359fd1f7
commit d631f1dea8
130 changed files with 1708 additions and 808 deletions
+13 -13
View File
@@ -163,7 +163,7 @@ fn query_inner<D: Decode>(
},
Ok(None) => Ok(None),
Err(err) => {
tracing::warn!(target: LOG_TARGET, ?err, "Error reading from the availability store");
gum::warn!(target: LOG_TARGET, ?err, "Error reading from the availability store");
Err(err.into())
},
}
@@ -384,10 +384,10 @@ impl Error {
match self {
// don't spam the log with spurious errors
Self::RuntimeApi(_) | Self::Oneshot(_) => {
tracing::debug!(target: LOG_TARGET, err = ?self)
gum::debug!(target: LOG_TARGET, err = ?self)
},
// it's worth reporting otherwise
_ => tracing::warn!(target: LOG_TARGET, err = ?self),
_ => gum::warn!(target: LOG_TARGET, err = ?self),
}
}
}
@@ -544,7 +544,7 @@ where
}
},
Ok(true) => {
tracing::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
gum::info!(target: LOG_TARGET, "received `Conclude` signal, exiting");
break
},
Ok(false) => continue,
@@ -721,7 +721,7 @@ fn note_block_backed(
) -> Result<(), Error> {
let candidate_hash = candidate.hash();
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate backed");
gum::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate backed");
if load_meta(db, config, &candidate_hash)?.is_none() {
let meta = CandidateMeta {
@@ -753,7 +753,7 @@ fn note_block_included(
None => {
// This is alarming. We've observed a block being included without ever seeing it backed.
// Warn and ignore.
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate_hash,
"Candidate included without being backed?",
@@ -762,7 +762,7 @@ fn note_block_included(
Some(mut meta) => {
let be_block = (BEBlockNumber(block.0), block.1);
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate included");
gum::debug!(target: LOG_TARGET, ?candidate_hash, "Candidate included");
meta.state = match meta.state {
State::Unavailable(at) => {
@@ -856,7 +856,7 @@ where
match rx.await? {
Err(err) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
batch_num,
?err,
@@ -866,7 +866,7 @@ where
break
},
Ok(None) => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Availability store was informed that block #{} is finalized, \
but chain API has no finalized hash.",
@@ -944,7 +944,7 @@ fn update_blocks_at_finalized_height(
for (candidate_hash, is_finalized) in candidates {
let mut meta = match load_meta(&subsystem.db, &subsystem.config, &candidate_hash)? {
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
"Dangling candidate metadata for {}",
candidate_hash,
@@ -1061,7 +1061,7 @@ fn process_message(
)? {
Some(c) => chunks.push(c),
None => {
tracing::warn!(
gum::warn!(
target: LOG_TARGET,
?candidate,
index,
@@ -1151,7 +1151,7 @@ fn store_chunk(
None => return Ok(false), // out of bounds.
}
tracing::debug!(
gum::debug!(
target: LOG_TARGET,
?candidate_hash,
chunk_index = %chunk.index.0,
@@ -1217,7 +1217,7 @@ fn store_available_data(
subsystem.db.write(tx)?;
tracing::debug!(target: LOG_TARGET, ?candidate_hash, "Stored data and chunks");
gum::debug!(target: LOG_TARGET, ?candidate_hash, "Stored data and chunks");
Ok(())
}
+3 -3
View File
@@ -146,7 +146,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>>(
const TIMEOUT: Duration = Duration::from_millis(100);
async fn overseer_send(overseer: &mut VirtualOverseer, msg: AvailabilityStoreMessage) {
tracing::trace!(meg = ?msg, "sending message");
gum::trace!(meg = ?msg, "sending message");
overseer
.send(FromOverseer::Communication { msg })
.timeout(TIMEOUT)
@@ -159,7 +159,7 @@ async fn overseer_recv(overseer: &mut VirtualOverseer) -> AllMessages {
.await
.expect(&format!("{:?} is more than enough to receive messages", TIMEOUT));
tracing::trace!(msg = ?msg, "received message");
gum::trace!(msg = ?msg, "received message");
msg
}
@@ -168,7 +168,7 @@ async fn overseer_recv_with_timeout(
overseer: &mut VirtualOverseer,
timeout: Duration,
) -> Option<AllMessages> {
tracing::trace!("waiting for message...");
gum::trace!("waiting for message...");
overseer.recv().timeout(timeout).await
}