-
Notifications
You must be signed in to change notification settings - Fork 3
feat(router): added support for label overrides #518
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
Conversation
✅
|
|
🐋 This PR was built and pushed to the following Docker images: Image Names: Platforms: Image Tags: Docker metadata{
"buildx.build.ref": "builder-ed913a90-fc5a-4bdd-965f-3b59c64ec412/builder-ed913a90-fc5a-4bdd-965f-3b59c64ec4120/8z1aqajqs01odn30qug4k8rh0",
"containerimage.descriptor": {
"mediaType": "application/vnd.oci.image.index.v1+json",
"digest": "sha256:680ca0a0e370b6c417aa7858b9439508235d050d1346d40dbbddf436e643187c",
"size": 1609
},
"containerimage.digest": "sha256:680ca0a0e370b6c417aa7858b9439508235d050d1346d40dbbddf436e643187c",
"image.name": "ghcr.io/graphql-hive/router:pr-518,ghcr.io/graphql-hive/router:sha-46028c9"
} |
|
/gemini review |
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.
Code Review
This pull request introduces a powerful feature for overriding labels using VRL expressions, which is a great addition for dynamic configuration. The implementation is well-structured, isolating the new logic in an OverrideLabelsEvaluator and using lazy evaluation on the hot path to minimize performance impact. I have one suggestion to further optimize the label evaluation logic to avoid a potentially unnecessary allocation, in line with the repository's performance-first style guide.
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.
Added a few notes, the most crucial one is how we handle errors in cases where evaluation fails
d27aab0 to
7d72014
Compare
12d4bed to
93d3ca7
Compare
ROUTER-163
This pull request introduces a new top-level configuration option,
override_labels, allowing for fine-grained control over progressive override labels (@override(label: "<string>")). This feature enables teams to dynamically activate or deactivate field overrides based on static booleans or runtime expressions evaluated against incoming request data.How to Configure Override Labels
The new
override_labelskey can be added to yourrouter.config.yaml. It accepts a map where each key is the name of an override label and the value defines the condition under which it should be considered "active".Example 1: Static Override
For simple on/off toggling, you can use a boolean value.
Example 2: Dynamic Override with an Expression
For more complex scenarios, you can provide an object with an
expressionkey. The expression is evaluated at runtime for each request using the VRL. If the expression evaluates totrue, the label becomes active for that request.Error Handling
500 Internal Server Errorwith the error codeLABEL_EVALUATION_FAILED.