tillrohrmann commented on a change in pull request #18158: URL: https://github.com/apache/flink/pull/18158#discussion_r776192128
########## File path: flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java ########## @@ -137,6 +137,15 @@ .noDefaultValue() .withDescription("JVM heap size (in megabytes) for the JobManager."); + /** The maximum stacktrace depth of JobManager's thread dump web-frontend displayed. */ + @Documentation.Section(Documentation.Sections.ALL_JOB_MANAGER) + public static final ConfigOption<Integer> THREAD_DUMP_STACKTRACE_MAX_DEPTH = + key("jobmanager.thread-dump.stacktrace-max-depth") Review comment: Do we want to have two configuration options or would a single one be easier for the user to control/configure? ########## File path: flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/ThreadDumpInfoTest.java ########## @@ -48,4 +55,35 @@ protected void assertOriginalEqualsToUnmarshalled( assertThat( actual.getThreadInfos(), containsInAnyOrder(expected.getThreadInfos().toArray())); } + + @Test + public void testComparedWithDefaultJDKImplemetation() { + ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); + ThreadInfo threadInfo = + threadMxBean.getThreadInfo(Thread.currentThread().getId(), Integer.MAX_VALUE); + + String stringifyThreadInfo = ThreadDumpInfo.stringifyThreadInfo(threadInfo, 8); + assertEquals(threadInfo.toString(), stringifyThreadInfo); + } + + @Test + public void testStacktraceDepthLimitation() { + ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean(); + ThreadInfo threadInfo = + threadMxBean.getThreadInfo(Thread.currentThread().getId(), Integer.MAX_VALUE); + + int expectedStacktraceDepth = threadInfo.getStackTrace().length; + + String stringifiedInfo = ThreadDumpInfo.stringifyThreadInfo(threadInfo, Integer.MAX_VALUE); + assertEquals(expectedStacktraceDepth, getOutputDepth(stringifiedInfo)); + + String stringifiedInfoExceedMaxDepth = + ThreadDumpInfo.stringifyThreadInfo(threadInfo, expectedStacktraceDepth - 1); + assertEquals(expectedStacktraceDepth - 1, getOutputDepth(stringifiedInfoExceedMaxDepth)); + assertTrue(stringifiedInfoExceedMaxDepth.contains("\t...")); Review comment: Nice :-) -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org