Skip to content

Commit fee1233

Browse files
committed
eth/catalyst: create server span in simulated_beacon for call to newPayload
1 parent e68c5b2 commit fee1233

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

eth/catalyst/simulated_beacon.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ import (
3333
"github.com/ethereum/go-ethereum/crypto/kzg4844"
3434
"github.com/ethereum/go-ethereum/eth"
3535
"github.com/ethereum/go-ethereum/event"
36+
"github.com/ethereum/go-ethereum/internal/telemetry"
3637
"github.com/ethereum/go-ethereum/log"
3738
"github.com/ethereum/go-ethereum/node"
3839
"github.com/ethereum/go-ethereum/params"
3940
"github.com/ethereum/go-ethereum/params/forks"
4041
"github.com/ethereum/go-ethereum/rpc"
42+
"go.opentelemetry.io/otel"
4143
)
4244

4345
const devEpochLength = 32
@@ -192,6 +194,7 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
192194
}
193195

194196
version := payloadVersion(c.eth.BlockChain().Config(), timestamp)
197+
tracer := otel.Tracer("")
195198

196199
var random [32]byte
197200
rand.Read(random[:])
@@ -256,8 +259,16 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
256259
requests = envelope.Requests
257260
}
258261

262+
// Create a server span for newPayload, simulating the consensus client
263+
// sending the execution payload for validation.
264+
npCtx, npSpanEnd := telemetry.StartServerSpan(context.Background(), tracer, telemetry.RPCInfo{
265+
System: "jsonrpc",
266+
Service: "engine",
267+
Method: "newPayloadV" + fmt.Sprintf("%d", version),
268+
})
259269
// Mark the payload as canon
260-
_, err = c.engineAPI.newPayload(context.Background(), *payload, blobHashes, beaconRoot, requests, false)
270+
_, err = c.engineAPI.newPayload(npCtx, *payload, blobHashes, beaconRoot, requests, false)
271+
npSpanEnd(&err)
261272
if err != nil {
262273
return err
263274
}

0 commit comments

Comments
 (0)