-
Notifications
You must be signed in to change notification settings - Fork 576
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
Advanced Trigger Filtering Design Proposal #1047
Conversation
/approve cancel Removing my approval to ensure another approver signs off. |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@grantr can you please rebase? web based commit used wrong email that has no CLA. |
c4b2ede
to
083f3db
Compare
(From Ahmed)
083f3db
to
f40f811
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
I've made a few changes to the proposal. Feedback encouraged! Removed the Removed the Brought the spec:
filter:
expression: ce.type == "com.github.pull.create" If the need to specify sibling fields returns, we can add a ### This example is totally made up ###
spec:
filter:
parameterizedExpression:
expression: data.foo.bar == "baz"
schemaRegistry: "https://example.com/schemas" Added an spec:
filter:
attributes:
type: com.github.issue.create
repository: proposals Clarified that only one top-level filter is allowed. This eliminates implicit composition semantics which could mislead the user about the filter's output. Top-level composition filters could be added later if we want to enable that functionality: ### This example is for illustration only and is not actually being proposed ###
spec:
filter:
and:
- attributes:
type: com.github.pull.create
- expression: ce.source.match("knative") Thanks everyone for all your feedback so far! Keep it coming. 😄 /milestone v0.6 |
@grantr: The provided milestone is not valid for this repository. Milestones in this repository: [ Use In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/milestone v0.6.0 |
I created a voting document on this proposal in the team drive. |
docs/broker/filtering.md
Outdated
user.id == "abc123" | ||
``` | ||
|
||
### Exact match on data number field |
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.
nit: Header says Exact match, but the example on L372 is a comparison. Given the L362 note, consider changing this to:
data.latency = 300.0
Though, are there rounding errors, or things like that to worry about?
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.
Good catch, I'll fix that.
In CEL numbers are 64 bit integers or doubles. I guess if you're doing arithmetic in the expression you might have to worry about rounding, but doesn't seem relevant if you're just comparing values.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vaikas-google The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add open questions related to evaluation errors.
[upstream propagation solution](https://github.com/knative/eventing/issues/934) | ||
for delivery efficiency at scale. | ||
|
||
Filters should be easy for the user to specify and simple to interpret at a |
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.
Filters should be easy for the user to specify and simple to interpret at a glance.
lol, said regex, never... 🤣
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.
With great power comes great responsibility
- expression: ce.source.match("knative") | ||
``` | ||
|
||
## Alternatives Considered |
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 do not see the alternative of just a function
. Did you consider implementing a service service wrapper that implements CEL parser and then use that as a ref in the filter spec? It would use the same mechanize as the subscriptions.
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.
For example, use this entire proposal but make a new trigger type?
TriggerCEL -makes-> a serving.service + a trigger with a function ref. And then promote the CEL syntax up to to the spec level?
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 think this would be a useful addition to this section, but I'm a little unclear what UI is being proposed. Can you give an example of the API? Can you briefly describe the benefits and disadvantages from the user's perspective?
/lgtm |
* Add a proposal for advanced filtering * fix typo in example * Add caveat about variable prefixes * pluralize CloudEvents * fix formatting formatted by formatter * Improve readability of complex expression example * CloudEvents fields are called attributes * Fix table formatting (From Ahmed) * Move extensions to the `ce` prefix This makes extension attributes easier to use and promote to official attributes. The `ext` prefix has been removed. * Expand prefix match example Mention startsWith, match, and matches functions. * Check expression syntax in the Trigger webhook * Add versioning caveat * Reimplement SourceAndType as an expression * Remove parse flags Extensions are always parsed anyway by the CloudEvents SDK, so setting parseExtensions to false has no efficiency benefit. Removing the field improves the approachability of the filtering interface. We can detect when parsing the expression whether data fields are used. This provides a more reliable signal than the parseData flag, so the flag is unnecessary. * Simplify syntax and add attributes filter The `cel` level of the expression filter is removed and `expression` is moved up to its place. An `attributes` filter is added to replace `sourceAndType` (now deprecated). Filter combination at the top level is explicitly disallowed. Examples have been added to clarify some unusual cases. * Note that CloudEvents is vague and in flux CloudEvents is still figuring out whether it wants to support numeric values in extensions. Note that there will probably be dragons for a while. * Clarify structured filters alternative This "alternative considered" is about using structured filters exclusively, without an expression language. Be clear that structured filters are fine as long as they compile down to an expression. * Explain choice of exclusive top-level filter * Add filter spec alternatives considered * Correct inequality example * Add open questions section Add open questions related to evaluation errors.
We had some late feedback from teams inside Google suggesting that this proposal might be difficult to implement efficiently at high-scale (for Google and other event providers). I'm recommending that the implementation of this feature be delayed so we can take more time to validate its feasibility for implementers. |
Also, the voting process indicated disagreement about inclusion of the |
This reverts commit c0d555a.
Rendered
This document proposes a design for advanced trigger filtering to complete #930.
/cc @bbrowning @Harwayne since I believe you've expressed interest in this topic.
/kind proposal