DRILL-5909: Added new Counter metrics

closes #1019


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/99e4504f
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/99e4504f
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/99e4504f

Branch: refs/heads/master
Commit: 99e4504f2aa9d11a6bc49a57f5edb70f8d621747
Parents: df95709
Author: Prasad Nagaraj Subramanya <prasadn...@gmail.com>
Authored: Wed Nov 1 13:49:43 2017 -0700
Committer: Arina Ielchiieva <arina.yelchiy...@gmail.com>
Committed: Mon Nov 13 11:06:53 2017 +0200

----------------------------------------------------------------------
 .../org/apache/drill/exec/work/foreman/Foreman.java | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/99e4504f/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java 
b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
index 10d8537..a1d150e 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
@@ -126,6 +126,9 @@ public class Foreman implements Runnable {
   private static final Counter enqueuedQueries = 
DrillMetrics.getRegistry().counter("drill.queries.enqueued");
   private static final Counter runningQueries = 
DrillMetrics.getRegistry().counter("drill.queries.running");
   private static final Counter completedQueries = 
DrillMetrics.getRegistry().counter("drill.queries.completed");
+  private static final Counter succeededQueries = 
DrillMetrics.getRegistry().counter("drill.queries.succeeded");
+  private static final Counter failedQueries = 
DrillMetrics.getRegistry().counter("drill.queries.failed");
+  private static final Counter canceledQueries = 
DrillMetrics.getRegistry().counter("drill.queries.canceled");
 
   private final QueryId queryId;
   private final String queryIdString;
@@ -837,6 +840,19 @@ public class Foreman implements Runnable {
         logger.warn("unable to close query manager", e);
       }
 
+      // Incrementing QueryState counters
+      switch (state) {
+        case FAILED:
+          failedQueries.inc();
+          break;
+        case CANCELED:
+          canceledQueries.inc();
+          break;
+        case COMPLETED:
+          succeededQueries.inc();
+          break;
+      }
+
       runningQueries.dec();
       completedQueries.inc();
       try {

Reply via email to