Skip to content

Commit

Permalink
fixup: Add links to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
marun committed Mar 11, 2024
1 parent 1706612 commit 849fcda
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion tests/fixture/tmpnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
11 changes: 6 additions & 5 deletions tests/fixture/tmpnet/node_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
},
}
Expand Down

0 comments on commit 849fcda

Please sign in to comment.