From 3bfe63e38fdcbcd3237944eecf42f5628a07df09 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Fri, 20 Nov 2020 12:43:50 -0800 Subject: [PATCH] state: add span to state service Here the span is added to the body of the `Service::call` implementation, not to the futures it returns, because the state service does all of the work synchronously in `call` rather than in the futures it returns. The service is skipped as a span field. We could either include or exclude the request itself. It would be useful, but the request body can be very large. Instead, we make two spans, one at info level and one at trace level, and filter that way. --- zebra-state/src/service.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zebra-state/src/service.rs b/zebra-state/src/service.rs index 0181e8c67..b0d22465e 100644 --- a/zebra-state/src/service.rs +++ b/zebra-state/src/service.rs @@ -383,6 +383,13 @@ impl Service for StateService { Poll::Ready(Ok(())) } + // Because the request might have a verbose debug output (e.g., + // an entire block), include it only in a second trace-level span. + // For some reason putting them in this order causes the info-level + // span to be entered first. + #[allow(unused_braces)] // fixes a spurious warning from the proc macro + #[instrument(name = "state_trace", level = "trace", skip(self))] + #[instrument(name = "state", level = "info", skip(self, req))] fn call(&mut self, req: Request) -> Self::Future { match req { Request::CommitBlock { block } => {