-
Notifications
You must be signed in to change notification settings - Fork 207
feat: expose the static cost to the middleware and configs #2470
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
base: main
Are you sure you want to change the base?
feat: expose the static cost to the middleware and configs #2470
Conversation
…6-router-expose-the-static-cost-to-the-middleware
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Comment |
Router image scan passed✅ No security vulnerabilities found in image: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2470 +/- ##
==========================================
+ Coverage 1.49% 29.71% +28.21%
==========================================
Files 292 212 -80
Lines 46968 23282 -23686
Branches 431 0 -431
==========================================
+ Hits 703 6918 +6215
+ Misses 45982 15460 -30522
- Partials 283 904 +621
🚀 New features to boost your workflow:
|
router/pkg/config/config.schema.json
Outdated
| }, | ||
| "static_limit": { | ||
| "type": "integer", | ||
| "description": "The maximum allowed static (estimated) cost for a query. Queries exceeding this limit will be rejected before execution. If the limit is 0, this limit isn't applied.", |
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.
We should work with modes here, enforce,measure to make it more explicit.
router/core/context.go
Outdated
| return qps, nil | ||
| } | ||
|
|
||
| func (o *operationContext) StaticCost() (int, error) { |
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.
I recommend rethinking the interface we expose in the module for cost Operation().Cost(). To support more features in the future (dynamic costs), we should make it a struct.
Integrate basic static cost calculation into the router.
Expose the static cost value in the modules.
Enable basic configuration of static cost via config options.
@coderabbitai summary