Add tracing support to node (#1940)

* drop in tracing to replace log

* add structured logging to trace messages

* add structured logging to debug messages

* add structured logging to info messages

* add structured logging to warn messages

* add structured logging to error messages

* normalize spacing and Display vs Debug

* add instrumentation to the various 'fn run'

* use explicit tracing module throughout

* fix availability distribution test

* don't double-print errors

* remove further redundancy from logs

* fix test errors

* fix more test errors

* remove unused kv_log_macro

* fix unused variable

* add tracing spans to collation generation

* add tracing spans to av-store

* add tracing spans to backing

* add tracing spans to bitfield-signing

* add tracing spans to candidate-selection

* add tracing spans to candidate-validation

* add tracing spans to chain-api

* add tracing spans to provisioner

* add tracing spans to runtime-api

* add tracing spans to availability-distribution

* add tracing spans to bitfield-distribution

* add tracing spans to network-bridge

* add tracing spans to collator-protocol

* add tracing spans to pov-distribution

* add tracing spans to statement-distribution

* add tracing spans to overseer

* cleanup
This commit is contained in:
Peter Goodspeed-Niklaus
2020-11-20 12:02:04 +01:00
committed by GitHub
parent 94670d8082
commit e49989971d
53 changed files with 564 additions and 280 deletions
@@ -103,7 +103,7 @@ async fn overseer_send(
overseer: &mut test_helpers::TestSubsystemContextHandle<AvailabilityDistributionMessage>,
msg: AvailabilityDistributionMessage,
) {
log::trace!("Sending message:\n{:?}", &msg);
tracing::trace!(msg = ?msg, "sending message");
overseer
.send(FromOverseer::Communication { msg })
.timeout(TIMEOUT)
@@ -114,13 +114,13 @@ async fn overseer_send(
async fn overseer_recv(
overseer: &mut test_helpers::TestSubsystemContextHandle<AvailabilityDistributionMessage>,
) -> AllMessages {
log::trace!("Waiting for message ...");
tracing::trace!("waiting for message ...");
let msg = overseer
.recv()
.timeout(TIMEOUT)
.await
.expect("TIMEOUT is enough to recv.");
log::trace!("Received message:\n{:?}", &msg);
tracing::trace!(msg = ?msg, "received message");
msg
}
@@ -439,11 +439,11 @@ fn reputation_verification() {
let peer_b = PeerId::random();
assert_ne!(&peer_a, &peer_b);
log::trace!("peer A: {:?}", peer_a);
log::trace!("peer B: {:?}", peer_b);
tracing::trace!("peer A: {:?}", peer_a);
tracing::trace!("peer B: {:?}", peer_b);
log::trace!("candidate A: {:?}", candidates[0].hash());
log::trace!("candidate B: {:?}", candidates[1].hash());
tracing::trace!("candidate A: {:?}", candidates[0].hash());
tracing::trace!("candidate B: {:?}", candidates[1].hash());
overseer_signal(
&mut virtual_overseer,
@@ -627,7 +627,7 @@ fn reputation_verification() {
let mut candidates2 = candidates.clone();
// check if the availability store can provide the desired erasure chunks
for i in 0usize..2 {
log::trace!("0000");
tracing::trace!("0000");
let avail_data = make_available_data(&test_state, pov_block_a.clone());
let chunks =
derive_erasure_chunks_with_proofs(test_state.validators.len(), &avail_data);
@@ -652,10 +652,10 @@ fn reputation_verification() {
assert_eq!(chunks.len(), test_state.validators.len());
log::trace!("xxxx");
tracing::trace!("xxxx");
// retrieve a stored chunk
for (j, chunk) in chunks.into_iter().enumerate() {
log::trace!("yyyy i={}, j={}", i, j);
tracing::trace!("yyyy i={}, j={}", i, j);
if i != 0 {
// not a validator, so this never happens
break;