-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add broker query event listener #11437
Add broker query event listener #11437
Conversation
4981c45
to
2cac75b
Compare
Codecov Report
@@ Coverage Diff @@
## master #11437 +/- ##
============================================
+ Coverage 63.04% 63.17% +0.12%
+ Complexity 1108 1106 -2
============================================
Files 2320 2325 +5
Lines 124520 124502 -18
Branches 19011 18989 -22
============================================
+ Hits 78507 78651 +144
+ Misses 40422 40257 -165
- Partials 5591 5594 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 132 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
e51ab49
to
0e803b5
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.
Thanks for starting this effort!
pinot-spi/src/main/java/org/apache/pinot/spi/queryeventlistener/BrokerQueryEventInfo.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/pinot/spi/queryeventlistener/PinotBrokerQueryEventListenerUtils.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/pinot/spi/queryeventlistener/PinotBrokerQueryEventListenerUtils.java
Outdated
Show resolved
Hide resolved
...ain/java/org/apache/pinot/spi/annotations/queryeventlistener/BrokerEventListenerFactory.java
Outdated
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/queryeventlistener/BrokerQueryEventListener.java
Outdated
Show resolved
Hide resolved
@tibrewalpratik17 : Thanks for raising this. Can you enumerate the remaining tasks we need to do in #10606 so that @Jackie-Jiang is also aware of the remaining changes. |
...org/apache/pinot/plugin/query/event/listener/broker/NoOpBrokerQueryEventListenerFactory.java
Outdated
Show resolved
Hide resolved
fed0cf3
to
552921b
Compare
552921b
to
c6ede91
Compare
ee9e58d
to
d0cd024
Compare
d0cd024
to
4817a64
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.
Lgtm. Left some minor comments. cc: @walterddr @Jackie-Jiang can you folks also take a look?
pinot-spi/src/main/java/org/apache/pinot/spi/queryeventlistener/BrokerQueryEventListener.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/pinot/spi/queryeventlistener/PinotBrokerQueryEventListenerUtils.java
Outdated
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/queryeventlistener/BrokerQueryEventInfo.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
Outdated
Show resolved
Hide resolved
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/pinot/spi/eventlistener/query/PinotBrokerQueryEventListenerUtils.java
Outdated
Show resolved
Hide resolved
7b43f3b
to
c465389
Compare
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
Outdated
Show resolved
Hide resolved
public interface BrokerQueryEventListener { | ||
|
||
void init(PinotConfiguration eventListenerConfiguration); | ||
void onQueryCompletion(BrokerQueryEventInfo brokerQueryEventInfo); |
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.
Do we want to also include onQueryFailure
? Counting failed query as completed could cause confusion and unexpected behavior
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.
Umm we can have a separate onQueryFailure
as well but I was planning to leverage errorCode to differentiate between onQuerySuccess
and onQueryFailure
. But let me know if onQueryCompletion
is really confusing.
pinot-spi/src/main/java/org/apache/pinot/spi/eventlistener/query/BrokerQueryEventInfo.java
Outdated
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/trace/RequestContext.java
Outdated
Show resolved
Hide resolved
pinot-spi/src/main/java/org/apache/pinot/spi/eventlistener/query/BrokerQueryEventListener.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/pinot/spi/eventlistener/query/PinotBrokerQueryEventListenerUtils.java
Outdated
Show resolved
Hide resolved
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.
looks good to me on the higher 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.
did another pass and looks good mostly. please kindly follow up with comments
@siddharthteotia @jackjlli Can you also help take a look at this PR? I think this should be very similar to what LinkedIn is doing |
Hey @Jackie-Jiang @walterddr can we merge this? |
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 on LinkedIn side. Thanks for making the code change!
labels:
In #10606 we discussed adding the support for pluggable query event listener. This PR scaffolds the logic for that and is first among series of PRs.
In this PR, we are adding the support for broker query-level event listener. We can register a custom implementation for a broker-level event-listener and pass the class path as a config -
pinot.broker.event.listener.factory.className
and define our own implementation ofonQueryCompletion
method of theBrokerQueryEventListener
interface.Tested this locally by logging the BrokerQueryEventInfo object values in the NoOpBrokerQueryEventListener implementation. It worked as expected.
Re-posting the design doc here -- https://docs.google.com/document/d/11UeU6eNTlyEJ9G096j9XT57QuWgbuCtwnfTC5TQpQ8M/edit#heading=h.uc9rahlz5o0x
cc @ankitsultana