You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "walterddr (via GitHub)" <gi...@apache.org> on 2023/03/03 03:38:55 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #10364: Add operator level stats to response when tracing is enabled

walterddr commented on code in PR #10364:
URL: https://github.com/apache/pinot/pull/10364#discussion_r1123992574


##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/ExecutionStatsAggregator.java:
##########
@@ -89,7 +90,7 @@ public void aggregate(ServerRoutingInstance routingInstance, DataTable dataTable
   public synchronized void aggregate(@Nullable ServerRoutingInstance routingInstance, Map<String, String> metadata,
       Map<Integer, String> exceptions) {
     // Reduce on trace info.
-    if (_enableTrace) {
+    if (_enableTrace && metadata.containsKey(DataTable.MetadataKey.TRACE_INFO.getName())) {

Review Comment:
   why do we need both checks?



##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/ExecutionStatsAggregator.java:
##########
@@ -117,6 +118,13 @@ public synchronized void aggregate(@Nullable ServerRoutingInstance routingInstan
     String operatorId = metadata.get(DataTable.MetadataKey.OPERATOR_ID.getName());
     if (operatorId != null) {
       _operatorIds.add(operatorId);
+      if (_enableTrace) {
+        Map<String, String> metadataWithoutOperatorId = new HashMap<>(metadata);
+        metadataWithoutOperatorId.remove(DataTable.MetadataKey.OPERATOR_ID);
+        _operatorStats.put(operatorId, metadataWithoutOperatorId);
+      } else {
+        _operatorStats.put(operatorId, new HashMap<>());

Review Comment:
   with this `_operatorIds` can be removed. 



##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/ExecutionStatsAggregator.java:
##########
@@ -117,6 +118,13 @@ public synchronized void aggregate(@Nullable ServerRoutingInstance routingInstan
     String operatorId = metadata.get(DataTable.MetadataKey.OPERATOR_ID.getName());
     if (operatorId != null) {
       _operatorIds.add(operatorId);
+      if (_enableTrace) {
+        Map<String, String> metadataWithoutOperatorId = new HashMap<>(metadata);
+        metadataWithoutOperatorId.remove(DataTable.MetadataKey.OPERATOR_ID);

Review Comment:
   no need to remove the key itself IMO. it is not that much of an overhead compared to doing a map copy. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org