eth/catalyst: create server span in simulated_beacon for call to newPayload

This commit is contained in:
jonny rhea 2026-02-14 13:50:13 -06:00
parent e68c5b213d
commit fee1233793

View file

@ -33,11 +33,13 @@ import (
"github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/internal/telemetry"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params/forks"
"github.com/ethereum/go-ethereum/rpc"
"go.opentelemetry.io/otel"
)
const devEpochLength = 32
@ -192,6 +194,7 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
}
version := payloadVersion(c.eth.BlockChain().Config(), timestamp)
tracer := otel.Tracer("")
var random [32]byte
rand.Read(random[:])
@ -256,8 +259,16 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
requests = envelope.Requests
}
// Create a server span for newPayload, simulating the consensus client
// sending the execution payload for validation.
npCtx, npSpanEnd := telemetry.StartServerSpan(context.Background(), tracer, telemetry.RPCInfo{
System: "jsonrpc",
Service: "engine",
Method: "newPayloadV" + fmt.Sprintf("%d", version),
})
// Mark the payload as canon
_, err = c.engineAPI.newPayload(context.Background(), *payload, blobHashes, beaconRoot, requests, false)
_, err = c.engineAPI.newPayload(npCtx, *payload, blobHashes, beaconRoot, requests, false)
npSpanEnd(&err)
if err != nil {
return err
}