mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
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:
committed by
GitHub
parent
fa359fd1f7
commit
d631f1dea8
@@ -64,7 +64,7 @@ pub type FatalResult<T> = std::result::Result<T, FatalError>;
|
||||
pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<(), FatalError> {
|
||||
match result.into_nested()? {
|
||||
Err(jfyi) => {
|
||||
tracing::warn!(target: LOG_TARGET, error = ?jfyi, ctx);
|
||||
gum::warn!(target: LOG_TARGET, error = ?jfyi, ctx);
|
||||
Ok(())
|
||||
},
|
||||
Ok(()) => Ok(()),
|
||||
|
||||
@@ -62,11 +62,11 @@ pub type JfyiErrorResult<T> = std::result::Result<T, JfyiError>;
|
||||
pub fn log_error(result: Result<()>) -> std::result::Result<(), FatalError> {
|
||||
match result.into_nested()? {
|
||||
Err(error @ JfyiError::ImportCanceled(_)) => {
|
||||
tracing::debug!(target: LOG_TARGET, error = ?error);
|
||||
gum::debug!(target: LOG_TARGET, error = ?error);
|
||||
Ok(())
|
||||
},
|
||||
Err(JfyiError::NotAValidator(peer)) => {
|
||||
tracing::debug!(
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?peer,
|
||||
"Dropping message from peer (unknown authority id)"
|
||||
@@ -74,7 +74,7 @@ pub fn log_error(result: Result<()>) -> std::result::Result<(), FatalError> {
|
||||
Ok(())
|
||||
},
|
||||
Err(error) => {
|
||||
tracing::warn!(target: LOG_TARGET, error = ?error);
|
||||
gum::warn!(target: LOG_TARGET, error = ?error);
|
||||
Ok(())
|
||||
},
|
||||
Ok(()) => Ok(()),
|
||||
|
||||
@@ -168,7 +168,7 @@ where
|
||||
match log_error(self.run_inner().await) {
|
||||
Ok(()) => {},
|
||||
Err(fatal) => {
|
||||
tracing::debug!(
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
error = ?fatal,
|
||||
"Shutting down"
|
||||
@@ -212,7 +212,7 @@ where
|
||||
// Immediately drop requests from peers that already have requests in flight or have
|
||||
// been banned recently (flood protection):
|
||||
if self.pending_imports.peer_is_pending(&peer) || self.banned_peers.contains(&peer) {
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?peer,
|
||||
"Dropping message from peer (banned/pending import)"
|
||||
|
||||
@@ -89,11 +89,7 @@ impl DisputeSender {
|
||||
let candidate_hash = req.0.candidate_receipt.hash();
|
||||
match self.disputes.entry(candidate_hash) {
|
||||
Entry::Occupied(_) => {
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
?candidate_hash,
|
||||
"Dispute sending already active."
|
||||
);
|
||||
gum::trace!(target: LOG_TARGET, ?candidate_hash, "Dispute sending already active.");
|
||||
return Ok(())
|
||||
},
|
||||
Entry::Vacant(vacant) => {
|
||||
@@ -168,7 +164,7 @@ impl DisputeSender {
|
||||
let task = match self.disputes.get_mut(&candidate_hash) {
|
||||
None => {
|
||||
// Can happen when a dispute ends, with messages still in queue:
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?result,
|
||||
"Received `FromSendingTask::Finished` for non existing dispute."
|
||||
@@ -215,7 +211,7 @@ impl DisputeSender {
|
||||
.await?;
|
||||
let our_index = match info.validator_info.our_index {
|
||||
None => {
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
"Not a validator in that session - not starting dispute sending."
|
||||
);
|
||||
@@ -226,7 +222,7 @@ impl DisputeSender {
|
||||
|
||||
let votes = match get_candidate_votes(ctx, session_index, candidate_hash).await? {
|
||||
None => {
|
||||
tracing::debug!(
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?session_index,
|
||||
?candidate_hash,
|
||||
|
||||
@@ -159,7 +159,7 @@ impl SendTask {
|
||||
pub fn on_finished_send(&mut self, authority: &AuthorityDiscoveryId, result: TaskResult) {
|
||||
match result {
|
||||
TaskResult::Failed(err) => {
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?authority,
|
||||
candidate_hash = %self.request.0.candidate_receipt.hash(),
|
||||
@@ -176,7 +176,7 @@ impl SendTask {
|
||||
None => {
|
||||
// Can happen when a sending became irrelevant while the response was already
|
||||
// queued.
|
||||
tracing::debug!(
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
candidate = ?self.request.0.candidate_receipt.hash(),
|
||||
?authority,
|
||||
@@ -290,7 +290,7 @@ async fn wait_response_task(
|
||||
TaskFinish { candidate_hash, receiver, result: TaskResult::Succeeded },
|
||||
};
|
||||
if let Err(err) = tx.feed(msg).await {
|
||||
tracing::debug!(
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
%err,
|
||||
"Failed to notify susystem about dispute sending result."
|
||||
|
||||
@@ -175,7 +175,7 @@ fn received_request_triggers_import() {
|
||||
assert_matches!(
|
||||
rx_response.await,
|
||||
Err(err) => {
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?err,
|
||||
"Request got dropped - other request already in flight"
|
||||
@@ -197,7 +197,7 @@ fn received_request_triggers_import() {
|
||||
assert_matches!(
|
||||
rx_response.await,
|
||||
Err(err) => {
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?err,
|
||||
"Request got dropped - other request already in flight"
|
||||
@@ -223,7 +223,7 @@ fn received_request_triggers_import() {
|
||||
assert_matches!(
|
||||
rx_response.await,
|
||||
Err(err) => {
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
?err,
|
||||
"Request got dropped - peer is banned."
|
||||
@@ -244,7 +244,7 @@ fn received_request_triggers_import() {
|
||||
)
|
||||
.await;
|
||||
|
||||
tracing::trace!(target: LOG_TARGET, "Concluding.");
|
||||
gum::trace!(target: LOG_TARGET, "Concluding.");
|
||||
conclude(&mut handle).await;
|
||||
};
|
||||
test_harness(test);
|
||||
@@ -562,7 +562,7 @@ async fn nested_network_dispute_request<'a, F, O>(
|
||||
if let Some(sent_feedback) = sent_feedback {
|
||||
sent_feedback.send(()).unwrap();
|
||||
}
|
||||
tracing::trace!(
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
"Valid import happened."
|
||||
);
|
||||
@@ -735,7 +735,7 @@ where
|
||||
match subsystem.run(ctx).await {
|
||||
Ok(()) => {},
|
||||
Err(fatal) => {
|
||||
tracing::debug!(
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?fatal,
|
||||
"Dispute distribution exited with fatal error."
|
||||
|
||||
Reference in New Issue
Block a user