@@ -18,6 +18,7 @@ import (
18
18
"time"
19
19
20
20
"github.com/ava-labs/coreth/plugin/factory"
21
+ "github.com/google/uuid"
21
22
"github.com/prometheus/client_golang/prometheus"
22
23
"github.com/stretchr/testify/require"
23
24
"go.uber.org/zap"
@@ -62,10 +63,12 @@ var (
62
63
executionTimeout time.Duration
63
64
labelsArg string
64
65
65
- labels = map [string ]string {
66
+ networkUUID string = uuid .NewString ()
67
+ labels = map [string ]string {
66
68
"job" : "c-chain-reexecution" ,
67
69
"is_ephemeral_node" : "false" ,
68
70
"chain" : "C" ,
71
+ "network_uuid" : networkUUID ,
69
72
}
70
73
71
74
configKey = "config"
@@ -174,7 +177,7 @@ func benchmarkReexecuteRange(
174
177
r .NoError (prefixGatherer .Register ("avalanche_snowman" , consensusRegistry ))
175
178
176
179
if metricsEnabled {
177
- collectRegistry (b , "c-chain-reexecution" , time . Minute , prefixGatherer , labels )
180
+ collectRegistry (b , "c-chain-reexecution" , prefixGatherer , labels )
178
181
}
179
182
180
183
log := tests .NewDefaultLogger ("c-chain-reexecution" )
@@ -541,13 +544,14 @@ func newConsensusMetrics(registry prometheus.Registerer) (*consensusMetrics, err
541
544
542
545
// collectRegistry starts prometheus and collects metrics from the provided gatherer.
543
546
// Attaches the provided labels + GitHub labels if available to the collected metrics.
544
- func collectRegistry (tb testing.TB , name string , timeout time. Duration , gatherer prometheus.Gatherer , labels map [string ]string ) {
547
+ func collectRegistry (tb testing.TB , name string , gatherer prometheus.Gatherer , labels map [string ]string ) {
545
548
r := require .New (tb )
546
549
547
- ctx , cancel := context .WithTimeout (context .Background (), timeout )
548
- tb . Cleanup ( cancel )
550
+ startPromCtx , cancel := context .WithTimeout (context .Background (), tests . DefaultTimeout )
551
+ defer cancel ( )
549
552
550
- r .NoError (tmpnet .StartPrometheus (ctx , tests .NewDefaultLogger ("prometheus" )))
553
+ logger := tests .NewDefaultLogger ("prometheus" )
554
+ r .NoError (tmpnet .StartPrometheus (startPromCtx , logger ))
551
555
552
556
server , err := tests .NewPrometheusServer (gatherer )
553
557
r .NoError (err )
@@ -567,6 +571,10 @@ func collectRegistry(tb testing.TB, name string, timeout time.Duration, gatherer
567
571
return nil
568
572
}(),
569
573
))
574
+
575
+ checkMetricsCtx , cancel := context .WithTimeout (context .Background (), tests .DefaultTimeout )
576
+ defer cancel ()
577
+ r .NoError (tmpnet .CheckMetricsExist (checkMetricsCtx , logger , networkUUID ))
570
578
})
571
579
572
580
sdConfigFilePath , err = tmpnet .WritePrometheusSDConfig (name , tmpnet.SDConfig {
0 commit comments