-
Notifications
You must be signed in to change notification settings - Fork 77
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
feat: improved metrics and added rate limit for the batch request feature in ws server (#2474) #2487
feat: improved metrics and added rate limit for the batch request feature in ws server (#2474) #2487
Conversation
128d723
to
bc20cf4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG.
Missing acceptance tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as @Nana-EC pointed is missing UT for rate limits.
also, atm we don't do automated tests for metrics
but we usually add a screenshot of the /metrics
endpoint where you can see the metrics added with some values on Notes for reviewer: section of the PR description.
2bdf561
to
293328b
Compare
49d491e
to
44ba45d
Compare
added prrof for metrics |
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
44ba45d
to
1713c0f
Compare
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -47,6 +47,7 @@ jobs: | |||
uses: ./.github/workflows/acceptance-workflow.yml | |||
with: | |||
testfilter: ratelimiter | |||
test_ws_server: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: what's this config and why is it just for ws.
Shouldn't we test all the time or if there is a config shouldn't there be on for the HTTP and the WS server each?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: what's this config and why is it just for ws.
This config sets the process.env.TEST_WS_SERVER
variable in the CI job. The test program uses this TEST_WS_SERVER
environment variable to determine whether to run the WS server, as shown here.
Shouldn't we test all the time or if there is a config shouldn't there be on for the HTTP and the WS server each?
We didn't have tests for rate limiting on the WS server until this PR. Previously, we only had them for the HTTP server. That's why this workflow has been running exclusively against the HTTP server.
…ture in ws server (#2474) (#2487) * feat: added shouldRateLimitOnMethod() to connectionLimiter Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> * feat: applied shouldRateLimitOnMethod() on batch requests Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> * feat: applied shouldRateLimitOnMethod() on single requests Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> * feat: added methodsCounter metric for batch_requests Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> * fix: skipped rateLimit for eth_subscribe and eth_unsubscribe Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> * test: added acceptancetest for rate limiter in the WS Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> * test: enabled test_ws_server in ratelimiter CI Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com> --------- Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
feat: improved metrics and added rate limit for the batch request feature in ws server (#2474) (#2487) * feat: added shouldRateLimitOnMethod() to connectionLimiter * feat: applied shouldRateLimitOnMethod() on batch requests * feat: applied shouldRateLimitOnMethod() on single requests * feat: added methodsCounter metric for batch_requests * fix: skipped rateLimit for eth_subscribe and eth_unsubscribe * test: added acceptancetest for rate limiter in the WS * test: enabled test_ws_server in ratelimiter CI --------- Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Description:
shouldRateLimitOnMethod()
function to ConnectionLimiter class which utilizes theshouldRateLimit()
method fromRateLimit
class to apply rate limit logic on both batch requests and single requests in the WS serverbatch_requests
methodsacceptancetest:ratelimiter
script to run tests with@web-socket-ratelimiter
tag. This change will add the new acceptancetest to theratelimiter
CI workflowMetrics result:
**Startup:
** After multiple batch requests calls:
Fixes #2474
Notes for reviewer:
Checklist