Skip to content

ci: ARC load test [do not merge] #3980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 207 commits into from
Closed
Show file tree
Hide file tree
Changes from 201 commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
b713278
initial commit
qdm12 Apr 24, 2025
863adcc
Split listeners in poll and subscription depending if connection is w…
qdm12 Apr 24, 2025
c6030db
Always generate keys except for the prefunded key
qdm12 Apr 28, 2025
a560a94
Lower poll period from 1s to 50ms
qdm12 Apr 28, 2025
7942c76
Abort fund distribution if no key needs it
qdm12 Apr 28, 2025
f6e300c
Ginkgo setup
qdm12 Apr 28, 2025
a934818
Define client interfaces for poll and subscriber eth clients
qdm12 Apr 28, 2025
8224d4e
Observe block times working for both polling and websocket
qdm12 Apr 28, 2025
57ad33b
Use ginkgo context
qdm12 Apr 28, 2025
29502bd
Fail ginkgo properly using `ginkgo.GinkgoT().Error`
qdm12 Apr 28, 2025
a213610
Rely on ginkgo to handle OS signals
qdm12 Apr 28, 2025
2a859a2
Simplify unneeded run function
qdm12 Apr 28, 2025
2be38c1
Remove unneeded dependencies.go file
qdm12 Apr 28, 2025
8701f17
Unexport symbols
qdm12 Apr 28, 2025
e5f2f79
Use all prefunded keys instead of only one
qdm12 Apr 28, 2025
ee6132e
Thread safe tracker
qdm12 Apr 28, 2025
35450dc
CI setup
qdm12 Apr 28, 2025
5ea102a
Split issuer and listener
qdm12 Apr 29, 2025
3be8f03
Rename package names issuer and generator to issue and generate
qdm12 Apr 29, 2025
0251e6f
Mark remaining in flight transactions as failed when exiting listener
qdm12 Apr 29, 2025
8658ca0
Fix listener poll implementation
qdm12 Apr 29, 2025
66eb147
Use env network default nodes directly
qdm12 Apr 29, 2025
50095f6
Limit number of nodes to 1
qdm12 Apr 29, 2025
92616fc
Fix block production
michaelkaplan13 Apr 30, 2025
c2ebb6f
Fix listen subscription exit
qdm12 Apr 30, 2025
e323368
Minor comment fixes
qdm12 Apr 30, 2025
e13e3ae
Log out average duration per block at the end
qdm12 Apr 30, 2025
46b4e0d
Ignore load tests in unit tests
qdm12 Apr 30, 2025
b758aa5
Add load testing to readme
qdm12 Apr 30, 2025
f595e15
Fix double cancelation of listener subscription
qdm12 Apr 30, 2025
aed6ec4
Change metrics route to /ext/metrics
qdm12 Apr 30, 2025
1ce8f95
Fix distribution of funds
qdm12 Apr 30, 2025
b711dd0
Remove listener polling
qdm12 Apr 30, 2025
a7d46f7
Wait 3s after fund distribution to check for balances
qdm12 Apr 30, 2025
2514b3c
Do not track block durations
qdm12 Apr 30, 2025
20d972b
Merge branch 'master' into qdm12/tests/load
qdm12 Apr 30, 2025
3172d41
Tidy dependencies 🤷
qdm12 Apr 30, 2025
aa49787
Use initially created network
qdm12 Apr 30, 2025
15065c4
Replace in flight txs gauge with issued counter
qdm12 May 2, 2025
3cf8af8
Remove issuing detail metrics as likely unneeded
qdm12 May 2, 2025
8270efb
Unexport metrics fields
qdm12 May 2, 2025
55fdfdf
Change metrics to match hypersdk ones
qdm12 May 2, 2025
238dcff
Remove unneeded address field for issuer
qdm12 May 2, 2025
baabe22
Always set max tip cap to 1
qdm12 May 2, 2025
ea16ed3
Require largest balance address to remain with min funds
qdm12 May 2, 2025
ba4e377
Prevent new head subscriber race condition on exit
qdm12 May 2, 2025
db3010a
Fix minimum funds calculation
qdm12 May 2, 2025
f22abad
issue period configuration option
qdm12 May 5, 2025
77086f4
Final timeout config option
qdm12 May 5, 2025
c4fa76c
Add Prometheus and grafana instructions and configs
qdm12 May 5, 2025
435a0f1
Log tracker stats every 10s
qdm12 May 5, 2025
e2dd77f
Change counter tracker to noop tracker
qdm12 May 5, 2025
19d3b3a
Merge generator and issuer together
qdm12 May 6, 2025
b812419
Remove unneeded constant issuePeriod
qdm12 May 6, 2025
8aa1b53
init
RodrigoVillar May 6, 2025
f34d312
lint
RodrigoVillar May 6, 2025
1155cd0
issue: add C chain opcode simulator issuer
qdm12 May 7, 2025
1f9b865
Generate contract using libevm abigen
qdm12 May 7, 2025
30961af
Merge branch 'master' into qdm12/tests/load
qdm12 May 7, 2025
4a4b7d7
migrate
RodrigoVillar May 7, 2025
7497d56
Merge branch 'master' into add-load-framework
RodrigoVillar May 7, 2025
98957e6
Pre-adapt to add-load-framework branch
qdm12 May 7, 2025
0faf824
Move issuers to c/issuers
qdm12 May 7, 2025
1f366f3
Move listener code to c/listener
qdm12 May 7, 2025
8ccb800
Update grafana dashboard
qdm12 May 7, 2025
a9e7e0f
Fix logging using avalanchego's logger
qdm12 May 7, 2025
97a154d
Fix gci linting
qdm12 May 8, 2025
ccaff10
relax generic type constraint
RodrigoVillar May 8, 2025
855bfb9
remove unused logger from burst orchestrator
RodrigoVillar May 8, 2025
eed3292
MD => md
RodrigoVillar May 8, 2025
c2e2b01
Update tests/load/gradual_orchestrator.go
RodrigoVillar May 8, 2025
b5faf4f
nits
RodrigoVillar May 8, 2025
c33e894
Update tests/load/gradual_orchestrator.go
RodrigoVillar May 8, 2025
480e4bc
remove named return parameters
RodrigoVillar May 8, 2025
8e19faa
lint
RodrigoVillar May 8, 2025
9385b6e
remove duplicate MD
RodrigoVillar May 8, 2025
672f377
remove unnecessary errors from orchestrator constructors
RodrigoVillar May 8, 2025
5ef5660
Update tests/load/gradual_orchestrator.go
RodrigoVillar May 8, 2025
0595e31
make observerGroup a pointer
RodrigoVillar May 8, 2025
3e2294f
default => new
RodrigoVillar May 8, 2025
781bf60
convert tracker from interface to impl
RodrigoVillar May 9, 2025
b0ae321
single generic on gradual orchestrator
RodrigoVillar May 9, 2025
4daa6b0
merge burst into gradual
RodrigoVillar May 9, 2025
4232002
remove unnecessary orchestrator interface
RodrigoVillar May 9, 2025
3ba6372
rm dependencies.go
RodrigoVillar May 9, 2025
a35ceef
rename gradual orchestrator to just orchestrator
RodrigoVillar May 9, 2025
9f9eebd
add doc for NewOrchestratorConfig()
RodrigoVillar May 9, 2025
c1e5ace
use int64 throughout orchestrator
RodrigoVillar May 9, 2025
8549ec2
use type constraint for txIDs
RodrigoVillar May 9, 2025
3b1632a
Merge branch 'add-load-framework' into qdm12/tests/load
qdm12 May 12, 2025
d521e30
Unexport Distribute
qdm12 May 12, 2025
8113fd2
Update dashboard
qdm12 May 12, 2025
2963c89
Update dashboard
qdm12 May 12, 2025
ad060bb
Issuer implementation as config option
qdm12 May 12, 2025
ae437f3
Remove periodic log of tracker
qdm12 May 13, 2025
7064e1d
Lower tx rate multiplier to 1.05
qdm12 May 13, 2025
84c6ac1
Increase nodes count from 1 to 3
qdm12 May 13, 2025
f199d84
Reset sustained time to default 20s
qdm12 May 13, 2025
14c44f9
Remove unneeded logger from tracker
qdm12 May 13, 2025
a72032b
Fix copyright notices
qdm12 May 13, 2025
f2ddaf5
Fix ginkgo command for C chain tests
qdm12 May 13, 2025
be69a42
Add CI step to check contract bindings are up to date
qdm12 May 13, 2025
8217ce4
Ignore .bindings.go for copyright check
qdm12 May 13, 2025
2f05785
Run with 5 nodes at least
qdm12 May 14, 2025
e057026
Format solidity contract
qdm12 May 15, 2025
4f6ea60
Emit storage update for simulate call depth function
qdm12 May 15, 2025
7c32918
createAgent helper function
qdm12 May 15, 2025
a594234
createAgents helping function
qdm12 May 15, 2025
4cb0924
parallel agents creation
qdm12 May 15, 2025
8bfb800
Add intro to readme
qdm12 May 15, 2025
064c91e
Add contract creation testing
qdm12 May 16, 2025
4990e24
Add solhint to contract bindings generation script
qdm12 May 16, 2025
b86e904
Fix orchestrator bug
qdm12 May 16, 2025
0521a48
Add pure compute contract function
qdm12 May 16, 2025
1a6fab1
load/c/issuers/opcode: remove unused field lastIssue
qdm12 May 16, 2025
395676e
Large event emission simulation function
qdm12 May 16, 2025
7ba62b9
External contract call simulation function
qdm12 May 16, 2025
a100eb1
Remove unneeded ensureKey calls
qdm12 May 16, 2025
53e717a
Rename `config` to `loadConfig`
qdm12 May 19, 2025
f9e8ec0
wip bump gas limit per second
qdm12 May 19, 2025
4114688
Use max possible fee cap for simple txs
qdm12 May 20, 2025
201be41
Use coreth with high gas limit
qdm12 May 20, 2025
2a68455
Distribute uses the max fee cap (100 eth) to send its transactions
qdm12 May 20, 2025
41125d7
Set pre-funded keys to the number of agents
qdm12 May 20, 2025
564610a
Remove now unneeded distribution
qdm12 May 20, 2025
33b8146
Use secp256k1.PrivateKey to simplify code
qdm12 May 20, 2025
b778684
ci: load test monitoring (#3959)
Elvis339 May 20, 2025
559c39a
Bump rate multiplier to 1.1
qdm12 May 20, 2025
3aa0e99
Set config values that pass
qdm12 May 20, 2025
b24bf80
Try (fail) setting the gas limit without touching coreth
qdm12 May 20, 2025
26c8f3f
Remove unneeded EnsureKeys
qdm12 May 20, 2025
49ee4fe
ci: rename e2e_load to load_tests
qdm12 May 20, 2025
87faf42
taskfile: rename test-e2e-load to test-load
qdm12 May 20, 2025
8cc8864
Rename ginkgo_test.go to load_test.go
qdm12 May 20, 2025
a9b13cc
Use avalanche-monitoring grafana dashboard json
qdm12 May 21, 2025
9380693
Revert "Try (fail) setting the gas limit without touching coreth"
qdm12 May 21, 2025
3a6809d
Update readme for both remote and local visualization
qdm12 May 21, 2025
a657afc
Update readme for remote grafana
qdm12 May 21, 2025
c9cb787
fix(metrics): set server address for Prometheus scrape config
qdm12 May 21, 2025
35c13d1
Merge branch 'master' into qdm12/tests/load
qdm12 May 21, 2025
5aeb776
Import libevm instead of coreth for params package
qdm12 May 21, 2025
3de4dda
c/issuers/simple: remove unused lastIssue field
qdm12 May 21, 2025
7c0b301
c/readme: fix path to entrypoint as load_test.go
qdm12 May 21, 2025
d067e02
Use `task test-load`
qdm12 May 21, 2025
e2ecc1c
Fix CI workflow to run test-load task
qdm12 May 21, 2025
a60a5e8
ci: remove `filter_by_owner` field
qdm12 May 21, 2025
0a58664
Run generate-load-contract-bindings as part of load test task
qdm12 May 21, 2025
aa6e241
Remove load test command from e2e readme
qdm12 May 21, 2025
bb97a1e
ci: remove Contract bindings are up to date since it's already part o…
qdm12 May 21, 2025
9c79e06
Use abigen from go.mod libevm version
qdm12 May 22, 2025
de7dd40
Change ci artificat prefix to load
qdm12 May 22, 2025
93b5eef
Reduce flake.nix solc comment
qdm12 May 22, 2025
8d55364
Restrict contract bindings generation to c directory
qdm12 May 22, 2025
6f138ca
Restrict unit test exclusion from tests/load to tests/load/c
qdm12 May 22, 2025
b079371
`BuildMetricsURLForNetwork` -> `BuildMonitoringURLForNetwork`
qdm12 May 22, 2025
615eab7
Remove redundant comment on network_uuid presence
qdm12 May 22, 2025
daebfdc
Remove _test.go suffix from contract bindings generate file
qdm12 May 22, 2025
abd5354
Add --start-collectors flag to test-load task
qdm12 May 22, 2025
3a47e2d
Update load/c/readme to use nix and the test-load task
qdm12 May 22, 2025
26dc86a
Change wording to "CI monitoring stack"
qdm12 May 22, 2025
66fa3a4
Improve wording for step 1 of private remote instance
qdm12 May 22, 2025
fc1251b
readme: prometheus -> monitoring (prometheus+loki)
qdm12 May 22, 2025
69bb305
Replace --start-collectors with `--start-metrics-collector --start-lo…
qdm12 May 22, 2025
d8896cc
Export and use `tmpnet.GetServiceDiscoveryDir`
qdm12 May 22, 2025
da8b904
Shorten GenerateMonitoringConfig comment
qdm12 May 22, 2025
c7d2beb
Use github.com/ava-labs/avalanchego/utils/perms
qdm12 May 22, 2025
45d4f86
Use require.NoError in load_test.go
qdm12 May 22, 2025
2aba1cd
Remove unneeded network.Nodes[:nodesCount]
qdm12 May 22, 2025
d3d8661
Remove unneeded logger from metrics server
qdm12 May 22, 2025
d45e40b
Use test context logger
qdm12 May 22, 2025
e21dfbd
Use two DeferCleanup
qdm12 May 22, 2025
eeb7581
Remove unused fields in c/issuers/opcode
qdm12 May 22, 2025
4c00861
Remove unneeded maxTipCap
qdm12 May 22, 2025
fd97d80
Remove unneeded NonceAt method in client interface
qdm12 May 22, 2025
4f22990
Issuer picks a tx type according to a weight
qdm12 May 22, 2025
e742788
Merge both load types together
qdm12 May 22, 2025
4ce9359
chore: newTxOpts always set max tip cap to 1
qdm12 May 22, 2025
5736025
Max fee cap set per transaction type in issuer
qdm12 May 22, 2025
7e6af87
Adjust max fee cap for zero self transfers
qdm12 May 22, 2025
177cbbe
Adjust weights to lower contract deployment
qdm12 May 22, 2025
4d61ab1
Fix pinning of libevm/cmd/abigen
qdm12 May 22, 2025
75a659a
More conservative min and max TPS
qdm12 May 22, 2025
72c67d1
Add `test-load-local` task for local monitoring
qdm12 May 22, 2025
d9ea754
Move body of SynchronizedBeforeSuite to BeforeAll
qdm12 May 22, 2025
3952c3a
Revert unrelated auto-formatting diffs
qdm12 May 22, 2025
5c6221b
Update local monitoring instructions to not pollute the source tree
qdm12 May 22, 2025
c1bda80
Merge branch 'master' into qdm12/tests/load
qdm12 May 22, 2025
308e096
Fix pinning of abigen (again)
qdm12 May 22, 2025
3b5e69a
remove ginkgo from load tests
RodrigoVillar May 23, 2025
3d211a7
single test-load task
RodrigoVillar May 23, 2025
ffad23f
remove network owner label
RodrigoVillar May 23, 2025
0e1e388
lint
RodrigoVillar May 23, 2025
9a9ef0f
clean func signatures
RodrigoVillar May 27, 2025
f86a953
Merge branch 'qdm12/tests/load' of github.com:ava-labs/avalanchego in…
Elvis339 May 27, 2025
d5c7fdf
ci: k8s load test
Elvis339 May 28, 2025
9e3feb2
Merge branch 'master' into qdm12/tests/load
RodrigoVillar May 28, 2025
b73f387
clean up issuer
RodrigoVillar May 28, 2025
e1a42f2
ci: rename k8s-load-tests extension from yaml to yml
Elvis339 May 28, 2025
3a1360e
ci: disable CI
Elvis339 May 28, 2025
39b9aac
ci: simplify k8s load tests
Elvis339 May 28, 2025
6c24f2c
Merge branch 'qdm12/tests/load' into arc-load-test
Elvis339 May 28, 2025
2926683
ci: test
Elvis339 May 28, 2025
694cacf
ci: update label
Elvis339 May 28, 2025
3ab9c6a
ci: update label to avalanche-avalanchego-runner
Elvis339 Jun 2, 2025
b92631e
Merge branch 'master' of github.com:ava-labs/avalanchego into arc-loa…
Elvis339 Jun 13, 2025
18ff7c3
ci
Elvis339 Jun 13, 2025
42da393
test ARC runner
Elvis339 Jun 13, 2025
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
445 changes: 231 additions & 214 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions .github/workflows/k8s-load-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: K8s Load Tests

on:
workflow_dispatch:
inputs:
scenario:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a placeholder for something?

description: 'Load test scenario to run'
required: true
default: 'baseline'

permissions:
contents: read

jobs:
load:
name: "K8S Load Test"
runs-on: "self-hosted"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- uses: ./.github/actions/install-nix
- uses: ./.github/actions/run-monitored-tmpnet-cmd
with:
run: ./scripts/run_task.sh test-load
artifact_prefix: load-manual-${{ github.run_number }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prefix can be omitted, it's only necessary when a workflow uses this custom action more than once so that the resulting artifacts can be differentiated.

prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
loki_username: ${{ secrets.LOKI_ID || '' }}
loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
19 changes: 19 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ tasks:
- task: generate-canoto
- task: check-clean-branch

check-generate-load-contract-bindings:
desc: Checks that generated load contract bindings are up-to-date (requires a clean git working tree)
cmds:
- task: generate-load-contract-bindings
- task: check-clean-branch

check-generate-mocks:
desc: Checks that generated mocks are up-to-date (requires a clean git working tree)
cmds:
Expand Down Expand Up @@ -85,6 +91,12 @@ tasks:
desc: Generates canoto
cmd: go generate -run "github.com/StephenButtolph/canoto/canoto" ./...

generate-load-contract-bindings:
desc: Generates load contract bindings
cmds:
- cmd: grep -lr -E '^// Code generated - DO NOT EDIT\.$' tests/load/c | xargs -r rm
- cmd: go generate ./tests/load/c/...

generate-protobuf:
desc: Generates protobuf
cmd: ./scripts/protobuf_codegen.sh
Expand Down Expand Up @@ -198,6 +210,13 @@ tasks:
FUZZTIME: '{{.FUZZTIME| default "900"}}'
cmd: ./scripts/build_fuzz.sh {{.FUZZTIME}} ./x/merkledb

test-load:
desc: Runs load tests
cmds:
- task: generate-load-contract-bindings
- task: build
- cmd: go test ./tests/load/c -test.v -- --avalanchego-path=$PWD/build/avalanchego

test-unit:
desc: Runs unit tests
# Invoking with bash ensures compatibility with CI execution on Windows
Expand Down
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
buf
protoc-gen-go
protoc-gen-go-grpc

# Solidity compiler
solc
] ++ lib.optionals stdenv.isDarwin [
# macOS-specific frameworks
darwin.apple_sdk.frameworks.Security
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/NYTimes/gziphandler v1.1.1
github.com/StephenButtolph/canoto v0.15.0
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/coreth v0.15.1-rc.0.0.20250523163800-aac22d91be3f
github.com/ava-labs/coreth v0.15.1-rc.0.0.20250521122838-a195bad0641e
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60
github.com/ava-labs/libevm v1.13.14-0.2.0.release
github.com/btcsuite/btcd/btcutil v1.1.3
Expand Down
7 changes: 5 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/coreth v0.15.1-rc.0.0.20250523163800-aac22d91be3f h1:3hffiIkjWYrbdufcZEFeT0MWYPQOpFlgcgoSEPMbRw4=
github.com/ava-labs/coreth v0.15.1-rc.0.0.20250523163800-aac22d91be3f/go.mod h1:b7qPAGDlViompJ0+aVkKs/0sHbcIJchhi7kg403jZRA=
github.com/ava-labs/coreth v0.15.1-rc.0.0.20250521122838-a195bad0641e h1:OmaiELSytkGg6Giarkr0I0dsZxEADTruBdan3nUBuGA=
github.com/ava-labs/coreth v0.15.1-rc.0.0.20250521122838-a195bad0641e/go.mod h1:mfvr1iQAADUfqkKkmQXJPwm3q9LSpcWF+fzIGk4HHuw=
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 h1:EL66gtXOAwR/4KYBjOV03LTWgkEXvLePribLlJNu4g0=
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60/go.mod h1:/7qKobTfbzBu7eSTVaXMTr56yTYk4j2Px6/8G+idxHo=
github.com/ava-labs/libevm v1.13.14-0.2.0.release h1:uKGCc5/ceeBbfAPRVtBUxbQt50WzB2pEDb8Uy93ePgQ=
Expand Down Expand Up @@ -258,7 +258,10 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4=
github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
# Load the constants
source "$AVALANCHE_PATH"/scripts/constants.sh

EXCLUDED_TARGETS="| grep -v /mocks | grep -v proto | grep -v tests/e2e | grep -v tests/upgrade | grep -v tests/fixture/bootstrapmonitor/e2e"
EXCLUDED_TARGETS="| grep -v /mocks | grep -v proto | grep -v tests/e2e | grep -v tests/load/c | grep -v tests/upgrade | grep -v tests/fixture/bootstrapmonitor/e2e"

if [[ "$(go env GOOS)" == "windows" ]]; then
# Test discovery for the antithesis test setups is broken due to
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function test_golangci_lint {
_addlicense_flags=${ADDLICENSE_FLAGS:-"--verify --debug"}
function test_license_header {
local files=()
while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -name 'mocks_*.go' ! -path './**/*mock/*.go' ! -name '*.canoto.go')
while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -name 'mocks_*.go' ! -path './**/*mock/*.go' ! -name '*.canoto.go' ! -name '*.bindings.go')

# shellcheck disable=SC2086
go run github.com/palantir/go-license@v1.25.0 \
Expand Down
7 changes: 4 additions & 3 deletions tests/fixture/tmpnet/monitor_processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func startPrometheus(ctx context.Context, log logging.Logger) error {
return err
}

serviceDiscoveryDir, err := getServiceDiscoveryDir(cmdName)
serviceDiscoveryDir, err := GetServiceDiscoveryDir(cmdName)
if err != nil {
return err
}
Expand Down Expand Up @@ -216,7 +216,7 @@ func startPromtail(ctx context.Context, log logging.Logger) error {
return err
}

serviceDiscoveryDir, err := getServiceDiscoveryDir(cmdName)
serviceDiscoveryDir, err := GetServiceDiscoveryDir(cmdName)
if err != nil {
return err
}
Expand Down Expand Up @@ -253,7 +253,8 @@ func getWorkingDir(cmdName string) (string, error) {
return filepath.Join(tmpnetDir, cmdName), nil
}

func getServiceDiscoveryDir(cmdName string) (string, error) {
// GetServiceDiscoveryDir returns the service discovery directory path.
func GetServiceDiscoveryDir(cmdName string) (string, error) {
tmpnetDir, err := getTmpnetPath()
if err != nil {
return "", err
Expand Down
56 changes: 55 additions & 1 deletion tests/fixture/tmpnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (
"encoding/json"
"errors"
"fmt"
"maps"
"net/netip"
"net/url"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -57,6 +59,9 @@ const (

// eth address: 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
HardHatKeyStr = "56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027"

// grafanaURI is remote Grafana URI
grafanaURI = "grafana-poc.avax-dev.network"
)

var (
Expand Down Expand Up @@ -1070,9 +1075,58 @@ func MetricsLinkForNetwork(networkUUID string, startTime string, endTime string)
endTime = "now"
}
return fmt.Sprintf(
"https://grafana-poc.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?&var-filter=network_uuid%%7C%%3D%%7C%s&var-filter=is_ephemeral_node%%7C%%3D%%7Cfalse&from=%s&to=%s",
"https://%s/d/kBQpRdWnk/avalanche-main-dashboard?&var-filter=network_uuid%%7C%%3D%%7C%s&var-filter=is_ephemeral_node%%7C%%3D%%7Cfalse&from=%s&to=%s",
grafanaURI,
networkUUID,
startTime,
endTime,
)
}

// GrafanaFilterOptions contains filters to apply to Grafana link in form of a query
// Example: https://grafana-poc.avax-dev.network/?start_time=now-1h&endTime=now
type GrafanaFilterOptions struct {
StartTime string
EndTime string
Filters map[string]string
}

func BuildMonitoringURLForNetwork(dashboardID, dashboardName, networkUUID string, options GrafanaFilterOptions) string {
// Set defaults for options if not provided
startTime := "now-1h"
if options.StartTime != "" {
startTime = options.StartTime
}

endTime := "now"
if options.EndTime != "" {
endTime = options.EndTime
}

baseURL := url.URL{
Scheme: "https",
Host: grafanaURI,
Path: fmt.Sprintf("/d/%s/%s", dashboardID, dashboardName),
}

query := baseURL.Query()

query.Add("from", startTime)
query.Add("to", endTime)

filters := make(map[string]string)
if options.Filters != nil {
filters = maps.Clone(options.Filters)
}

if _, exists := filters["network_uuid"]; !exists {
filters["network_uuid"] = networkUUID
}

for key, value := range filters {
query.Add("var-filter", fmt.Sprintf("%s|=|%s", key, value))
}

baseURL.RawQuery = query.Encode()
return baseURL.String()
}
2 changes: 1 addition & 1 deletion tests/fixture/tmpnet/process_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (p *ProcessRuntime) writeMonitoringConfig() error {
func (p *ProcessRuntime) getMonitoringConfigPath(name string) (string, error) {
// Ensure a unique filename to allow config files to be added and removed
// by multiple nodes without conflict.
serviceDiscoveryDir, err := getServiceDiscoveryDir(name)
serviceDiscoveryDir, err := GetServiceDiscoveryDir(name)
if err != nil {
return "", err
}
Expand Down
22 changes: 22 additions & 0 deletions tests/fixture/tmpnet/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"net"
"net/url"
"os"
"syscall"
"time"
Expand Down Expand Up @@ -91,6 +92,27 @@ func FilterAvailableNodes(nodes []*Node) []*Node {
return filteredNodes
}

// GetNodeWebsocketURIs returns a list of websocket URIs for the given nodes and
// blockchain ID, in the form "ws://<node-uri>/ext/bc/<blockchain-id>/ws".
// Ephemeral and stopped nodes are ignored.
func GetNodeWebsocketURIs(ctx context.Context, nodes []*Node, blockchainID string) ([]string, error) {
deferCleanup := func(func()) {}
nodeURIs, err := GetNodeURIs(ctx, nodes, deferCleanup)
if err != nil {
return nil, fmt.Errorf("getting node URIs: %w", err)
}
wsURIs := make([]string, len(nodeURIs))
for i := range nodeURIs {
uri, err := url.Parse(nodeURIs[i].URI)
if err != nil {
return nil, fmt.Errorf("parsing uri: %w", err)
}
uri.Scheme = "ws" // use websocket to be able to stream events
wsURIs[i] = fmt.Sprintf("%s/ext/bc/%s/ws", uri, blockchainID)
}
return wsURIs, nil
}

// Marshal to json with default prefix and indent.
func DefaultJSONMarshal(v interface{}) ([]byte, error) {
return json.MarshalIndent(v, "", " ")
Expand Down
Loading