From cd44ea4178794053bd5a645300a04823194e5bbd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 19:33:28 +0000 Subject: [PATCH 1/2] Initial plan From cb3261ab39a07a6b8b9bb4e759e6623eba872ac0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 12 Nov 2025 19:44:21 +0000 Subject: [PATCH 2/2] Add network_uuid filtering to differentiate matrix jobs in Grafana URLs - Modified vm_reexecute_test.go to check for NETWORK_UUID env var before generating new UUID - Added getOrCreateNetworkUUID() helper function - Updated output-metrics-url.sh to include network_uuid filter when set - Added network_uuid input to run-monitored-tmpnet-cmd action - Modified c-chain-reexecution-benchmark action to generate and pass NETWORK_UUID Co-authored-by: aaronbuchwald <24684335+aaronbuchwald@users.noreply.github.com> --- .../c-chain-reexecution-benchmark/action.yml | 6 +++++- .../run-monitored-tmpnet-cmd/action.yml | 4 ++++ .../output-metrics-url.sh | 5 +++++ tests/reexecute/c/vm_reexecute_test.go | 18 +++++++++++++++--- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/actions/c-chain-reexecution-benchmark/action.yml b/.github/actions/c-chain-reexecution-benchmark/action.yml index 3385ff50a0c1..bc57041fc3c8 100644 --- a/.github/actions/c-chain-reexecution-benchmark/action.yml +++ b/.github/actions/c-chain-reexecution-benchmark/action.yml @@ -74,6 +74,7 @@ runs: echo "END_BLOCK=${{ inputs.end-block }}" echo "BLOCK_DIR_SRC=${{ inputs.block-dir-src }}" echo "CURRENT_STATE_DIR_SRC=${{ inputs.current-state-dir-src }}" + echo "NETWORK_UUID=$(uuidgen || cat /proc/sys/kernel/random/uuid)" } >> $GITHUB_ENV - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 @@ -84,6 +85,7 @@ runs: - name: Run C-Chain Re-Execution uses: ./.github/actions/run-monitored-tmpnet-cmd with: + run_env: NETWORK_UUID=${{ env.NETWORK_UUID }} run: | ./scripts/run_task.sh reexecute-cchain-range-with-copied-data \ CONFIG=${{ inputs.config }} \ @@ -96,12 +98,14 @@ runs: BENCHMARK_OUTPUT_FILE=${{ env.BENCHMARK_OUTPUT_FILE }} \ RUNNER_NAME=${{ inputs.runner_name }} \ METRICS_SERVER_ENABLED=true \ - METRICS_COLLECTOR_ENABLED=true + METRICS_COLLECTOR_ENABLED=true \ + NETWORK_UUID=${{ env.NETWORK_UUID }} prometheus_url: ${{ inputs.prometheus-url }} prometheus_push_url: ${{ inputs.prometheus-push-url }} prometheus_username: ${{ inputs.prometheus-username }} prometheus_password: ${{ inputs.prometheus-password }} grafana_dashboard_id: 'Gl1I20mnk/c-chain' + network_uuid: ${{ env.NETWORK_UUID }} runtime: "" # Set runtime input to empty string to disable log collection - name: Compare Benchmark Results diff --git a/.github/actions/run-monitored-tmpnet-cmd/action.yml b/.github/actions/run-monitored-tmpnet-cmd/action.yml index 4cf1b2ef5267..1d16fb89630b 100644 --- a/.github/actions/run-monitored-tmpnet-cmd/action.yml +++ b/.github/actions/run-monitored-tmpnet-cmd/action.yml @@ -51,6 +51,9 @@ inputs: grafana_dashboard_id: description: 'The identifier of the Grafana dashboard to use, in the format /.' default: 'kBQpRdWnk/avalanche-main-dashboard' + network_uuid: + description: 'The network UUID to filter metrics by. If not provided, no network_uuid filter is applied.' + default: '' runs: using: composite @@ -100,6 +103,7 @@ runs: GRAFANA_URL: https://grafana-poc.avax-dev.network/d/${{ inputs.grafana_dashboard_id }}?orgId=1&refresh=10s&var-filter=is_ephemeral_node%7C%3D%7Cfalse&var-filter=gh_repo%7C%3D%7C${{ inputs.repository_owner }}%2F${{ inputs.repository_name }}&var-filter=gh_run_id%7C%3D%7C${{ inputs.run_id }}&var-filter=gh_run_attempt%7C%3D%7C${{ inputs.run_attempt }} GH_JOB_ID: ${{ inputs.job }} FILTER_BY_OWNER: ${{ inputs.filter_by_owner }} + NETWORK_UUID: ${{ inputs.network_uuid }} - name: Warn that collection of metrics and logs will not be performed if: (inputs.prometheus_username == '') shell: bash diff --git a/.github/actions/run-monitored-tmpnet-cmd/output-metrics-url.sh b/.github/actions/run-monitored-tmpnet-cmd/output-metrics-url.sh index ccecc34ac09c..a3cd7b46aea5 100755 --- a/.github/actions/run-monitored-tmpnet-cmd/output-metrics-url.sh +++ b/.github/actions/run-monitored-tmpnet-cmd/output-metrics-url.sh @@ -16,4 +16,9 @@ if [[ -n "${FILTER_BY_OWNER:-}" ]]; then metrics_url="${metrics_url}&var-filter=network_owner%7C%3D%7C${FILTER_BY_OWNER}" fi +# Optionally filter by network_uuid to differentiate matrix jobs +if [[ -n "${NETWORK_UUID:-}" ]]; then + metrics_url="${metrics_url}&var-filter=network_uuid%7C%3D%7C${NETWORK_UUID}" +fi + echo "${metrics_url}" diff --git a/tests/reexecute/c/vm_reexecute_test.go b/tests/reexecute/c/vm_reexecute_test.go index 2cb50b91fe21..de8247bc3d6e 100644 --- a/tests/reexecute/c/vm_reexecute_test.go +++ b/tests/reexecute/c/vm_reexecute_test.go @@ -67,12 +67,11 @@ var ( metricsServerPortArg uint64 metricsCollectorEnabledArg bool - networkUUID string = uuid.NewString() - labels = map[string]string{ + networkUUID string + labels = map[string]string{ "job": "c-chain-reexecution", "is_ephemeral_node": "false", "chain": "C", - "network_uuid": networkUUID, } configKey = "config" @@ -144,9 +143,22 @@ func TestMain(m *testing.M) { // Set the runner name label on the metrics. labels["runner"] = runnerNameArg + // Get or create the network UUID + networkUUID = getOrCreateNetworkUUID() + labels["network_uuid"] = networkUUID + m.Run() } +// getOrCreateNetworkUUID returns the network UUID from the NETWORK_UUID environment +// variable if set, otherwise it generates a new UUID. +func getOrCreateNetworkUUID() string { + if envUUID := os.Getenv("NETWORK_UUID"); envUUID != "" { + return envUUID + } + return uuid.NewString() +} + func BenchmarkReexecuteRange(b *testing.B) { require.Equalf(b, 1, b.N, "BenchmarkReexecuteRange expects to run a single iteration because it overwrites the input current-state, but found (b.N=%d)", b.N) b.Run(fmt.Sprintf("[%d,%d]-Config-%s-Runner-%s", startBlockArg, endBlockArg, configNameArg, runnerNameArg), func(b *testing.B) {