diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 670f184f41f8..390b99d4d337 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ concurrency: env: go_version: '~1.21.8' tmpnet_data_path: ~/.tmpnet + prometheus_url: https://grafana-experimental.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?orgId=1&refresh=10s&var-adhoc=gh_repo%7C%3D%7Cava-labs%2Favalanchego&var-adhoc=gh_run_id%7C%3D%7C${{ github.run_id }}&var-adhoc=gh_run_attempt%7C%3D%7C${{ github.run_attempt }} jobs: Unit: @@ -73,16 +74,24 @@ jobs: env: PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }} PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }} + - name: Notify of metrics availability + run: | + msg="Metrics for this job: ${PROMETHEUS_URL}&var-adhoc=gh_job_id%7C%3D%7C${GH_JOB_ID}&from=$(date '+%s')000&to=now" + echo "::notice::${msg}" + env: + PROMETHEUS_URL: ${{ env.prometheus_url }} + GH_JOB_ID: ${{ github.job }} - name: Run e2e tests shell: bash # TODO(maru) Ensure network stays up for final metrics scrape run: E2E_SERIAL=1 ./scripts/tests.e2e.sh env: GH_REPO: ${{ github.repository }} - GH_JOB_ID: ${{ github.job }} + GH_WORKFLOW: ${{ github.workflow }} GH_RUN_ID: ${{ github.run_id }} - GH_RUN_NUMBER: ${{ github.run_id }} + GH_RUN_NUMBER: ${{ github.run_number }} GH_RUN_ATTEMPT: ${{ github.run_attempt }} + GH_JOB_ID: ${{ github.job }} - name: Upload tmpnet network dir uses: actions/upload-artifact@v4 if: always() @@ -107,15 +116,23 @@ jobs: env: PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }} PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }} + - name: Notify of metrics availability + run: | + msg="Metrics for this job: ${PROMETHEUS_URL}&var-gh_job_id=${GH_JOB_ID}" + echo "::notice::${msg}" + env: + PROMETHEUS_URL: ${{ env.prometheus_url }} + GH_JOB_ID: ${{ github.job }} - name: Run e2e tests with existing network shell: bash run: E2E_SERIAL=1 ./scripts/tests.e2e.existing.sh env: GH_REPO: ${{ github.repository }} - GH_JOB_ID: ${{ github.job }} + GH_WORKFLOW: ${{ github.workflow }} GH_RUN_ID: ${{ github.run_id }} - GH_RUN_NUMBER: ${{ github.run_id }} + GH_RUN_NUMBER: ${{ github.run_number }} GH_RUN_ATTEMPT: ${{ github.run_attempt }} + GH_JOB_ID: ${{ github.job }} - name: Upload tmpnet network dir uses: actions/upload-artifact@v4 if: always() @@ -140,15 +157,23 @@ jobs: env: PROMETHEUS_ID: ${{ secrets.PROMETHEUS_ID }} PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }} + - name: Notify of metrics availability + run: | + msg="Metrics for this job: ${PROMETHEUS_URL}&var-gh_job_id=${GH_JOB_ID}" + echo "::notice::${msg}" + env: + PROMETHEUS_URL: ${{ env.prometheus_url }} + GH_JOB_ID: ${{ github.job }} - name: Run e2e tests shell: bash run: ./scripts/tests.upgrade.sh env: GH_REPO: ${{ github.repository }} - GH_JOB_ID: ${{ github.job }} + GH_WORKFLOW: ${{ github.workflow }} GH_RUN_ID: ${{ github.run_id }} - GH_RUN_NUMBER: ${{ github.run_id }} + GH_RUN_NUMBER: ${{ github.run_number }} GH_RUN_ATTEMPT: ${{ github.run_attempt }} + GH_JOB_ID: ${{ github.job }} - name: Upload tmpnet network dir uses: actions/upload-artifact@v4 if: always() diff --git a/tests/fixture/tmpnet/network.go b/tests/fixture/tmpnet/network.go index bf158e567f13..927ae9becff8 100644 --- a/tests/fixture/tmpnet/network.go +++ b/tests/fixture/tmpnet/network.go @@ -318,7 +318,8 @@ func (n *Network) Start(ctx context.Context, w io.Writer) error { if _, err := fmt.Fprintf(w, "\nStarted network %s (UUID: %s)\n", n.Dir, n.UUID); err != nil { return err } - if _, err := fmt.Fprintf(w, "\nMetrics: https://grafana-experimental.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?var-network_uuid=%s\n", n.UUID); err != nil { + // Provide a link the main dashboard filtered by the uuid and showing results for now till whenever the link is viewed + if _, err := fmt.Fprintf(w, "\nMetrics: https://grafana-experimental.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?&var-adhoc=network_uuid%%7C%%3D%%7C%s&from=%d&to=now\n", n.UUID, time.Now().UnixMilli()); err != nil { return err } diff --git a/tests/fixture/tmpnet/node_process.go b/tests/fixture/tmpnet/node_process.go index eff66a17eb97..e160a68f5d68 100644 --- a/tests/fixture/tmpnet/node_process.go +++ b/tests/fixture/tmpnet/node_process.go @@ -301,16 +301,17 @@ func (p *NodeProcess) writePrometheusConfig() error { { "targets": []string{strings.TrimPrefix(p.node.URI, "http://")}, "labels": FlagsMap{ - "network_uuid": p.node.NetworkUUID, - "node_id": p.node.NodeID, - "is_ephemeral": strconv.FormatBool(p.node.IsEphemeral), + "network_uuid": p.node.NetworkUUID, + "node_id": p.node.NodeID, + "is_ephemeral_node": strconv.FormatBool(p.node.IsEphemeral), // Prometheus ignores empty values so running this outside - // of a github worker will have no ill-effect. + // of a github worker should have no ill-effect. "gh_repo": os.Getenv("GH_REPO"), - "gh_job_id": os.Getenv("GH_JOB_ID"), + "gh_workflow": os.Getenv("GH_WORKFLOW"), "gh_run_id": os.Getenv("GH_RUN_ID"), "gh_run_number": os.Getenv("GH_RUN_NUMBER"), "gh_run_attempt": os.Getenv("GH_RUN_ATTEMPT"), + "gh_job_id": os.Getenv("GH_JOB_ID"), }, }, }