Skip to content

Commit e207817

Browse files
Update prometheus params passed to run monitored tmpnet cmd (#4343)
1 parent 188f7e3 commit e207817

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.github/actions/c-chain-reexecution-benchmark/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ inputs:
3030
description: 'The duration of the AWS role to assume for S3 access.'
3131
required: true
3232
default: '43200' # 12 hours
33+
prometheus-url:
34+
description: 'The URL of the prometheus instance.'
35+
required: true
36+
default: ''
3337
prometheus-push-url:
3438
description: 'The push URL of the prometheus instance.'
3539
required: true
@@ -93,6 +97,7 @@ runs:
9397
BENCHMARK_OUTPUT_FILE=${{ env.BENCHMARK_OUTPUT_FILE }} \
9498
RUNNER_NAME=${{ inputs.runner_name }} \
9599
METRICS_ENABLED=true
100+
prometheus_url: ${{ inputs.prometheus-url }}
96101
prometheus_push_url: ${{ inputs.prometheus-push-url }}
97102
prometheus_username: ${{ inputs.prometheus-username }}
98103
prometheus_password: ${{ inputs.prometheus-password }}

.github/workflows/c-chain-reexecution-benchmark-container.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
end-block: ${{ matrix.end-block }}
106106
block-dir-src: ${{ matrix.block-dir-src }}
107107
current-state-dir-src: ${{ matrix.current-state-dir-src }}
108+
prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }}
108109
prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
109110
prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }}
110111
prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}

.github/workflows/c-chain-reexecution-benchmark-gh-native.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
end-block: ${{ matrix.end-block }}
9696
block-dir-src: ${{ matrix.block-dir-src }}
9797
current-state-dir-src: ${{ matrix.current-state-dir-src }}
98+
prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }}
9899
prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
99100
prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }}
100101
prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}

tests/reexecute/c/vm_reexecute_test.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"time"
1919

2020
"github.com/ava-labs/coreth/plugin/factory"
21+
"github.com/google/uuid"
2122
"github.com/prometheus/client_golang/prometheus"
2223
"github.com/stretchr/testify/require"
2324
"go.uber.org/zap"
@@ -62,10 +63,12 @@ var (
6263
executionTimeout time.Duration
6364
labelsArg string
6465

65-
labels = map[string]string{
66+
networkUUID string = uuid.NewString()
67+
labels = map[string]string{
6668
"job": "c-chain-reexecution",
6769
"is_ephemeral_node": "false",
6870
"chain": "C",
71+
"network_uuid": networkUUID,
6972
}
7073

7174
configKey = "config"
@@ -174,7 +177,7 @@ func benchmarkReexecuteRange(
174177
r.NoError(prefixGatherer.Register("avalanche_snowman", consensusRegistry))
175178

176179
if metricsEnabled {
177-
collectRegistry(b, "c-chain-reexecution", time.Minute, prefixGatherer, labels)
180+
collectRegistry(b, "c-chain-reexecution", prefixGatherer, labels)
178181
}
179182

180183
log := tests.NewDefaultLogger("c-chain-reexecution")
@@ -541,13 +544,14 @@ func newConsensusMetrics(registry prometheus.Registerer) (*consensusMetrics, err
541544

542545
// collectRegistry starts prometheus and collects metrics from the provided gatherer.
543546
// 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) {
545548
r := require.New(tb)
546549

547-
ctx, cancel := context.WithTimeout(context.Background(), timeout)
548-
tb.Cleanup(cancel)
550+
startPromCtx, cancel := context.WithTimeout(context.Background(), tests.DefaultTimeout)
551+
defer cancel()
549552

550-
r.NoError(tmpnet.StartPrometheus(ctx, tests.NewDefaultLogger("prometheus")))
553+
logger := tests.NewDefaultLogger("prometheus")
554+
r.NoError(tmpnet.StartPrometheus(startPromCtx, logger))
551555

552556
server, err := tests.NewPrometheusServer(gatherer)
553557
r.NoError(err)
@@ -567,6 +571,10 @@ func collectRegistry(tb testing.TB, name string, timeout time.Duration, gatherer
567571
return nil
568572
}(),
569573
))
574+
575+
checkMetricsCtx, cancel := context.WithTimeout(context.Background(), tests.DefaultTimeout)
576+
defer cancel()
577+
r.NoError(tmpnet.CheckMetricsExist(checkMetricsCtx, logger, networkUUID))
570578
})
571579

572580
sdConfigFilePath, err = tmpnet.WritePrometheusSDConfig(name, tmpnet.SDConfig{

0 commit comments

Comments
 (0)