Skip to content

Preserve tracing spans across spawns, instrument components, record missing metrics #631

Description

@emlautarom1

Summary

Spans. The workspace has 60 production tokio::spawn/spawn_blocking sites and exactly 2 .instrument(...) calls (zero Span::current()/in_current_span). Every uninstrumented spawn drops the span context — which is also the mechanism behind #588's topic="" problem, since log-topic labels are span fields: spans and topics are the same fix. #[tracing::instrument] appears 33 times, 22 of them in one file (validatorapi/component.rs); scheduler, fetcher, bcast, tracker, dutydb, parsigdb, aggsigdb, consensus/qbft, dkg, parsigex, and priority have none. Highest-value uninstrumented spawns: the scheduler's per-slot detached duty callbacks (scheduler.rs#L173-L184), the actor loops (tracker, aggsigdb, prioritiser), and the duty-workflow wiring in wire.rs.

Defined-but-never-recorded metrics (grep-verified, zero recording sites):

Otherwise name-for-name parity with Charon's metric families is good; app_eth2_* request/error/latency coverage is opt-in per call site (~11 of 76 endpoints) and moves into the client wrapper.

Proposed change

  1. Add a spawn helper attaching Span::current() (the Log topics: app_log_{warn,error}_total is unlabelled across almost all of pluto #588 suggestion) and adopt it at the production spawn sites; set one root span per long-running component.
  2. Add #[tracing::instrument] to the duty-pipeline entry points (fetch/propose/participate/broadcast/store paths), with skips to keep fields bounded.
  3. Wire the four dead metric families above (or delete any that are deliberately out of scope, with a note).
  4. While in layers/metrics.rs, cover the topic-resolution layer with tests: the TopicVisitor::record_debug fallback and nearest-enclosing-span resolution are untested (only same-span level filtering is).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions