Skip to content
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 more information in RequestContext class #11708

Merged

Conversation

tibrewalpratik17
Copy link
Contributor

As per discussion in #11437 (comment) adding more information to RequestContext class. Most of the fields already existed in BrokerResponse so adding more information in RequestContext class to use in Event Listener implementation as part of #10606.

@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2023

Codecov Report

Merging #11708 (b999b60) into master (cf8fd93) will increase coverage by 0.01%.
Report is 33 commits behind head on master.
The diff coverage is 19.69%.

@@             Coverage Diff              @@
##             master   #11708      +/-   ##
============================================
+ Coverage     63.04%   63.06%   +0.01%     
  Complexity     1117     1117              
============================================
  Files          2342     2342              
  Lines        125780   125978     +198     
  Branches      19334    19370      +36     
============================================
+ Hits          79301    79451     +150     
- Misses        40828    40874      +46     
- Partials       5651     5653       +2     
Flag Coverage Δ
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 63.03% <19.69%> (+0.02%) ⬆️
java-17 62.91% <19.69%> (+0.01%) ⬆️
java-20 62.93% <19.69%> (+0.03%) ⬆️
temurin 63.06% <19.69%> (+0.01%) ⬆️
unittests 63.06% <19.69%> (+0.01%) ⬆️
unittests1 67.19% <0.00%> (+0.01%) ⬆️
unittests2 14.42% <19.69%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...roker/requesthandler/BaseBrokerRequestHandler.java 47.12% <100.00%> (+0.72%) ⬆️
...ava/org/apache/pinot/spi/trace/RequestContext.java 0.00% <ø> (ø)
...thandler/SingleConnectionBrokerRequestHandler.java 18.18% <0.00%> (-0.24%) ⬇️
...requesthandler/MultiStageBrokerRequestHandler.java 18.97% <0.00%> (-0.29%) ⬇️
.../apache/pinot/spi/trace/DefaultRequestContext.java 0.00% <0.00%> (ø)

... and 117 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Jackie-Jiang
Copy link
Contributor

@siddharthteotia @jackjlli Can you take a look?

@tibrewalpratik17
Copy link
Contributor Author

@walterddr @Jackie-Jiang can you please review?

}

@Override
public void setNumConsumingSegmentsQueried(long numConsumingSegmentsQueried) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) I think we can use int instead of long here. May not really matter in the grand scheme of things but off late we have seen a lot of heap usage improvement opportunities from production heap dumps. So just something to consider

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this long is from BrokerResponse

@@ -63,6 +67,19 @@ public class DefaultRequestContext implements RequestScope {

private FanoutType _fanoutType;
private int _numUnavailableSegments;
private long _numConsumingSegmentsQueried;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this PR -- I don't think we track RequestCompilationTime in BrokerResponse or RequestContext statistics. It is emitted as a metric from the code.

But I guess we should. Within LinkedIn we have always had requests that can take tens to hundreds of ms to compile a query. Will become more relevant in the context of multi stage engine imo.

Need not necessarily do as part of this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the plan is to add more metrics as need be. Thanks for bring this up - RequestCompilationTime. I am planning to add stageStats as well for multistage queries but that needs some discussion. Will take adding RequestCompilationTime in a follow-up PR. This PR tries to get alignment between brokerResponse and RequestContext class.

Comment on lines +208 to +210
Map<String, String> getTraceInfo();

void setTraceInfo(Map<String, String> traceInfo);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure default creating these for tracing is a good idea. normally we dont enable tracing for production use case, so for those that were manually enabled, those must've been monitored and thus renders it less useful to keep the event listener (e.g. there's a human tracking it already)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but we would still want to keep the trace-info in the event so that we can persist it in Kafka / Hive and refer it later.

@tibrewalpratik17
Copy link
Contributor Author

hey @walterddr can you help in reviewing this?

Copy link
Contributor

@walterddr walterddr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@xiangfu0 xiangfu0 merged commit 36be75f into apache:master Oct 15, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants