sunithabeeram commented on a change in pull request #3614: Adding a class to 
get statistics about a request (query) processed by…
URL: https://github.com/apache/incubator-pinot/pull/3614#discussion_r241785820
 
 

 ##########
 File path: 
pinot-broker/src/main/java/com/linkedin/pinot/broker/api/RequestStatistics.java
 ##########
 @@ -0,0 +1,174 @@
+/**
+ * Copyright (C) 2014-2018 LinkedIn Corp. ([email protected])
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.linkedin.pinot.broker.api;
+
+import com.linkedin.pinot.common.response.BrokerResponse;
+
+
+/**
+ * A class to hold the details regarding a request and the statistics.
+ * This object can be used to publish the query processing statistics to a 
stream for
+ * post-processing at a finer level than metrics.
+ */
+public class RequestStatistics {
+  private int _errorCode = 0;
+  private String _pql;
+  private String _tableName = "NotYetParsed";
+  private long _processingTimeMillis = -1;
+
+  private long _totalDocs;
+  private long _numDocsScanned;
+  private long _numEntriesScannedInFilter;
+  private long _numEntriesScannedPostFilter;
+  private long _numSegmentsQueried;
+  private long _numSegmentsProcessed;
+  private long _numSegmentsMatched;
+  private int _numServersQueried;
+  private int _numServersResponded;
+  private boolean _isNumGroupsLimitReached;
+  private int _numExceptions;
+  private String _brokerId;
+  private long _requestId;
+  private long _requestArrivalTimeMillis;
+  private long _reduceTimeNanos;
+
+  public enum FanoutType {
+    OFFLINE,
+    REALTIME,
+    HYBRID
+  }
+
+  private FanoutType _fanoutType;
+
+  public RequestStatistics() {
+  }
+
+  public void setErrorCode(int errorCode) {
+    _errorCode = errorCode;
+  }
+
+  public void setPql(String pql) {
+    _pql = pql;
+  }
+
+  public void setTableName(String tableName) {
+    _tableName = tableName;
+  }
+
+  public void setQueryProcessingTime(long processingTimeMillis) {
+    _processingTimeMillis = processingTimeMillis;
+  }
+
+  public void setStatistics(BrokerResponse brokerResponse) {
+    _totalDocs = brokerResponse.getTotalDocs();
+    _numDocsScanned = brokerResponse.getNumDocsScanned();
+    _numEntriesScannedInFilter = brokerResponse.getNumEntriesScannedInFilter();
+    _numEntriesScannedPostFilter = 
brokerResponse.getNumEntriesScannedPostFilter();
+    _numSegmentsQueried = brokerResponse.getNumSegmentsQueried();
+    _numSegmentsProcessed = brokerResponse.getNumSegmentsProcessed();
+    _numSegmentsMatched = brokerResponse.getNumSegmentsMatched();
+    _numServersQueried = brokerResponse.getNumServersQueried();
+    _numSegmentsProcessed = brokerResponse.getNumSegmentsProcessed();
+    _numServersResponded = brokerResponse.getNumServersResponded();
+    _isNumGroupsLimitReached = brokerResponse.isNumGroupsLimitReached();
+    _numExceptions = brokerResponse.getExceptionsSize();
+  }
+
+  public void setBrokerId(String brokerId) {
+    _brokerId = brokerId;
+  }
+
+  public void setRequestId(long requestId) {
+    _requestId = requestId;
+  }
+
+  public void setRequestArrivalTimeMillis(long requestArrivalTimeMillis) {
+    _requestArrivalTimeMillis = requestArrivalTimeMillis;
+  }
+
+  public void setReduceTimeNanos(long reduceTimeNanos) {
 
 Review comment:
   Although the name does indicate the unit, I think it would be better to 
report this is in millis. Its just easier to deal with all latency numbers in 
the stats as millis so you don't have to mentally switch between units.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to