You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/12/18 13:17:23 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #5110: [Enhancement] Add more comprehensive prometheus jvm thread metrics on fe

morningman commented on a change in pull request #5110:
URL: https://github.com/apache/incubator-doris/pull/5110#discussion_r545824488



##########
File path: fe/fe-core/src/main/java/org/apache/doris/monitor/jvm/JvmStats.java
##########
@@ -82,7 +83,27 @@ public static JvmStats jvmStats() {
         }
         Mem mem = new Mem(heapCommitted, heapUsed, heapMax, nonHeapCommitted, nonHeapUsed,
                 Collections.unmodifiableList(pools));
-        Threads threads = new Threads(threadMXBean.getThreadCount(), threadMXBean.getPeakThreadCount());
+
+        int threadsNew = 0;
+        int threadsRunnable = 0;
+        int threadsBlocked = 0;
+        int threadsWaiting = 0;
+        int threadsTimedWaiting = 0;
+        int threadsTerminated = 0;
+        long threadIds[] = threadMXBean.getAllThreadIds();
+        for (ThreadInfo threadInfo : threadMXBean.getThreadInfo(threadIds, 0)) {
+            if (threadInfo == null) continue; // race protection
+            switch (threadInfo.getThreadState()) {
+                case NEW:           threadsNew++;           break;
+                case RUNNABLE:      threadsRunnable++;      break;
+                case BLOCKED:       threadsBlocked++;       break;
+                case WAITING:       threadsWaiting++;       break;
+                case TIMED_WAITING: threadsTimedWaiting++;  break;
+                case TERMINATED:    threadsTerminated++;    break;

Review comment:
       Missing default?




----------------------------------------------------------------
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.

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



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