Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DD70B200AE3 for ; Tue, 3 May 2016 01:52:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DC2661602C5; Tue, 3 May 2016 01:52:18 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 374F01609B2 for ; Tue, 3 May 2016 01:52:18 +0200 (CEST) Received: (qmail 3253 invoked by uid 500); 2 May 2016 23:52:17 -0000 Mailing-List: contact dev-help@apex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.incubator.apache.org Delivered-To: mailing list dev@apex.incubator.apache.org Received: (qmail 3233 invoked by uid 99); 2 May 2016 23:52:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 May 2016 23:52:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D71B81A0C4D for ; Mon, 2 May 2016 23:52:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id grD04ShB8hXX for ; Mon, 2 May 2016 23:52:15 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 0C8AD5FBB9 for ; Mon, 2 May 2016 23:52:13 +0000 (UTC) Received: (qmail 2209 invoked by uid 99); 2 May 2016 23:52:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 May 2016 23:52:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 1D7592C1F5D for ; Mon, 2 May 2016 23:52:13 +0000 (UTC) Date: Mon, 2 May 2016 23:52:13 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@apex.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (APEXCORE-330) Ability to obtain a thread dump from a container MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 02 May 2016 23:52:19 -0000 [ https://issues.apache.org/jira/browse/APEXCORE-330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15267758#comment-15267758 ] ASF GitHub Bot commented on APEXCORE-330: ----------------------------------------- Github user davidyan74 commented on a diff in the pull request: https://github.com/apache/incubator-apex-core/pull/321#discussion_r61823831 --- Diff: engine/src/main/java/com/datatorrent/stram/StramUtils.java --- @@ -81,4 +89,48 @@ } } + public static JSONObject getJsonFormat() + { + Map stackTraces = Thread.getAllStackTraces(); + + JSONObject jsonObject = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + + for (Map.Entry elements : stackTraces.entrySet()) { + + JSONObject jsonThreads = new JSONObject(); + + Thread thread = elements.getKey(); + + try { + + jsonThreads.put("name", thread.getName()); + jsonThreads.put("state", thread.getState()); + jsonThreads.put("id", thread.getId()); + + JSONArray stacks = new JSONArray(); + + for ( StackTraceElement stackTraceElement: elements.getValue()) { + + stacks.put(stackTraceElement.toString()); + } + + jsonThreads.put("stackTraceElement", stacks); + + jsonArray.put(jsonThreads); + } catch (Exception ex) { + LOG.warn("Getting stack trace for the thread " + thread.getName() + " failed."); + continue; + } + } + + try { + jsonObject.put("threads", jsonArray); + } catch (JSONException e) { + throw new RuntimeException(e.toString()); --- End diff -- new RuntimeException(e) > Ability to obtain a thread dump from a container > ------------------------------------------------ > > Key: APEXCORE-330 > URL: https://issues.apache.org/jira/browse/APEXCORE-330 > Project: Apache Apex Core > Issue Type: Improvement > Reporter: Thomas Weise > Assignee: Sandesh > > To analyze issues such as "stuck operator", it is useful to obtain stats from the running JVM. Often needed are GC stats and thread dump. In production environments users often don't have direct access to the machines, making it available through the REST API will help. -- This message was sent by Atlassian JIRA (v6.3.4#6332)