Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/actions/c-chain-reexecution-benchmark/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ inputs:
description: 'The duration of the AWS role to assume for S3 access.'
required: true
default: '43200' # 12 hours
prometheus-url:
description: 'The URL of the prometheus instance.'
required: true
default: ''
prometheus-push-url:
description: 'The push URL of the prometheus instance.'
required: true
Expand Down Expand Up @@ -93,6 +97,7 @@ runs:
BENCHMARK_OUTPUT_FILE=${{ env.BENCHMARK_OUTPUT_FILE }} \
RUNNER_NAME=${{ inputs.runner_name }} \
METRICS_ENABLED=true
prometheus_url: ${{ inputs.prometheus-url }}
prometheus_push_url: ${{ inputs.prometheus-push-url }}
prometheus_username: ${{ inputs.prometheus-username }}
prometheus_password: ${{ inputs.prometheus-password }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
end-block: ${{ matrix.end-block }}
block-dir-src: ${{ matrix.block-dir-src }}
current-state-dir-src: ${{ matrix.current-state-dir-src }}
prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }}
prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }}
prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
end-block: ${{ matrix.end-block }}
block-dir-src: ${{ matrix.block-dir-src }}
current-state-dir-src: ${{ matrix.current-state-dir-src }}
prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }}
prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }}
prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
Expand Down
20 changes: 14 additions & 6 deletions tests/reexecute/c/vm_reexecute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"time"

"github.com/ava-labs/coreth/plugin/factory"
"github.com/google/uuid"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down Expand Up @@ -62,10 +63,12 @@ var (
executionTimeout time.Duration
labelsArg string

labels = map[string]string{
networkUUID string = uuid.NewString()
labels = map[string]string{
"job": "c-chain-reexecution",
"is_ephemeral_node": "false",
"chain": "C",
"network_uuid": networkUUID,
}

configKey = "config"
Expand Down Expand Up @@ -174,7 +177,7 @@ func benchmarkReexecuteRange(
r.NoError(prefixGatherer.Register("avalanche_snowman", consensusRegistry))

if metricsEnabled {
collectRegistry(b, "c-chain-reexecution", time.Minute, prefixGatherer, labels)
collectRegistry(b, "c-chain-reexecution", prefixGatherer, labels)
}

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

// collectRegistry starts prometheus and collects metrics from the provided gatherer.
// Attaches the provided labels + GitHub labels if available to the collected metrics.
func collectRegistry(tb testing.TB, name string, timeout time.Duration, gatherer prometheus.Gatherer, labels map[string]string) {
func collectRegistry(tb testing.TB, name string, gatherer prometheus.Gatherer, labels map[string]string) {
r := require.New(tb)

ctx, cancel := context.WithTimeout(context.Background(), timeout)
tb.Cleanup(cancel)
startPromCtx, cancel := context.WithTimeout(context.Background(), tests.DefaultTimeout)
defer cancel()

r.NoError(tmpnet.StartPrometheus(ctx, tests.NewDefaultLogger("prometheus")))
logger := tests.NewDefaultLogger("prometheus")
r.NoError(tmpnet.StartPrometheus(startPromCtx, logger))

server, err := tests.NewPrometheusServer(gatherer)
r.NoError(err)
Expand All @@ -567,6 +571,10 @@ func collectRegistry(tb testing.TB, name string, timeout time.Duration, gatherer
return nil
}(),
))

checkMetricsCtx, cancel := context.WithTimeout(context.Background(), tests.DefaultTimeout)
defer cancel()
r.NoError(tmpnet.CheckMetricsExist(checkMetricsCtx, logger, networkUUID))
})

sdConfigFilePath, err = tmpnet.WritePrometheusSDConfig(name, tmpnet.SDConfig{
Expand Down