From 1db7f94df0eb2cf3236541a10ec8d6465b0c25e5 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Tue, 21 Apr 2026 09:51:24 +0800 Subject: [PATCH] miner: add opentelemetry tracing --- miner/worker.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/miner/worker.go b/miner/worker.go index 7e0be2f852..6e7882719e 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -228,13 +228,19 @@ func (miner *Miner) generateWork(ctx context.Context, genParam *generateParams, } // Finalize the state transition by applying operations such as withdrawals, // uncle rewards, and related processing. + _, _, finalizeSpanEnd := telemetry.StartSpan(ctx, "miner.Finalize") miner.engine.Finalize(miner.chain, work.header, work.state, &body) + finalizeSpanEnd(nil) // Calculate the state root after applying all mutations. + _, _, rootSpanEnd := telemetry.StartSpan(ctx, "miner.IntermediateRoot") work.header.Root = work.state.IntermediateRoot(miner.chain.Config().IsEIP158(work.header.Number)) + rootSpanEnd(nil) // Assemble the block for delivery. + _, _, blockSpanEnd := telemetry.StartSpan(ctx, "miner.NewBlock") block := types.NewBlock(work.header, &body, work.receipts, trie.NewStackTrie(nil)) + blockSpanEnd(nil) return &newPayloadResult{ block: block,