Skip to content

Commit

Permalink
Defined a new broker metric for total query processing time (#8941)
Browse files Browse the repository at this point in the history
* Defined a new broker metric for total query processing time and added metric to broker.yaml

* change metric type to Timer and verified that it works

* reverting package-lock updates
  • Loading branch information
navina authored Jun 24, 2022
1 parent 47c637c commit 6582750
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ rules:
cache: true
labels:
table: "$1"
- pattern: "\"org.apache.pinot.common.metrics\"<type=\"BrokerMetrics\", name=\"pinot.broker.(\\w+)\\.queryTotalTimeMs\"><>(\\w+)"
name: "pinot_broker_queryTotalTimeMs_$2"
cache: true
labels:
table: "$1"
- pattern: "\"org.apache.pinot.common.metrics\"<type=\"BrokerMetrics\", name=\"pinot.broker.(\\w+)_(\\w+).serverMissingForRouting\"><>(\\w+)"
name: "pinot_broker_serverMissingForRouting_$3"
cache: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ rules:
cache: true
labels:
table: "$1"
- pattern: "\"org.apache.pinot.common.metrics\"<type=\"BrokerMetrics\", name=\"pinot.broker.(\\w+)\\.queryTotalTimeMs\"><>(\\w+)"
name: "pinot_broker_queryTotalTimeMs_$2"
cache: true
labels:
table: "$1"
- pattern: "\"org.apache.pinot.common.metrics\"<type=\"BrokerMetrics\", name=\"pinot.broker.(\\w+)\\.reduce\"><>(\\w+)"
name: "pinot_broker_reduce_$2"
cache: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.pinot.common.metrics.BrokerMeter;
import org.apache.pinot.common.metrics.BrokerMetrics;
import org.apache.pinot.common.metrics.BrokerQueryPhase;
import org.apache.pinot.common.metrics.BrokerTimer;
import org.apache.pinot.common.request.BrokerRequest;
import org.apache.pinot.common.request.Expression;
import org.apache.pinot.common.request.ExpressionType;
Expand Down Expand Up @@ -585,6 +586,8 @@ private BrokerResponseNative handleRequest(long requestId, String query, JsonNod
brokerResponse.setTimeUsedMs(totalTimeMs);
requestContext.setQueryProcessingTime(totalTimeMs);
augmentStatistics(requestContext, brokerResponse);
_brokerMetrics.addTimedTableValue(rawTableName, BrokerTimer.QUERY_TOTAL_TIME_MS, totalTimeMs,
TimeUnit.MILLISECONDS);

logBrokerResponse(requestId, query, requestContext, tableName, numUnavailableSegments, serverStats, brokerResponse,
totalTimeMs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum BrokerTimer implements AbstractMetrics.Timer {
ROUTING_TABLE_UPDATE_TIME(true),
CLUSTER_CHANGE_QUEUE_TIME(true), // metric tracking the freshness lag for consuming segments
FRESHNESS_LAG_MS(false),
QUERY_TOTAL_TIME_MS(false),

// The latency of sending the request from broker to server
NETTY_CONNECTION_SEND_REQUEST_LATENCY(false),
Expand Down

0 comments on commit 6582750

Please sign in to comment.