You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/11/05 10:35:39 UTC

[iotdb] branch QueryMetrics updated: add singleton

This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch QueryMetrics
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/QueryMetrics by this push:
     new 81022af3cb add singleton
81022af3cb is described below

commit 81022af3cb7248ac1f3beb343f8ff1b23e89f725
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Sat Nov 5 18:35:30 2022 +0800

    add singleton
---
 .../org/apache/iotdb/db/mpp/statistics/QueryStatistics.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java b/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java
index f6ba8b3050..e61e22f3ff 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/statistics/QueryStatistics.java
@@ -66,6 +66,10 @@ public class QueryStatistics {
     }
   }
 
+  public static QueryStatistics getInstance() {
+    return QueryStatisticsHolder.INSTANCE;
+  }
+
   public void addCost(String key, long costTimeInNanos) {
     if (tracing.get()) {
       operationStatistics
@@ -115,4 +119,11 @@ public class QueryStatistics {
           + '}';
     }
   }
+
+  private static class QueryStatisticsHolder {
+
+    private static final QueryStatistics INSTANCE = new QueryStatistics();
+
+    private QueryStatisticsHolder() {}
+  }
 }