github.com/MetalBlockchain/metalgo@v1.11.9/vms/tracedvm/build_block_with_context_vm.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package tracedvm 5 6 import ( 7 "context" 8 9 "go.opentelemetry.io/otel/attribute" 10 11 "github.com/MetalBlockchain/metalgo/snow/consensus/snowman" 12 "github.com/MetalBlockchain/metalgo/snow/engine/snowman/block" 13 14 oteltrace "go.opentelemetry.io/otel/trace" 15 ) 16 17 func (vm *blockVM) BuildBlockWithContext(ctx context.Context, blockCtx *block.Context) (snowman.Block, error) { 18 if vm.buildBlockVM == nil { 19 return vm.BuildBlock(ctx) 20 } 21 22 ctx, span := vm.tracer.Start(ctx, vm.buildBlockWithContextTag, oteltrace.WithAttributes( 23 attribute.Int64("pChainHeight", int64(blockCtx.PChainHeight)), 24 )) 25 defer span.End() 26 27 return vm.buildBlockVM.BuildBlockWithContext(ctx, blockCtx) 28 }