Skip to content

Commit 95fca6d

Browse files
committed
nits
1 parent 0b9deb0 commit 95fca6d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugin/evm/vm.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ const (
9797

9898
// Prefixes for metrics gatherers
9999
ethMetricsPrefix = "eth"
100+
sdkMetricsPrefix = "sdk"
101+
p2pMetricsPrefix = "p2p"
100102
chainStateMetricsPrefix = "chain_state"
101103
)
102104

@@ -281,6 +283,7 @@ type VM struct {
281283

282284
// Metrics
283285
multiGatherer avalanchegoMetrics.MultiGatherer
286+
sdkMetrics *prometheus.Registry
284287

285288
bootstrapped bool
286289
IsPlugin bool
@@ -509,7 +512,7 @@ func (vm *VM) Initialize(
509512
}
510513

511514
// initialize peer network
512-
vm.router = p2p.NewRouter(vm.ctx.Log, appSender, prometheus.NewRegistry(), "p2p")
515+
vm.router = p2p.NewRouter(vm.ctx.Log, appSender, vm.sdkMetrics, p2pMetricsPrefix)
513516
vm.networkCodec = message.Codec
514517
vm.Network = peer.NewNetwork(vm.router, appSender, vm.networkCodec, message.CrossChainCodec, chainCtx.NodeID, vm.config.MaxOutboundActiveRequests, vm.config.MaxOutboundActiveCrossChainRequests)
515518
vm.client = peer.NewNetworkClient(vm.Network)
@@ -561,13 +564,17 @@ func (vm *VM) Initialize(
561564
}
562565

563566
func (vm *VM) initializeMetrics() error {
567+
vm.sdkMetrics = prometheus.NewRegistry()
564568
vm.multiGatherer = avalanchegoMetrics.NewMultiGatherer()
565569
// If metrics are enabled, register the default metrics regitry
566570
if metrics.Enabled {
567571
gatherer := corethPrometheus.Gatherer(metrics.DefaultRegistry)
568572
if err := vm.multiGatherer.Register(ethMetricsPrefix, gatherer); err != nil {
569573
return err
570574
}
575+
if err := vm.multiGatherer.Register(sdkMetricsPrefix, vm.sdkMetrics); err != nil {
576+
return err
577+
}
571578
// Register [multiGatherer] after registerers have been registered to it
572579
if err := vm.ctx.Metrics.Register(vm.multiGatherer); err != nil {
573580
return err

0 commit comments

Comments
 (0)