Skip to content

Connect State::apply_block to parent span from StoreApi::apply_block #1840

@sergerad

Description

@sergerad

The apply_block call at block_producer.rs:115 runs inside a tokio::spawn, which detaches it from the parent gRPC span. The #[instrument] on State::apply_block at apply_block.rs:44 creates a new root span rather than being a child of the caller's trace.

    // TODO: This span is logged in a root span, we should connect it to the parent span.
    #[expect(clippy::too_many_lines)]
    #[instrument(target = COMPONENT, skip_all, err)]
    pub async fn apply_block(

To fix it, we need to capture the parent span context before spawning and pass it into the spawned task (e.g., via tracing::Span::current() or by propagating the OpenTelemetry context manually).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions