You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2022/12/28 04:31:58 UTC
[incubator-streampark] branch liscense created (now 8cc4daeb5)
This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a change to branch liscense
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
at 8cc4daeb5 [Improve] remove jvm-profile plugin and flame-graph module
This branch includes the following new commits:
new 8cc4daeb5 [Improve] remove jvm-profile plugin and flame-graph module
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-streampark] 01/01: [Improve] remove jvm-profile plugin and flame-graph module
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch liscense
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
commit 8cc4daeb55bd3d7cc590143ac4ebfd822146ba23
Author: benjobs <be...@apache.org>
AuthorDate: Wed Dec 28 12:31:37 2022 +0800
[Improve] remove jvm-profile plugin and flame-graph module
---
.github/labeler.yml | 1 -
.github/workflows/maven.yml | 2 +-
build.sh | 3 +-
pom.xml | 1 -
.../streampark-console-service/pom.xml | 6 -
.../src/main/assembly/assembly.xml | 7 -
.../src/main/assembly/bin/flame-graph/README.md | 239 ----
.../src/main/assembly/bin/flame-graph/aix-perf.pl | 32 -
.../main/assembly/bin/flame-graph/difffolded.pl | 115 --
.../src/main/assembly/bin/flame-graph/files.pl | 64 -
.../main/assembly/bin/flame-graph/flamegraph.pl | 1235 --------------------
.../src/main/assembly/bin/flame-graph/jmaps | 121 --
.../main/assembly/bin/flame-graph/pkgsplit-perf.pl | 90 --
.../main/assembly/bin/flame-graph/range-perf.pl | 139 ---
.../main/assembly/bin/flame-graph/record-test.sh | 39 -
.../assembly/bin/flame-graph/stackcollapse-aix.pl | 61 -
.../bin/flame-graph/stackcollapse-bpftrace.pl | 68 --
.../bin/flame-graph/stackcollapse-elfutils.pl | 102 --
.../assembly/bin/flame-graph/stackcollapse-gdb.pl | 74 --
.../assembly/bin/flame-graph/stackcollapse-go.pl | 154 ---
.../bin/flame-graph/stackcollapse-instruments.pl | 26 -
.../flame-graph/stackcollapse-java-exceptions.pl | 73 --
.../bin/flame-graph/stackcollapse-jstack.pl | 180 ---
.../assembly/bin/flame-graph/stackcollapse-ljp.awk | 74 --
.../bin/flame-graph/stackcollapse-perf-sched.awk | 228 ----
.../assembly/bin/flame-graph/stackcollapse-perf.pl | 358 ------
.../assembly/bin/flame-graph/stackcollapse-pmc.pl | 74 --
.../bin/flame-graph/stackcollapse-recursive.pl | 60 -
.../bin/flame-graph/stackcollapse-sample.awk | 231 ----
.../assembly/bin/flame-graph/stackcollapse-stap.pl | 84 --
.../bin/flame-graph/stackcollapse-vsprof.pl | 98 --
.../bin/flame-graph/stackcollapse-vtune.pl | 76 --
.../bin/flame-graph/stackcollapse-xdebug.php | 197 ----
.../main/assembly/bin/flame-graph/stackcollapse.pl | 109 --
.../main/assembly/bin/flame-graph/stackcollapse.py | 49 -
.../src/main/assembly/script/data/mysql-data.sql | 185 ++-
.../src/main/assembly/script/data/pgsql-data.sql | 185 ++-
.../main/assembly/script/schema/mysql-schema.sql | 18 -
.../main/assembly/script/schema/pgsql-schema.sql | 26 -
.../main/assembly/script/upgrade/mysql/2.0.0.sql | 165 +--
.../core/controller/ApplicationController.java | 1 -
.../console/core/controller/MetricsController.java | 54 -
.../console/core/entity/Application.java | 1 -
.../streampark/console/core/entity/FlameGraph.java | 77 --
.../console/core/mapper/FlameGraphMapper.java | 26 -
.../console/core/service/FlameGraphService.java | 32 -
.../core/service/impl/ApplicationServiceImpl.java | 14 -
.../core/service/impl/FlameGraphServiceImpl.java | 106 --
.../streampark/console/core/task/MetricsTask.java | 65 --
.../system/controller/AccessTokenController.java | 1 -
.../src/main/resources/db/data-h2.sql | 3 +-
.../src/main/resources/db/schema-h2.sql | 13 -
.../resources/mapper/core/ApplicationMapper.xml | 1 -
.../resources/mapper/core/FlameGraphMapper.xml | 27 -
.../core/service/ApplicationServiceTest.java | 2 -
.../src/api/flink/app/app.type.ts | 1 -
.../src/api/flink/app/metrics.ts | 45 -
.../api/flink/setting/types/flinkCluster.type.ts | 1 -
.../src/locales/lang/en/flink/app.ts | 1 -
.../src/locales/lang/zh-CN/flink/app.ts | 1 -
.../components/AppView/StartApplicationModal.vue | 13 -
.../src/views/flink/app/hooks/useAppTableAction.ts | 28 -
.../flink/submit/bean/SubmitRequest.scala | 1 -
.../flink/submit/trait/FlinkSubmitTrait.scala | 19 -
streampark-plugin/pom.xml | 72 --
.../streampark-jvm-profiler/.travis.yml | 22 -
.../streampark-jvm-profiler/metricDetails.md | 169 ---
streampark-plugin/streampark-jvm-profiler/pom.xml | 250 ----
.../apache/streampark/plugin/profiling/Agent.java | 43 -
.../streampark/plugin/profiling/AgentImpl.java | 267 -----
.../plugin/profiling/AgentThreadFactory.java | 38 -
.../streampark/plugin/profiling/ArgumentUtils.java | 52 -
.../streampark/plugin/profiling/Arguments.java | 360 ------
.../plugin/profiling/ConfigProvider.java | 32 -
.../streampark/plugin/profiling/Profiler.java | 35 -
.../streampark/plugin/profiling/ProfilerGroup.java | 39 -
.../plugin/profiling/ProfilerRunner.java | 49 -
.../streampark/plugin/profiling/Reporter.java | 31 -
.../plugin/profiling/ShutdownHookRunner.java | 94 --
.../plugin/profiling/YamlConfigProvider.java | 204 ----
.../profiling/example/HelloWorldApplication.java | 77 --
.../plugin/profiling/profiler/Constants.java | 27 -
.../profiling/profiler/CpuAndMemoryProfiler.java | 274 -----
.../plugin/profiling/profiler/IOProfiler.java | 101 --
.../profiler/MethodArgumentCollector.java | 40 -
.../profiling/profiler/MethodArgumentProfiler.java | 104 --
.../profiler/MethodDurationCollector.java | 33 -
.../profiling/profiler/MethodDurationProfiler.java | 122 --
.../profiling/profiler/ProcessInfoProfiler.java | 186 ---
.../plugin/profiling/profiler/ProfilerBase.java | 118 --
.../profiler/StacktraceCollectorProfiler.java | 120 --
.../profiler/StacktraceReporterProfiler.java | 123 --
.../profiling/profiler/ThreadInfoProfiler.java | 122 --
.../profiling/reporter/ConsoleOutputReporter.java | 38 -
.../plugin/profiling/reporter/HttpReporter.java | 78 --
.../transformer/JavaAgentFileTransformer.java | 185 ---
.../transformer/MethodProfilerStaticProxy.java | 63 -
.../plugin/profiling/util/AgentLogger.java | 108 --
.../plugin/profiling/util/ClassAndMethod.java | 68 --
.../profiling/util/ClassAndMethodFilter.java | 60 -
.../util/ClassAndMethodLongMetricBuffer.java | 44 -
.../profiling/util/ClassAndMethodMetricKey.java | 66 --
.../plugin/profiling/util/ClassMethodArgument.java | 89 --
.../profiling/util/ClassMethodArgumentFilter.java | 64 -
.../util/ClassMethodArgumentMetricBuffer.java | 45 -
.../plugin/profiling/util/DummyConfigProvider.java | 31 -
.../plugin/profiling/util/ErrorLogReporter.java | 24 -
.../util/ExponentialBackoffRetryPolicy.java | 85 --
.../plugin/profiling/util/Histogram.java | 52 -
.../plugin/profiling/util/NoopConfigProvider.java | 39 -
.../plugin/profiling/util/ProcFileUtils.java | 170 ---
.../plugin/profiling/util/ProcessUtils.java | 111 --
.../plugin/profiling/util/ReflectionUtils.java | 94 --
.../plugin/profiling/util/SparkAppCmdInfo.java | 68 --
.../plugin/profiling/util/SparkUtils.java | 91 --
.../plugin/profiling/util/Stacktrace.java | 74 --
.../profiling/util/StacktraceMetricBuffer.java | 51 -
.../plugin/profiling/util/StringUtils.java | 239 ----
.../streampark/plugin/profiling/util/Utils.java | 108 --
.../streampark/plugin/profiling/AgentITCase.java | 317 -----
.../plugin/profiling/AgentThreadFactoryTest.java | 46 -
.../streampark/plugin/profiling/ArgumentsTest.java | 274 -----
.../plugin/profiling/ProfilerRunnableTest.java | 53 -
.../plugin/profiling/YamlConfigProviderTest.java | 146 ---
.../profiler/CpuAndMemoryProfilerTest.java | 71 --
.../profiler/MethodArgumentProfilerTest.java | 93 --
.../profiler/MethodDurationProfilerTest.java | 116 --
.../profiler/ProcessInfoProfilerTest.java | 96 --
.../profiler/StacktraceCollectorProfilerTest.java | 279 -----
.../profiler/StacktraceReporterProfilerTest.java | 117 --
.../profiling/profiler/ThreadInfoProfilerTest.java | 68 --
.../reporter/ConsoleOutputReporterTest.java | 31 -
.../transformer/MethodProfilerStaticProxyTest.java | 83 --
.../profiling/util/ClassAndMethodFilterTest.java | 114 --
.../util/ClassAndMethodMetricBufferTest.java | 132 ---
.../util/ClassMethodArgmentMetricBufferTest.java | 99 --
.../util/ClassMethodArgumentFilterTest.java | 130 ---
.../plugin/profiling/util/IOUtilsTest.java | 36 -
.../plugin/profiling/util/ProcFileUtilsTest.java | 391 -------
.../plugin/profiling/util/ReflectionUtilsTest.java | 48 -
.../plugin/profiling/util/SparkUtilsTest.java | 46 -
.../profiling/util/StacktraceMetricBufferTest.java | 252 ----
.../plugin/profiling/util/StringUtilsTest.java | 164 ---
143 files changed, 278 insertions(+), 13855 deletions(-)
diff --git a/.github/labeler.yml b/.github/labeler.yml
index f4a0a5a52..448708458 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -45,7 +45,6 @@ WEB UI:
BACKEND:
- "streampark-console/streampark-console-service/**/*"
- "streampark-common/**/*"
- - "streampark-plugin/**/*"
FLINK:
- "streampark-flink/**/*"
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 8f387a392..663170ede 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -95,5 +95,5 @@ jobs:
- name: Build with Maven
run: ./mvnw -B clean package -P${{ matrix.scala }} -Pconsole -DskipTests
- name: Test with Maven
- run: ./mvnw -B test -P${{ matrix.scala }} -Pconsole -pl '!streampark-plugin/streampark-jvm-profiler,!streampark-console/streampark-console-service' -am
+ run: ./mvnw -B test -P${{ matrix.scala }} -Pconsole -pl '!streampark-console/streampark-console-service' -am
diff --git a/build.sh b/build.sh
index 19f585c3c..196527d21 100755
--- a/build.sh
+++ b/build.sh
@@ -208,8 +208,7 @@ detachedPackage () {
Next, you need to build front-end by yourself.
1) cd $(cd "$PRG_DIR" &>/dev/null && pwd)/streampark-console/streampark-console-webapp
- 2) pnpm install
- 3) pnpm build
+ 2) pnpm install && pnpm build
please visit: https://streampark.apache.org/docs/user-guide/deployment for more detail. \n"""
fi
diff --git a/pom.xml b/pom.xml
index a4694f42d..bc882981c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -970,7 +970,6 @@
<profile>
<id>console</id>
<modules>
- <module>streampark-plugin</module>
<module>streampark-storage</module>
<module>streampark-console</module>
</modules>
diff --git a/streampark-console/streampark-console-service/pom.xml b/streampark-console/streampark-console-service/pom.xml
index 1ae2aca8d..ad39e4154 100644
--- a/streampark-console/streampark-console-service/pom.xml
+++ b/streampark-console/streampark-console-service/pom.xml
@@ -353,12 +353,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.streampark</groupId>
- <artifactId>streampark-jvm-profiler</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<dependency>
<groupId>org.apache.streampark</groupId>
<artifactId>streampark-flink-kubernetes_${scala.binary.version}</artifactId>
diff --git a/streampark-console/streampark-console-service/src/main/assembly/assembly.xml b/streampark-console/streampark-console-service/src/main/assembly/assembly.xml
index 84e3dee99..b6d1b0eb3 100644
--- a/streampark-console/streampark-console-service/src/main/assembly/assembly.xml
+++ b/streampark-console/streampark-console-service/src/main/assembly/assembly.xml
@@ -29,17 +29,10 @@
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<excludes>
- <exclude>org.apache.streampark:streampark-jvm-profiler</exclude>
<exclude>org.apache.streampark:streampark-flink-sqlclient_${scala.binary.version}</exclude>
<exclude>javax.servlet:servlet-api</exclude>
</excludes>
</dependencySet>
- <dependencySet>
- <outputDirectory>plugins</outputDirectory>
- <includes>
- <include>org.apache.streampark:streampark-jvm-profiler</include>
- </includes>
- </dependencySet>
<dependencySet>
<outputDirectory>client</outputDirectory>
<includes>
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/README.md b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/README.md
deleted file mode 100644
index 4e34b0ad7..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/README.md
+++ /dev/null
@@ -1,239 +0,0 @@
-# Flame Graphs visualize profiled code
-
-Main Website: http://www.brendangregg.com/flamegraphs.html
-
-Example (click to zoom):
-
-[](http://www.brendangregg.com/FlameGraphs/cpu-bash-flamegraph.svg)
-
-Click a box to zoom the Flame Graph to this stack frame only. To search and highlight all stack frames matching a
-regular expression, click the _search_ button in the upper right corner or press Ctrl-F. By default, search is case
-sensitive, but this can be toggled by pressing Ctrl-I or by clicking the _ic_ button in the upper right corner.
-
-Other sites:
-
-- The Flame Graph article in ACMQ and
- CACM: http://queue.acm.org/detail.cfm?id=2927301 http://cacm.acm.org/magazines/2016/6/202665-the-flame-graph/abstract
-- CPU profiling using Linux perf\_events, DTrace, SystemTap, or
- ktap: http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html
-- CPU profiling using XCode Instruments: http://schani.wordpress.com/2012/11/16/flame-graphs-for-instruments/
-- CPU profiling using
- Xperf.exe: http://randomascii.wordpress.com/2013/03/26/summarizing-xperf-cpu-usage-with-flame-graphs/
-- Memory profiling: http://www.brendangregg.com/FlameGraphs/memoryflamegraphs.html
-- Other examples, updates, and news: http://www.brendangregg.com/flamegraphs.html#Updates
-
-Flame graphs can be created in three steps:
-
-1. Capture stacks
-2. Fold stacks
-3. flamegraph.pl
-
-1\. Capture stacks
-=================
-Stack samples can be captured using Linux perf\_events, FreeBSD pmcstat (hwpmc), DTrace, SystemTap, and many other
-profilers. See the stackcollapse-\* converters.
-
-### Linux perf\_events
-
-Using Linux perf\_events (aka "perf") to capture 60 seconds of 99 Hertz stack samples, both user- and kernel-level
-stacks, all processes:
-
-```
-# perf record -F 99 -a -g -- sleep 60
-# perf script > out.perf
-```
-
-Now only capturing PID 181:
-
-```
-# perf record -F 99 -p 181 -g -- sleep 60
-# perf script > out.perf
-```
-
-### DTrace
-
-Using DTrace to capture 60 seconds of kernel stacks at 997 Hertz:
-
-```
-# dtrace -x stackframes=100 -n 'profile-997 /arg0/ { @[stack()] = count(); } tick-60s { exit(0); }' -o out.kern_stacks
-```
-
-Using DTrace to capture 60 seconds of user-level stacks for PID 12345 at 97 Hertz:
-
-```
-# dtrace -x ustackframes=100 -n 'profile-97 /pid == 12345 && arg1/ { @[ustack()] = count(); } tick-60s { exit(0); }' -o out.user_stacks
-```
-
-60 seconds of user-level stacks, including time spent in-kernel, for PID 12345 at 97 Hertz:
-
-```
-# dtrace -x ustackframes=100 -n 'profile-97 /pid == 12345/ { @[ustack()] = count(); } tick-60s { exit(0); }' -o out.user_stacks
-```
-
-Switch `ustack()` for `jstack()` if the application has a ustack helper to include translated frames (eg, node.js
-frames; see: http://dtrace.org/blogs/dap/2012/01/05/where-does-your-node-program-spend-its-time/). The rate for
-user-level stack collection is deliberately slower than kernel, which is especially important when using `jstack()` as
-it performs additional work to translate frames.
-
-2\. Fold stacks
-==============
-Use the stackcollapse programs to fold stack samples into single lines. The programs provided are:
-
-- `stackcollapse.pl`: for DTrace stacks
-- `stackcollapse-perf.pl`: for Linux perf_events "perf script" output
-- `stackcollapse-pmc.pl`: for FreeBSD pmcstat -G stacks
-- `stackcollapse-stap.pl`: for SystemTap stacks
-- `stackcollapse-instruments.pl`: for XCode Instruments
-- `stackcollapse-vtune.pl`: for Intel VTune profiles
-- `stackcollapse-ljp.awk`: for Lightweight Java Profiler
-- `stackcollapse-jstack.pl`: for Java jstack(1) output
-- `stackcollapse-gdb.pl`: for gdb(1) stacks
-- `stackcollapse-go.pl`: for Golang pprof stacks
-- `stackcollapse-vsprof.pl`: for Microsoft Visual Studio profiles
-
-Usage example:
-
-```
-For perf_events:
-$ ./stackcollapse-perf.pl out.perf > out.folded
-
-For DTrace:
-$ ./stackcollapse.pl out.kern_stacks > out.kern_folded
-```
-
-The output looks like this:
-
-```
-unix`_sys_sysenter_post_swapgs 1401
-unix`_sys_sysenter_post_swapgs;genunix`close 5
-unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf 85
-unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_closef 26
-unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_setf 5
-unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`audit_getstate 6
-unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`audit_unfalloc 2
-unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`closef 48
-[...]
-```
-
-3\. flamegraph.pl
-================
-Use flamegraph.pl to render a SVG.
-
-```
-$ ./flamegraph.pl out.kern_folded > kernel.svg
-```
-
-An advantage of having the folded input file (and why this is separate to flamegraph.pl) is that you can use grep for
-functions of interest. Eg:
-
-```
-$ grep cpuid out.kern_folded | ./flamegraph.pl > cpuid.svg
-```
-
-Provided Examples
-=================
-
-### Linux perf\_events
-
-An example output from Linux "perf script" is included, gzip'd, as example-perf-stacks.txt.gz. The resulting flame graph
-is example-perf.svg:
-
-[](http://www.brendangregg.com/FlameGraphs/example-perf.svg)
-
-You can create this using:
-
-```
-$ gunzip -c example-perf-stacks.txt.gz | ./stackcollapse-perf.pl --all | ./flamegraph.pl --color=java --hash > example-perf.svg
-```
-
-This shows my typical workflow: I'll gzip profiles on the target, then copy them to my laptop for analysis. Since I have
-hundreds of profiles, I leave them gzip'd!
-
-Since this profile included Java, I used the flamegraph.pl --color=java palette. I've also used stackcollapse-perf.pl
---all, which includes all annotations that help flamegraph.pl use separate colors for kernel and user level code. The
-resulting flame graph uses: green == Java, yellow == C++, red == user-mode native, orange == kernel.
-
-This profile was from an analysis of vert.x performance. The benchmark client, wrk, is also visible in the flame graph.
-
-### DTrace
-
-An example output from DTrace is also included, example-dtrace-stacks.txt, and the resulting flame graph,
-example-dtrace.svg:
-
-[](http://www.brendangregg.com/FlameGraphs/example-dtrace.svg)
-
-You can generate this using:
-
-```
-$ ./stackcollapse.pl example-stacks.txt | ./flamegraph.pl > example.svg
-```
-
-This was from a particular performance investigation: the Flame Graph identified that CPU time was spent in the lofs
-module, and quantified that time.
-
-
-Options
-=======
-See the USAGE message (--help) for options:
-
-USAGE: ./flamegraph.pl [options] infile > outfile.svg
-
- --title TEXT # change title text
- --subtitle TEXT # second level title (optional)
- --width NUM # width of image (default 1200)
- --height NUM # height of each frame (default 16)
- --minwidth NUM # omit smaller functions (default 0.1 pixels)
- --fonttype FONT # font type (default "Verdana")
- --fontsize NUM # font size (default 12)
- --countname TEXT # count type label (default "samples")
- --nametype TEXT # name type label (default "Function:")
- --colors PALETTE # set color palette. choices are: hot (default), mem,
- # io, wakeup, chain, java, js, perl, red, green, blue,
- # aqua, yellow, purple, orange
- --bgcolors COLOR # set background colors. gradient choices are yellow
- # (default), blue, green, grey; flat colors use "#rrggbb"
- --hash # colors are keyed by function name hash
- --cp # use consistent palette (palette.map)
- --reverse # generate stack-reversed flame graph
- --inverted # icicle graph
- --flamechart # produce a flame chart (sort by time, do not merge stacks)
- --negate # switch differential hues (blue<->red)
- --notes TEXT # add notes comment in SVG (for debugging)
- --help # this message
-
- eg,
- ./flamegraph.pl --title="Flame Graph: malloc()" trace.txt > graph.svg
-
-As suggested in the example, flame graphs can process traces of any event, such as malloc()s, provided stack traces are
-gathered.
-
-
-Consistent Palette
-==================
-If you use the `--cp` option, it will use the $colors selection and randomly generate the palette like normal. Any
-future flamegraphs created using the `--cp`
-option will use the same palette map. Any new symbols from future flamegraphs will have their colors randomly generated
-using the $colors selection.
-
-If you don't like the palette, just delete the palette.map file.
-
-This allows your to change your colorscheme between flamegraphs to make the differences REALLY stand out.
-
-Example:
-
-Say we have 2 captures, one with a problem, and one when it was working
-(whatever "it" is):
-
-```
-cat working.folded | ./flamegraph.pl --cp > working.svg
-# this generates a palette.map, as per the normal random generated look.
-
-cat broken.folded | ./flamegraph.pl --cp --colors mem > broken.svg
-# this svg will use the same palette.map for the same events, but a very
-# different colorscheme for any new events.
-```
-
-Take a look at the demo directory for an example:
-
-palette-example-working.svg
-palette-example-broken.svg
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/aix-perf.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/aix-perf.pl
deleted file mode 100644
index 7bb0bad99..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/aix-perf.pl
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-
-getopt('urt');
-
-unless ($opt_r && $opt_t) {
- print "Usage: $0 [ -u user] -r sample_count -t sleep_time\n";
- exit(0);
-}
-
-my $i;
-my @proc = "";
-for ($i = 0; $i < $opt_r; $i++) {
- if ($opt_u) {
- $proc = `/usr/sysv/bin/ps -u $opt_u `;
- $proc =~ s/^.*\n//;
- $proc =~ s/\s*(\d+).*\n/\1 /g;
- @proc = split(/\s+/, $proc);
- }
- else {
- opendir(my $dh, '/proc') || die "Cant't open /proc: $!";
- @proc = grep {/^[\d]+$/} readdir($dh);
- closedir($dh);
- }
-
- foreach my $pid (@proc) {
- my $command = "/usr/bin/procstack $pid";
- print `$command 2>/dev/null`;
- }
- select(undef, undef, undef, $opt_t);
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/difffolded.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/difffolded.pl
deleted file mode 100644
index 94f558f43..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/difffolded.pl
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/perl -w
-#
-# difffolded.pl diff two folded stack files. Use this for generating
-# flame graph differentials.
-#
-# USAGE: ./difffolded.pl [-hns] folded1 folded2 | ./flamegraph.pl > diff2.svg
-#
-# Options are described in the usage message (-h).
-#
-# The flamegraph will be colored based on higher samples (red) and smaller
-# samples (blue). The frame widths will be based on the 2nd folded file.
-# This might be confusing if stack frames disappear entirely; it will make
-# the most sense to ALSO create a differential based on the 1st file widths,
-# while switching the hues; eg:
-#
-# ./difffolded.pl folded2 folded1 | ./flamegraph.pl --negate > diff1.svg
-#
-# Here's what they mean when comparing a before and after profile:
-#
-# diff1.svg: widths show the before profile, colored by what WILL happen
-# diff2.svg: widths show the after profile, colored by what DID happen
-#
-# INPUT: See stackcollapse* programs.
-#
-# OUTPUT: The full list of stacks, with two columns, one from each file.
-# If a stack wasn't present in a file, the column value is zero.
-#
-# folded_stack_trace count_from_folded1 count_from_folded2
-#
-# eg:
-#
-# funca;funcb;funcc 31 33
-# ...
-#
-# COPYRIGHT: Copyright (c) 2014 Brendan Gregg.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# (http://www.gnu.org/copyleft/gpl.html)
-#
-# 28-Oct-2014 Brendan Gregg Created this.
-
-use strict;
-use Getopt::Std;
-
-# defaults
-my $normalize = 0; # make sample counts equal
-my $striphex = 0; # strip hex numbers
-
-sub usage {
- print STDERR <<USAGE_END;
-USAGE: $0 [-hns] folded1 folded2 | flamegraph.pl > diff2.svg
- -h # help message
- -n # normalize sample counts
- -s # strip hex numbers (addresses)
-See stackcollapse scripts for generating folded files.
-Also consider flipping the files and hues to highlight reduced paths:
-$0 folded2 folded1 | ./flamegraph.pl --negate > diff1.svg
-USAGE_END
- exit 2;
-}
-
-usage() if @ARGV < 2;
-our ($opt_h, $opt_n, $opt_s);
-getopts('ns') or usage();
-usage() if $opt_h;
-$normalize = 1 if defined $opt_n;
-$striphex = 1 if defined $opt_s;
-
-my ($total1, $total2) = (0, 0);
-my %Folded;
-
-my $file1 = $ARGV[0];
-my $file2 = $ARGV[1];
-
-open FILE, $file1 or die "ERROR: Can't read $file1\n";
-while (<FILE>) {
- chomp;
- my ($stack, $count) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- $stack =~ s/0x[0-9a-fA-F]+/0x.../g if $striphex;
- $Folded{$stack}{1} += $count;
- $total1 += $count;
-}
-close FILE;
-
-open FILE, $file2 or die "ERROR: Can't read $file2\n";
-while (<FILE>) {
- chomp;
- my ($stack, $count) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- $stack =~ s/0x[0-9a-fA-F]+/0x.../g if $striphex;
- $Folded{$stack}{2} += $count;
- $total2 += $count;
-}
-close FILE;
-
-foreach my $stack (keys %Folded) {
- $Folded{$stack}{1} = 0 unless defined $Folded{$stack}{1};
- $Folded{$stack}{2} = 0 unless defined $Folded{$stack}{2};
- if ($normalize && $total1 != $total2) {
- $Folded{$stack}{1} = int($Folded{$stack}{1} * $total2 / $total1);
- }
- print "$stack $Folded{$stack}{1} $Folded{$stack}{2}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/files.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/files.pl
deleted file mode 100644
index 7fc299508..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/files.pl
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/perl -w
-#
-# files.pl Print file sizes in folded format, for a flame graph.
-#
-# This helps you understand storage consumed by a file system, by creating
-# a flame graph visualization of space consumed. This is basically a Perl
-# version of the "find" command, which emits in folded format for piping
-# into flamegraph.pl.
-#
-# Copyright (c) 2017 Brendan Gregg.
-# Licensed under the Apache License, Version 2.0 (the "License")
-#
-# 03-Feb-2017 Brendan Gregg Created this.
-
-use strict;
-use File::Find;
-
-sub usage {
- print STDERR "USAGE: $0 [--xdev] [DIRECTORY]...\n";
- print STDERR " eg, $0 /Users\n";
- print STDERR " To not descend directories on other filesystems:";
- print STDERR " eg, $0 --xdev /\n";
- print STDERR "Intended to be piped to flamegraph.pl. Full example:\n";
- print STDERR " $0 /Users | flamegraph.pl " .
- "--hash --countname=bytes > files.svg\n";
- print STDERR " $0 /usr /home /root /etc | flamegraph.pl " .
- "--hash --countname=bytes > files.svg\n";
- print STDERR " $0 --xdev / | flamegraph.pl " .
- "--hash --countname=bytes > files.svg\n";
- exit 1;
-}
-
-usage() if @ARGV == 0 or $ARGV[0] eq "--help" or $ARGV[0] eq "-h";
-
-my $filter_xdev = 0;
-my $xdev_id;
-
-foreach my $dir (@ARGV) {
- if ($dir eq "--xdev") {
- $filter_xdev = 1;
- }
- else {
- find(\&wanted, $dir);
- }
-}
-
-sub wanted {
- my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size) = lstat($_);
- return unless defined $size;
- if ($filter_xdev) {
- if (!$xdev_id) {
- $xdev_id = $dev;
- }
- elsif ($xdev_id ne $dev) {
- $File::Find::prune = 1;
- return;
- }
- }
- my $path = $File::Find::name;
- $path =~ tr/\//;/; # delimiter
- $path =~ tr/;.a-zA-Z0-9-/_/c; # ditch whitespace and other chars
- $path =~ s/^;//;
- print "$path $size\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/flamegraph.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/flamegraph.pl
deleted file mode 100644
index b7e301f71..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/flamegraph.pl
+++ /dev/null
@@ -1,1235 +0,0 @@
-#!/usr/bin/perl -w
-#
-# flamegraph.pl flame stack grapher.
-#
-# This takes stack samples and renders a call graph, allowing hot functions
-# and codepaths to be quickly identified. Stack samples can be generated using
-# tools such as DTrace, perf, SystemTap, and Instruments.
-#
-# USAGE: ./flamegraph.pl [options] input.txt > graph.svg
-#
-# grep funcA input.txt | ./flamegraph.pl [options] > graph.svg
-#
-# Then open the resulting .svg in a web browser, for interactivity: mouse-over
-# frames for info, click to zoom, and ctrl-F to search.
-#
-# Options are listed in the usage message (--help).
-#
-# The input is stack frames and sample counts formatted as single lines. Each
-# frame in the stack is semicolon separated, with a space and count at the end
-# of the line. These can be generated for Linux perf script output using
-# stackcollapse-perf.pl, for DTrace using stackcollapse.pl, and for other tools
-# using the other stackcollapse programs. Example input:
-#
-# swapper;start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 1
-#
-# An optional extra column of counts can be provided to generate a differential
-# flame graph of the counts, colored red for more, and blue for less. This
-# can be useful when using flame graphs for non-regression testing.
-# See the header comment in the difffolded.pl program for instructions.
-#
-# The input functions can optionally have annotations at the end of each
-# function name, following a precedent by some tools (Linux perf's _[k]):
-# _[k] for kernel
-# _[i] for inlined
-# _[j] for jit
-# _[w] for waker
-# Some of the stackcollapse programs support adding these annotations, eg,
-# stackcollapse-perf.pl --kernel --jit. They are used merely for colors by
-# some palettes, eg, flamegraph.pl --color=java.
-#
-# The output flame graph shows relative presence of functions in stack samples.
-# The ordering on the x-axis has no meaning; since the data is samples, time
-# order of events is not known. The order used sorts function names
-# alphabetically.
-#
-# While intended to process stack samples, this can also process stack traces.
-# For example, tracing stacks for memory allocation, or resource usage. You
-# can use --title to set the title to reflect the content, and --countname
-# to change "samples" to "bytes" etc.
-#
-# There are a few different palettes, selectable using --color. By default,
-# the colors are selected at random (except for differentials). Functions
-# called "-" will be printed gray, which can be used for stack separators (eg,
-# between user and kernel stacks).
-#
-# HISTORY
-#
-# This was inspired by Neelakanth Nadgir's excellent function_call_graph.rb
-# program, which visualized function entry and return trace events. As Neel
-# wrote: "The output displayed is inspired by Roch's CallStackAnalyzer which
-# was in turn inspired by the work on vftrace by Jan Boerhout". See:
-# https://blogs.oracle.com/realneel/entry/visualizing_callstacks_via_dtrace_and
-#
-# Copyright 2016 Netflix, Inc.
-# Copyright 2011 Joyent, Inc. All rights reserved.
-# Copyright 2011 Brendan Gregg. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# 11-Oct-2014 Adrien Mahieux Added zoom.
-# 21-Nov-2013 Shawn Sterling Added consistent palette file option
-# 17-Mar-2013 Tim Bunce Added options and more tunables.
-# 15-Dec-2011 Dave Pacheco Support for frames with whitespace.
-# 10-Sep-2011 Brendan Gregg Created this.
-
-use strict;
-
-use Getopt::Long;
-
-use open qw(:std :utf8);
-
-# tunables
-my $encoding;
-my $fonttype = "Verdana";
-my $imagewidth = 1200; # max width, pixels
-my $frameheight = 16; # max height is dynamic
-my $fontsize = 12; # base text size
-my $fontwidth = 0.59; # avg width relative to fontsize
-my $minwidth = 0.1; # min function width, pixels
-my $nametype = "Function:"; # what are the names in the data?
-my $countname = "samples"; # what are the counts in the data?
-my $colors = "hot"; # color theme
-my $bgcolors = ""; # background color theme
-my $nameattrfile; # file holding function attributes
-my $timemax; # (override the) sum of the counts
-my $factor = 1; # factor to scale counts by
-my $hash = 0; # color by function name
-my $palette = 0; # if we use consistent palettes (default off)
-my %palette_map; # palette map hash
-my $pal_file = "palette.map"; # palette map file name
-my $stackreverse = 0; # reverse stack order, switching merge end
-my $inverted = 0; # icicle graph
-my $flamechart = 0; # produce a flame chart (sort by time, do not merge stacks)
-my $negate = 0; # switch differential hues
-my $titletext = ""; # centered heading
-my $titledefault = "Flame Graph"; # overwritten by --title
-my $titleinverted = "Icicle Graph"; # " "
-my $searchcolor = "rgb(230,0,230)"; # color for search highlighting
-my $notestext = ""; # embedded notes in SVG
-my $subtitletext = ""; # second level title (optional)
-my $help = 0;
-
-sub usage {
- die <<USAGE_END;
-USAGE: $0 [options] infile > outfile.svg\n
- --title TEXT # change title text
- --subtitle TEXT # second level title (optional)
- --width NUM # width of image (default 1200)
- --height NUM # height of each frame (default 16)
- --minwidth NUM # omit smaller functions (default 0.1 pixels)
- --fonttype FONT # font type (default "Verdana")
- --fontsize NUM # font size (default 12)
- --countname TEXT # count type label (default "samples")
- --nametype TEXT # name type label (default "Function:")
- --colors PALETTE # set color palette. choices are: hot (default), mem,
- # io, wakeup, chain, java, js, perl, red, green, blue,
- # aqua, yellow, purple, orange
- --bgcolors COLOR # set background colors. gradient choices are yellow
- # (default), blue, green, grey; flat colors use "#rrggbb"
- --hash # colors are keyed by function name hash
- --cp # use consistent palette (palette.map)
- --reverse # generate stack-reversed flame graph
- --inverted # icicle graph
- --flamechart # produce a flame chart (sort by time, do not merge stacks)
- --negate # switch differential hues (blue<->red)
- --notes TEXT # add notes comment in SVG (for debugging)
- --help # this message
-
- eg,
- $0 --title="Flame Graph: malloc()" trace.txt > graph.svg
-USAGE_END
-}
-
-GetOptions(
- 'fonttype=s' => \$fonttype,
- 'width=i' => \$imagewidth,
- 'height=i' => \$frameheight,
- 'encoding=s' => \$encoding,
- 'fontsize=f' => \$fontsize,
- 'fontwidth=f' => \$fontwidth,
- 'minwidth=f' => \$minwidth,
- 'title=s' => \$titletext,
- 'subtitle=s' => \$subtitletext,
- 'nametype=s' => \$nametype,
- 'countname=s' => \$countname,
- 'nameattr=s' => \$nameattrfile,
- 'total=s' => \$timemax,
- 'factor=f' => \$factor,
- 'colors=s' => \$colors,
- 'bgcolors=s' => \$bgcolors,
- 'hash' => \$hash,
- 'cp' => \$palette,
- 'reverse' => \$stackreverse,
- 'inverted' => \$inverted,
- 'flamechart' => \$flamechart,
- 'negate' => \$negate,
- 'notes=s' => \$notestext,
- 'help' => \$help,
-) or usage();
-$help && usage();
-
-# internals
-my $ypad1 = $fontsize * 3; # pad top, include title
-my $ypad2 = $fontsize * 2 + 10; # pad bottom, include labels
-my $ypad3 = $fontsize * 2; # pad top, include subtitle (optional)
-my $xpad = 10; # pad lefm and right
-my $framepad = 1; # vertical padding for frames
-my $depthmax = 0;
-my %Events;
-my %nameattr;
-
-if ($flamechart && $titletext eq "") {
- $titletext = "Flame Chart";
-}
-
-if ($titletext eq "") {
- unless ($inverted) {
- $titletext = $titledefault;
- }
- else {
- $titletext = $titleinverted;
- }
-}
-
-if ($nameattrfile) {
- # The name-attribute file format is a function name followed by a tab then
- # a sequence of tab separated name=value pairs.
- open my $attrfh, $nameattrfile or die "Can't read $nameattrfile: $!\n";
- while (<$attrfh>) {
- chomp;
- my ($funcname, $attrstr) = split /\t/, $_, 2;
- die "Invalid format in $nameattrfile" unless defined $attrstr;
- $nameattr{$funcname} = { map {split /=/, $_, 2} split /\t/, $attrstr };
- }
-}
-
-if ($notestext =~ /[<>]/) {
- die "Notes string can't contain < or >"
-}
-
-# background colors:
-# - yellow gradient: default (hot, java, js, perl)
-# - green gradient: mem
-# - blue gradient: io, wakeup, chain
-# - gray gradient: flat colors (red, green, blue, ...)
-if ($bgcolors eq "") {
- # choose a default
- if ($colors eq "mem") {
- $bgcolors = "green";
- }
- elsif ($colors =~ /^(io|wakeup|chain)$/) {
- $bgcolors = "blue";
- }
- elsif ($colors =~ /^(red|green|blue|aqua|yellow|purple|orange)$/) {
- $bgcolors = "grey";
- }
- else {
- $bgcolors = "yellow";
- }
-}
-my ($bgcolor1, $bgcolor2);
-if ($bgcolors eq "yellow") {
- $bgcolor1 = "#eeeeee"; # background color gradient start
- $bgcolor2 = "#eeeeb0"; # background color gradient stop
-}
-elsif ($bgcolors eq "blue") {
- $bgcolor1 = "#eeeeee";
- $bgcolor2 = "#e0e0ff";
-}
-elsif ($bgcolors eq "green") {
- $bgcolor1 = "#eef2ee";
- $bgcolor2 = "#e0ffe0";
-}
-elsif ($bgcolors eq "grey") {
- $bgcolor1 = "#f8f8f8";
- $bgcolor2 = "#e8e8e8";
-}
-elsif ($bgcolors =~ /^#......$/) {
- $bgcolor1 = $bgcolor2 = $bgcolors;
-}
-else {
- die "Unrecognized bgcolor option \"$bgcolors\""
-}
-
-# SVG functions
-{package SVG;
-sub new {
- my $class = shift;
- my $self = {};
- bless($self, $class);
- return $self;
-}
-
-sub header {
- my ($self, $w, $h) = @_;
- my $enc_attr = '';
- if (defined $encoding) {
- $enc_attr = qq{ encoding="$encoding"};
- }
- $self->{svg} .= <<SVG;
-<?xml version="1.0"$enc_attr standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" width="$w" height="$h" onload="init(evt)" viewBox="0 0 $w $h" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<!-- Flame graph stack visualization. See https://github.com/brendangregg/FlameGraph for latest version, and http://www.brendangregg.com/flamegraphs.html for examples. -->
-<!-- NOTES: $notestext -->
-SVG
-}
-
-sub include {
- my ($self, $content) = @_;
- $self->{svg} .= $content;
-}
-
-sub colorAllocate {
- my ($self, $r, $g, $b) = @_;
- return "rgb($r,$g,$b)";
-}
-
-sub group_start {
- my ($self, $attr) = @_;
-
- my @g_attr = map {
- exists $attr->{$_} ? sprintf(qq/$_="%s"/, $attr->{$_}) : ()
- } qw(id class);
- push @g_attr, $attr->{g_extra} if $attr->{g_extra};
- if ($attr->{href}) {
- my @a_attr;
- push @a_attr, sprintf qq/xlink:href="%s"/, $attr->{href} if $attr->{href};
- # default target=_top else links will open within SVG <object>
- push @a_attr, sprintf qq/target="%s"/, $attr->{target} || "_top";
- push @a_attr, $attr->{a_extra} if $attr->{a_extra};
- $self->{svg} .= sprintf qq/<a %s>\n/, join(' ', (@a_attr, @g_attr));
- }
- else {
- $self->{svg} .= sprintf qq/<g %s>\n/, join(' ', @g_attr);
- }
-
- $self->{svg} .= sprintf qq/<title>%s<\/title>/, $attr->{title}
- if $attr->{title}; # should be first element within g container
-}
-
-sub group_end {
- my ($self, $attr) = @_;
- $self->{svg} .= $attr->{href} ? qq/<\/a>\n/ : qq/<\/g>\n/;
-}
-
-sub filledRectangle {
- my ($self, $x1, $y1, $x2, $y2, $fill, $extra) = @_;
- $x1 = sprintf "%0.1f", $x1;
- $x2 = sprintf "%0.1f", $x2;
- my $w = sprintf "%0.1f", $x2 - $x1;
- my $h = sprintf "%0.1f", $y2 - $y1;
- $extra = defined $extra ? $extra : "";
- $self->{svg} .= qq/<rect x="$x1" y="$y1" width="$w" height="$h" fill="$fill" $extra \/>\n/;
-}
-
-sub stringTTF {
- my ($self, $id, $x, $y, $str, $extra) = @_;
- $x = sprintf "%0.2f", $x;
- $id = defined $id ? qq/id="$id"/ : "";
- $extra ||= "";
- $self->{svg} .= qq/<text $id x="$x" y="$y" $extra>$str<\/text>\n/;
-}
-
-sub svg {
- my $self = shift;
- return "$self->{svg}</svg>\n";
-}
-1;
-}
-
-sub namehash {
- # Generate a vector hash for the name string, weighting early over
- # later characters. We want to pick the same colors for function
- # names across different flame graphs.
- my $name = shift;
- my $vector = 0;
- my $weight = 1;
- my $max = 1;
- my $mod = 10;
- # if module name present, trunc to 1st char
- $name =~ s/.(.*?)`//;
- foreach my $c (split //, $name) {
- my $i = (ord $c) % $mod;
- $vector += ($i / ($mod++ - 1)) * $weight;
- $max += 1 * $weight;
- $weight *= 0.70;
- last if $mod > 12;
- }
- return (1 - $vector / $max)
-}
-
-sub color {
- my ($type, $hash, $name) = @_;
- my ($v1, $v2, $v3);
-
- if ($hash) {
- $v1 = namehash($name);
- $v2 = $v3 = namehash(scalar reverse $name);
- }
- else {
- $v1 = rand(1);
- $v2 = rand(1);
- $v3 = rand(1);
- }
-
- # theme palettes
- if (defined $type and $type eq "hot") {
- my $r = 205 + int(50 * $v3);
- my $g = 0 + int(230 * $v1);
- my $b = 0 + int(55 * $v2);
- return "rgb($r,$g,$b)";
- }
- if (defined $type and $type eq "mem") {
- my $r = 0;
- my $g = 190 + int(50 * $v2);
- my $b = 0 + int(210 * $v1);
- return "rgb($r,$g,$b)";
- }
- if (defined $type and $type eq "io") {
- my $r = 80 + int(60 * $v1);
- my $g = $r;
- my $b = 190 + int(55 * $v2);
- return "rgb($r,$g,$b)";
- }
-
- # multi palettes
- if (defined $type and $type eq "java") {
- # Handle both annotations (_[j], _[i], ...; which are
- # accurate), as well as input that lacks any annotations, as
- # best as possible. Without annotations, we get a little hacky
- # and match on java|org|com, etc.
- if ($name =~ m:_\[j\]$:) { # jit annotation
- $type = "green";
- }
- elsif ($name =~ m:_\[i\]$:) { # inline annotation
- $type = "aqua";
- }
- elsif ($name =~ m:^L?(java|javax|jdk|net|org|com|io|sun)/:) { # Java
- $type = "green";
- }
- elsif ($name =~ m:_\[k\]$:) { # kernel annotation
- $type = "orange";
- }
- elsif ($name =~ /::/) { # C++
- $type = "yellow";
- }
- else { # system
- $type = "red";
- }
- # fall-through to color palettes
- }
- if (defined $type and $type eq "perl") {
- if ($name =~ /::/) { # C++
- $type = "yellow";
- }
- elsif ($name =~ m:Perl: or $name =~ m:\.pl:) { # Perl
- $type = "green";
- }
- elsif ($name =~ m:_\[k\]$:) { # kernel
- $type = "orange";
- }
- else { # system
- $type = "red";
- }
- # fall-through to color palettes
- }
- if (defined $type and $type eq "js") {
- # Handle both annotations (_[j], _[i], ...; which are
- # accurate), as well as input that lacks any annotations, as
- # best as possible. Without annotations, we get a little hacky,
- # and match on a "/" with a ".js", etc.
- if ($name =~ m:_\[j\]$:) { # jit annotation
- if ($name =~ m:/:) {
- $type = "green"; # source
- }
- else {
- $type = "aqua"; # builtin
- }
- }
- elsif ($name =~ /::/) { # C++
- $type = "yellow";
- }
- elsif ($name =~ m:/.*\.js:) { # JavaScript (match "/" in path)
- $type = "green";
- }
- elsif ($name =~ m/:/) { # JavaScript (match ":" in builtin)
- $type = "aqua";
- }
- elsif ($name =~ m/^ $/) { # Missing symbol
- $type = "green";
- }
- elsif ($name =~ m:_\[k\]:) { # kernel
- $type = "orange";
- }
- else { # system
- $type = "red";
- }
- # fall-through to color palettes
- }
- if (defined $type and $type eq "wakeup") {
- $type = "aqua";
- # fall-through to color palettes
- }
- if (defined $type and $type eq "chain") {
- if ($name =~ m:_\[w\]:) { # waker
- $type = "aqua"
- }
- else { # off-CPU
- $type = "blue";
- }
- # fall-through to color palettes
- }
-
- # color palettes
- if (defined $type and $type eq "red") {
- my $r = 200 + int(55 * $v1);
- my $x = 50 + int(80 * $v1);
- return "rgb($r,$x,$x)";
- }
- if (defined $type and $type eq "green") {
- my $g = 200 + int(55 * $v1);
- my $x = 50 + int(60 * $v1);
- return "rgb($x,$g,$x)";
- }
- if (defined $type and $type eq "blue") {
- my $b = 205 + int(50 * $v1);
- my $x = 80 + int(60 * $v1);
- return "rgb($x,$x,$b)";
- }
- if (defined $type and $type eq "yellow") {
- my $x = 175 + int(55 * $v1);
- my $b = 50 + int(20 * $v1);
- return "rgb($x,$x,$b)";
- }
- if (defined $type and $type eq "purple") {
- my $x = 190 + int(65 * $v1);
- my $g = 80 + int(60 * $v1);
- return "rgb($x,$g,$x)";
- }
- if (defined $type and $type eq "aqua") {
- my $r = 50 + int(60 * $v1);
- my $g = 165 + int(55 * $v1);
- my $b = 165 + int(55 * $v1);
- return "rgb($r,$g,$b)";
- }
- if (defined $type and $type eq "orange") {
- my $r = 190 + int(65 * $v1);
- my $g = 90 + int(65 * $v1);
- return "rgb($r,$g,0)";
- }
-
- return "rgb(0,0,0)";
-}
-
-sub color_scale {
- my ($value, $max) = @_;
- my ($r, $g, $b) = (255, 255, 255);
- $value = -$value if $negate;
- if ($value > 0) {
- $g = $b = int(210 * ($max - $value) / $max);
- }
- elsif ($value < 0) {
- $r = $g = int(210 * ($max + $value) / $max);
- }
- return "rgb($r,$g,$b)";
-}
-
-sub color_map {
- my ($colors, $func) = @_;
- if (exists $palette_map{$func}) {
- return $palette_map{$func};
- }
- else {
- $palette_map{$func} = color($colors, $hash, $func);
- return $palette_map{$func};
- }
-}
-
-sub write_palette {
- open(FILE, ">$pal_file");
- foreach my $key (sort keys %palette_map) {
- print FILE $key . "->" . $palette_map{$key} . "\n";
- }
- close(FILE);
-}
-
-sub read_palette {
- if (-e $pal_file) {
- open(FILE, $pal_file) or die "can't open file $pal_file: $!";
- while (my $line = <FILE>) {
- chomp($line);
- (my $key, my $value) = split("->", $line);
- $palette_map{$key} = $value;
- }
- close(FILE)
- }
-}
-
-my %Node; # Hash of merged frame data
-my %Tmp;
-
-# flow() merges two stacks, storing the merged frames and value data in %Node.
-sub flow {
- my ($last, $this, $v, $d) = @_;
-
- my $len_a = @$last - 1;
- my $len_b = @$this - 1;
-
- my $i = 0;
- my $len_same;
- for (; $i <= $len_a; $i++) {
- last if $i > $len_b;
- last if $last->[$i] ne $this->[$i];
- }
- $len_same = $i;
-
- for ($i = $len_a; $i >= $len_same; $i--) {
- my $k = "$last->[$i];$i";
- # a unique ID is constructed from "func;depth;etime";
- # func-depth isn't unique, it may be repeated later.
- $Node{"$k;$v"}->{stime} = delete $Tmp{$k}->{stime};
- if (defined $Tmp{$k}->{delta}) {
- $Node{"$k;$v"}->{delta} = delete $Tmp{$k}->{delta};
- }
- delete $Tmp{$k};
- }
-
- for ($i = $len_same; $i <= $len_b; $i++) {
- my $k = "$this->[$i];$i";
- $Tmp{$k}->{stime} = $v;
- if (defined $d) {
- $Tmp{$k}->{delta} += $i == $len_b ? $d : 0;
- }
- }
-
- return $this;
-}
-
-# parse input
-my @Data;
-my @SortedData;
-my $last = [];
-my $time = 0;
-my $delta = undef;
-my $ignored = 0;
-my $line;
-my $maxdelta = 1;
-
-# reverse if needed
-foreach (<>) {
- chomp;
- $line = $_;
- if ($stackreverse) {
- # there may be an extra samples column for differentials
- # XXX todo: redo these REs as one. It's repeated below.
- my ($stack, $samples) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- my $samples2 = undef;
- if ($stack =~ /^(.*)\s+?(\d+(?:\.\d*)?)$/) {
- $samples2 = $samples;
- ($stack, $samples) = $stack =~ (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- unshift @Data, join(";", reverse split(";", $stack)) . " $samples $samples2";
- }
- else {
- unshift @Data, join(";", reverse split(";", $stack)) . " $samples";
- }
- }
- else {
- unshift @Data, $line;
- }
-}
-
-if ($flamechart) {
- # In flame chart mode, just reverse the data so time moves from left to right.
- @SortedData = reverse @Data;
-}
-else {
- @SortedData = sort @Data;
-}
-
-# process and merge frames
-foreach (@SortedData) {
- chomp;
- # process: folded_stack count
- # eg: func_a;func_b;func_c 31
- my ($stack, $samples) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- unless (defined $samples and defined $stack) {
- ++$ignored;
- next;
- }
-
- # there may be an extra samples column for differentials:
- my $samples2 = undef;
- if ($stack =~ /^(.*)\s+?(\d+(?:\.\d*)?)$/) {
- $samples2 = $samples;
- ($stack, $samples) = $stack =~ (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- }
- $delta = undef;
- if (defined $samples2) {
- $delta = $samples2 - $samples;
- $maxdelta = abs($delta) if abs($delta) > $maxdelta;
- }
-
- # for chain graphs, annotate waker frames with "_[w]", for later
- # coloring. This is a hack, but has a precedent ("_[k]" from perf).
- if ($colors eq "chain") {
- my @parts = split ";--;", $stack;
- my @newparts = ();
- $stack = shift @parts;
- $stack .= ";--;";
- foreach my $part (@parts) {
- $part =~ s/;/_[w];/g;
- $part .= "_[w]";
- push @newparts, $part;
- }
- $stack .= join ";--;", @parts;
- }
-
- # merge frames and populate %Node:
- $last = flow($last, [ '', split ";", $stack ], $time, $delta);
-
- if (defined $samples2) {
- $time += $samples2;
- }
- else {
- $time += $samples;
- }
-}
-flow($last, [], $time, $delta);
-
-warn "Ignored $ignored lines with invalid format\n" if $ignored;
-unless ($time) {
- warn "ERROR: No stack counts found\n";
- my $im = SVG->new();
- # emit an error message SVG, for tools automating flamegraph use
- my $imageheight = $fontsize * 5;
- $im->header($imagewidth, $imageheight);
- $im->stringTTF(undef, int($imagewidth / 2), $fontsize * 2,
- "ERROR: No valid input provided to flamegraph.pl.");
- print $im->svg;
- exit 2;
-}
-if ($timemax and $timemax < $time) {
- warn "Specified --total $timemax is less than actual total $time, so ignored\n"
- if $timemax / $time > 0.02; # only warn is significant (e.g., not rounding etc)
- undef $timemax;
-}
-$timemax ||= $time;
-
-my $widthpertime = ($imagewidth - 2 * $xpad) / $timemax;
-my $minwidth_time = $minwidth / $widthpertime;
-
-# prune blocks that are too narrow and determine max depth
-while (my ($id, $node) = each %Node) {
- my ($func, $depth, $etime) = split ";", $id;
- my $stime = $node->{stime};
- die "missing start for $id" if not defined $stime;
-
- if (($etime - $stime) < $minwidth_time) {
- delete $Node{$id};
- next;
- }
- $depthmax = $depth if $depth > $depthmax;
-}
-
-# draw canvas, and embed interactive JavaScript program
-my $imageheight = (($depthmax + 1) * $frameheight) + $ypad1 + $ypad2;
-$imageheight += $ypad3 if $subtitletext ne "";
-my $titlesize = $fontsize + 5;
-my $im = SVG->new();
-my ($black, $vdgrey, $dgrey) = (
- $im->colorAllocate(0, 0, 0),
- $im->colorAllocate(160, 160, 160),
- $im->colorAllocate(200, 200, 200),
-);
-$im->header($imagewidth, $imageheight);
-my $inc = <<INC;
-<defs>
- <linearGradient id="background" y1="0" y2="1" x1="0" x2="0" >
- <stop stop-color="$bgcolor1" offset="5%" />
- <stop stop-color="$bgcolor2" offset="95%" />
- </linearGradient>
-</defs>
-<style type="text/css">
- text { font-family:$fonttype; font-size:${fontsize}px; fill:$black; }
- #search, #ignorecase { opacity:0.1; cursor:pointer; }
- #search:hover, #search.show, #ignorecase:hover, #ignorecase.show { opacity:1; }
- #subtitle { text-anchor:middle; font-color:$vdgrey; }
- #title { text-anchor:middle; font-size:${titlesize}px}
- #unzoom { cursor:pointer; }
- #frames > *:hover { stroke:black; stroke-width:0.5; cursor:pointer; }
- .hide { display:none; }
- .parent { opacity:0.5; }
-</style>
-<script type="text/ecmascript">
-<![CDATA[
- "use strict";
- var details, searchbtn, unzoombtn, matchedtxt, svg, searching, currentSearchTerm, ignorecase, ignorecaseBtn;
- function init(evt) {
- details = document.getElementById("details").firstChild;
- searchbtn = document.getElementById("search");
- ignorecaseBtn = document.getElementById("ignorecase");
- unzoombtn = document.getElementById("unzoom");
- matchedtxt = document.getElementById("matched");
- svg = document.getElementsByTagName("svg")[0];
- searching = 0;
- currentSearchTerm = null;
- }
-
- window.addEventListener("click", function(e) {
- var target = find_group(e.target);
- if (target) {
- if (target.nodeName == "a") {
- if (e.ctrlKey === false) return;
- e.preventDefault();
- }
- if (target.classList.contains("parent")) unzoom();
- zoom(target);
- }
- else if (e.target.id == "unzoom") unzoom();
- else if (e.target.id == "search") search_prompt();
- else if (e.target.id == "ignorecase") toggle_ignorecase();
- }, false)
-
- // mouse-over for info
- // show
- window.addEventListener("mouseover", function(e) {
- var target = find_group(e.target);
- if (target) details.nodeValue = "$nametype " + g_to_text(target);
- }, false)
-
- // clear
- window.addEventListener("mouseout", function(e) {
- var target = find_group(e.target);
- if (target) details.nodeValue = ' ';
- }, false)
-
- // ctrl-F for search
- window.addEventListener("keydown",function (e) {
- if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)) {
- e.preventDefault();
- search_prompt();
- }
- }, false)
-
- // ctrl-I to toggle case-sensitive search
- window.addEventListener("keydown",function (e) {
- if (e.ctrlKey && e.keyCode === 73) {
- e.preventDefault();
- toggle_ignorecase();
- }
- }, false)
-
- // functions
- function find_child(node, selector) {
- var children = node.querySelectorAll(selector);
- if (children.length) return children[0];
- return;
- }
- function find_group(node) {
- var parent = node.parentElement;
- if (!parent) return;
- if (parent.id == "frames") return node;
- return find_group(parent);
- }
- function orig_save(e, attr, val) {
- if (e.attributes["_orig_" + attr] != undefined) return;
- if (e.attributes[attr] == undefined) return;
- if (val == undefined) val = e.attributes[attr].value;
- e.setAttribute("_orig_" + attr, val);
- }
- function orig_load(e, attr) {
- if (e.attributes["_orig_"+attr] == undefined) return;
- e.attributes[attr].value = e.attributes["_orig_" + attr].value;
- e.removeAttribute("_orig_"+attr);
- }
- function g_to_text(e) {
- var text = find_child(e, "title").firstChild.nodeValue;
- return (text)
- }
- function g_to_func(e) {
- var func = g_to_text(e);
- // if there's any manipulation we want to do to the function
- // name before it's searched, do it here before returning.
- return (func);
- }
- function update_text(e) {
- var r = find_child(e, "rect");
- var t = find_child(e, "text");
- var w = parseFloat(r.attributes.width.value) -3;
- var txt = find_child(e, "title").textContent.replace(/\\([^(]*\\)\$/,"");
- t.attributes.x.value = parseFloat(r.attributes.x.value) + 3;
-
- // Smaller than this size won't fit anything
- if (w < 2 * $fontsize * $fontwidth) {
- t.textContent = "";
- return;
- }
-
- t.textContent = txt;
- // Fit in full text width
- if (/^ *\$/.test(txt) || t.getSubStringLength(0, txt.length) < w)
- return;
-
- for (var x = txt.length - 2; x > 0; x--) {
- if (t.getSubStringLength(0, x + 2) <= w) {
- t.textContent = txt.substring(0, x) + "..";
- return;
- }
- }
- t.textContent = "";
- }
-
- // zoom
- function zoom_reset(e) {
- if (e.attributes != undefined) {
- orig_load(e, "x");
- orig_load(e, "width");
- }
- if (e.childNodes == undefined) return;
- for (var i = 0, c = e.childNodes; i < c.length; i++) {
- zoom_reset(c[i]);
- }
- }
- function zoom_child(e, x, ratio) {
- if (e.attributes != undefined) {
- if (e.attributes.x != undefined) {
- orig_save(e, "x");
- e.attributes.x.value = (parseFloat(e.attributes.x.value) - x - $xpad) * ratio + $xpad;
- if (e.tagName == "text")
- e.attributes.x.value = find_child(e.parentNode, "rect[x]").attributes.x.value + 3;
- }
- if (e.attributes.width != undefined) {
- orig_save(e, "width");
- e.attributes.width.value = parseFloat(e.attributes.width.value) * ratio;
- }
- }
-
- if (e.childNodes == undefined) return;
- for (var i = 0, c = e.childNodes; i < c.length; i++) {
- zoom_child(c[i], x - $xpad, ratio);
- }
- }
- function zoom_parent(e) {
- if (e.attributes) {
- if (e.attributes.x != undefined) {
- orig_save(e, "x");
- e.attributes.x.value = $xpad;
- }
- if (e.attributes.width != undefined) {
- orig_save(e, "width");
- e.attributes.width.value = parseInt(svg.width.baseVal.value) - ($xpad * 2);
- }
- }
- if (e.childNodes == undefined) return;
- for (var i = 0, c = e.childNodes; i < c.length; i++) {
- zoom_parent(c[i]);
- }
- }
- function zoom(node) {
- var attr = find_child(node, "rect").attributes;
- var width = parseFloat(attr.width.value);
- var xmin = parseFloat(attr.x.value);
- var xmax = parseFloat(xmin + width);
- var ymin = parseFloat(attr.y.value);
- var ratio = (svg.width.baseVal.value - 2 * $xpad) / width;
-
- // XXX: Workaround for JavaScript float issues (fix me)
- var fudge = 0.0001;
-
- unzoombtn.classList.remove("hide");
-
- var el = document.getElementById("frames").children;
- for (var i = 0; i < el.length; i++) {
- var e = el[i];
- var a = find_child(e, "rect").attributes;
- var ex = parseFloat(a.x.value);
- var ew = parseFloat(a.width.value);
- var upstack;
- // Is it an ancestor
- if ($inverted == 0) {
- upstack = parseFloat(a.y.value) > ymin;
- } else {
- upstack = parseFloat(a.y.value) < ymin;
- }
- if (upstack) {
- // Direct ancestor
- if (ex <= xmin && (ex+ew+fudge) >= xmax) {
- e.classList.add("parent");
- zoom_parent(e);
- update_text(e);
- }
- // not in current path
- else
- e.classList.add("hide");
- }
- // Children maybe
- else {
- // no common path
- if (ex < xmin || ex + fudge >= xmax) {
- e.classList.add("hide");
- }
- else {
- zoom_child(e, xmin, ratio);
- update_text(e);
- }
- }
- }
- search();
- }
- function unzoom() {
- unzoombtn.classList.add("hide");
- var el = document.getElementById("frames").children;
- for(var i = 0; i < el.length; i++) {
- el[i].classList.remove("parent");
- el[i].classList.remove("hide");
- zoom_reset(el[i]);
- update_text(el[i]);
- }
- search();
- }
-
- // search
- function toggle_ignorecase() {
- ignorecase = !ignorecase;
- if (ignorecase) {
- ignorecaseBtn.classList.add("show");
- } else {
- ignorecaseBtn.classList.remove("show");
- }
- reset_search();
- search();
- }
- function reset_search() {
- var el = document.querySelectorAll("#frames rect");
- for (var i = 0; i < el.length; i++) {
- orig_load(el[i], "fill")
- }
- }
- function search_prompt() {
- if (!searching) {
- var term = prompt("Enter a search term (regexp " +
- "allowed, eg: ^ext4_)"
- + (ignorecase ? ", ignoring case" : "")
- + "\\nPress Ctrl-i to toggle case sensitivity", "");
- if (term != null) {
- currentSearchTerm = term;
- search();
- }
- } else {
- reset_search();
- searching = 0;
- currentSearchTerm = null;
- searchbtn.classList.remove("show");
- searchbtn.firstChild.nodeValue = "Search"
- matchedtxt.classList.add("hide");
- matchedtxt.firstChild.nodeValue = ""
- }
- }
- function search(term) {
- if (currentSearchTerm === null) return;
- var term = currentSearchTerm;
-
- var re = new RegExp(term, ignorecase ? 'i' : '');
- var el = document.getElementById("frames").children;
- var matches = new Object();
- var maxwidth = 0;
- for (var i = 0; i < el.length; i++) {
- var e = el[i];
- var func = g_to_func(e);
- var rect = find_child(e, "rect");
- if (func == null || rect == null)
- continue;
-
- // Save max width. Only works as we have a root frame
- var w = parseFloat(rect.attributes.width.value);
- if (w > maxwidth)
- maxwidth = w;
-
- if (func.match(re)) {
- // highlight
- var x = parseFloat(rect.attributes.x.value);
- orig_save(rect, "fill");
- rect.attributes.fill.value = "$searchcolor";
-
- // remember matches
- if (matches[x] == undefined) {
- matches[x] = w;
- } else {
- if (w > matches[x]) {
- // overwrite with parent
- matches[x] = w;
- }
- }
- searching = 1;
- }
- }
- if (!searching)
- return;
-
- searchbtn.classList.add("show");
- searchbtn.firstChild.nodeValue = "Reset Search";
-
- // calculate percent matched, excluding vertical overlap
- var count = 0;
- var lastx = -1;
- var lastw = 0;
- var keys = Array();
- for (k in matches) {
- if (matches.hasOwnProperty(k))
- keys.push(k);
- }
- // sort the matched frames by their x location
- // ascending, then width descending
- keys.sort(function(a, b){
- return a - b;
- });
- // Step through frames saving only the biggest bottom-up frames
- // thanks to the sort order. This relies on the tree property
- // where children are always smaller than their parents.
- var fudge = 0.0001; // JavaScript floating point
- for (var k in keys) {
- var x = parseFloat(keys[k]);
- var w = matches[keys[k]];
- if (x >= lastx + lastw - fudge) {
- count += w;
- lastx = x;
- lastw = w;
- }
- }
- // display matched percent
- matchedtxt.classList.remove("hide");
- var pct = 100 * count / maxwidth;
- if (pct != 100) pct = pct.toFixed(1)
- matchedtxt.firstChild.nodeValue = "Matched: " + pct + "%";
- }
-]]>
-</script>
-INC
-$im->include($inc);
-$im->filledRectangle(0, 0, $imagewidth, $imageheight, 'url(#background)');
-$im->stringTTF("title", int($imagewidth / 2), $fontsize * 2, $titletext);
-$im->stringTTF("subtitle", int($imagewidth / 2), $fontsize * 4, $subtitletext) if $subtitletext ne "";
-$im->stringTTF("details", $xpad, $imageheight - ($ypad2 / 2), " ");
-$im->stringTTF("unzoom", $xpad, $fontsize * 2, "Reset Zoom", 'class="hide"');
-$im->stringTTF("search", $imagewidth - $xpad - 100, $fontsize * 2, "Search");
-$im->stringTTF("ignorecase", $imagewidth - $xpad - 16, $fontsize * 2, "ic");
-$im->stringTTF("matched", $imagewidth - $xpad - 100, $imageheight - ($ypad2 / 2), " ");
-
-if ($palette) {
- read_palette();
-}
-
-# draw frames
-$im->group_start({ id => "frames" });
-while (my ($id, $node) = each %Node) {
- my ($func, $depth, $etime) = split ";", $id;
- my $stime = $node->{stime};
- my $delta = $node->{delta};
-
- $etime = $timemax if $func eq "" and $depth == 0;
-
- my $x1 = $xpad + $stime * $widthpertime;
- my $x2 = $xpad + $etime * $widthpertime;
- my ($y1, $y2);
- unless ($inverted) {
- $y1 = $imageheight - $ypad2 - ($depth + 1) * $frameheight + $framepad;
- $y2 = $imageheight - $ypad2 - $depth * $frameheight;
- }
- else {
- $y1 = $ypad1 + $depth * $frameheight;
- $y2 = $ypad1 + ($depth + 1) * $frameheight - $framepad;
- }
-
- my $samples = sprintf "%.0f", ($etime - $stime) * $factor;
- (my $samples_txt = $samples) # add commas per perlfaq5
- =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g;
-
- my $info;
- if ($func eq "" and $depth == 0) {
- $info = "all ($samples_txt $countname, 100%)";
- }
- else {
- my $pct = sprintf "%.2f", ((100 * $samples) / ($timemax * $factor));
- my $escaped_func = $func;
- # clean up SVG breaking characters:
- $escaped_func =~ s/&/&/g;
- $escaped_func =~ s/</</g;
- $escaped_func =~ s/>/>/g;
- $escaped_func =~ s/"/"/g;
- $escaped_func =~ s/_\[[kwij]\]$//; # strip any annotation
- unless (defined $delta) {
- $info = "$escaped_func ($samples_txt $countname, $pct%)";
- }
- else {
- my $d = $negate ? -$delta : $delta;
- my $deltapct = sprintf "%.2f", ((100 * $d) / ($timemax * $factor));
- $deltapct = $d > 0 ? "+$deltapct" : $deltapct;
- $info = "$escaped_func ($samples_txt $countname, $pct%; $deltapct%)";
- }
- }
-
- my $nameattr = { %{$nameattr{$func} || {}} }; # shallow clone
- $nameattr->{title} ||= $info;
- $im->group_start($nameattr);
-
- my $color;
- if ($func eq "--") {
- $color = $vdgrey;
- }
- elsif ($func eq "-") {
- $color = $dgrey;
- }
- elsif (defined $delta) {
- $color = color_scale($delta, $maxdelta);
- }
- elsif ($palette) {
- $color = color_map($colors, $func);
- }
- else {
- $color = color($colors, $hash, $func);
- }
- $im->filledRectangle($x1, $y1, $x2, $y2, $color, 'rx="2" ry="2"');
-
- my $chars = int(($x2 - $x1) / ($fontsize * $fontwidth));
- my $text = "";
- if ($chars >= 3) {
- # room for one char plus two dots
- $func =~ s/_\[[kwij]\]$//; # strip any annotation
- $text = substr $func, 0, $chars;
- substr($text, -2, 2) = ".." if $chars < length $func;
- $text =~ s/&/&/g;
- $text =~ s/</</g;
- $text =~ s/>/>/g;
- }
- $im->stringTTF(undef, $x1 + 3, 3 + ($y1 + $y2) / 2, $text);
-
- $im->group_end($nameattr);
-}
-$im->group_end();
-
-print $im->svg;
-
-if ($palette) {
- write_palette();
-}
-
-# vim: ts=8 sts=8 sw=8 noexpandtab
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/jmaps b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/jmaps
deleted file mode 100644
index b9b0d1180..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/jmaps
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# jmaps - creates java /tmp/perf-PID.map symbol maps for all java processes.
-#
-# This is a helper script that finds all running "java" processes, then executes
-# perf-map-agent on them all, creating symbol map files in /tmp. These map files
-# are read by perf_events (aka "perf") when doing system profiles (specifically,
-# the "report" and "script" subcommands).
-#
-# USAGE: jmaps [-u]
-# -u # unfoldall: include inlined symbols
-#
-# My typical workflow is this:
-#
-# perf record -F 99 -a -g -- sleep 30; jmaps
-# perf script > out.stacks
-# ./stackcollapse-perf.pl out.stacks | ./flamegraph.pl --color=java --hash > out.stacks.svg
-#
-# The stackcollapse-perf.pl and flamegraph.pl programs come from:
-# https://github.com/brendangregg/FlameGraph
-#
-# REQUIREMENTS:
-# Tune two environment settings below.
-#
-# 13-Feb-2015 Brendan Gregg Created this.
-# 20-Feb-2017 " " Added -u for unfoldall.
-
-JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-8-oracle}
-AGENT_HOME=${AGENT_HOME:-/usr/lib/jvm/perf-map-agent} # from https://github.com/jvm-profiling-tools/perf-map-agent
-debug=0
-
-if [[ "$USER" != root ]]; then
- echo "ERROR: not root user? exiting..."
- exit
-fi
-
-if [[ ! -x $JAVA_HOME ]]; then
- echo "ERROR: JAVA_HOME not set correctly; edit $0 and fix"
- exit
-fi
-
-if [[ ! -x $AGENT_HOME ]]; then
- echo "ERROR: AGENT_HOME not set correctly; edit $0 and fix"
- exit
-fi
-
-if [[ "$1" == "-u" ]]; then
- opts=unfoldall
-fi
-
-# figure out where the agent files are:
-AGENT_OUT=""
-AGENT_JAR=""
-if [[ -e $AGENT_HOME/out/attach-main.jar ]]; then
- AGENT_JAR=$AGENT_HOME/out/attach-main.jar
-elif [[ -e $AGENT_HOME/attach-main.jar ]]; then
- AGENT_JAR=$AGENT_HOME/attach-main.jar
-fi
-if [[ -e $AGENT_HOME/out/libperfmap.so ]]; then
- AGENT_OUT=$AGENT_HOME/out
-elif [[ -e $AGENT_HOME/libperfmap.so ]]; then
- AGENT_OUT=$AGENT_HOME
-fi
-if [[ "$AGENT_OUT" == "" || "$AGENT_JAR" == "" ]]; then
- echo "ERROR: Missing perf-map-agent files in $AGENT_HOME. Check installation."
- exit
-fi
-
-# Fetch map for all "java" processes
-echo "Fetching maps for all java processes..."
-for pid in $(pgrep -x java); do
- mapfile=/tmp/perf-$pid.map
- [[ -e $mapfile ]] && rm $mapfile
-
- cmd="cd $AGENT_OUT; $JAVA_HOME/bin/java -Xms32m -Xmx128m -cp $AGENT_JAR:$JAVA_HOME/lib/tools.jar net.virtualvoid.perf.AttachOnce $pid $opts"
- (( debug )) && echo $cmd
-
- user=$(ps ho user -p $pid)
- group=$(ps ho group -p $pid)
- if [[ "$user" != root ]]; then
- if [[ "$user" == [0-9]* ]]; then
- # UID only, likely GID too, run sudo with #UID:
- cmd="sudo -u '#'$user -g '#'$group sh -c '$cmd'"
- else
- cmd="sudo -u $user -g $group sh -c '$cmd'"
- fi
- fi
-
- echo "Mapping PID $pid (user $user):"
- if (( debug )); then
- time eval $cmd
- else
- eval $cmd
- fi
- if [[ -e "$mapfile" ]]; then
- chown root $mapfile
- chmod 666 $mapfile
- else
- echo "ERROR: $mapfile not created."
- fi
-
- echo "wc(1): $(wc $mapfile)"
- echo
-done
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/pkgsplit-perf.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/pkgsplit-perf.pl
deleted file mode 100644
index 5018e06da..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/pkgsplit-perf.pl
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/perl -w
-#
-# pkgsplit-perf.pl Split IP samples on package names "/", eg, Java.
-#
-# This is for the creation of Java package flame graphs. Example steps:
-#
-# perf record -F 199 -a -- sleep 30; ./jmaps
-# perf script | ./pkgsplit-perf.pl | ./flamegraph.pl > out.svg
-#
-# Note that stack traces are not sampled (no -g), as we split Java package
-# names into frames rather than stack frames.
-#
-# (jmaps is a helper script for automating perf-map-agent: Java symbol dumps.)
-#
-# The default output of "perf script" varies between kernel versions, so we'll
-# need to deal with that here. I could make people use the perf script option
-# to pick fields, so our input is static, but A) I prefer the simplicity of
-# just saying: run "perf script", and B) the option to choose fields itself
-# changed between kernel versions! -f became -F.
-#
-# Copyright 2017 Netflix, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-#
-# 20-Sep-2016 Brendan Gregg Created this.
-
-use strict;
-
-my $include_pname = 1; # include process names in stacks
-my $include_pid = 0; # include process ID with process name
-my $include_tid = 0; # include process & thread ID with process name
-
-while (<>) {
- # filter comments
- next if /^#/;
-
- # filter idle events
- next if /xen_hypercall_sched_op|cpu_idle|native_safe_halt/;
-
- my ($pid, $tid, $pname);
-
- # Linux 3.13:
- # java 13905 [000] 8048.096572: cpu-clock: 7fd781ac3053 Ljava/util/Arrays$ArrayList;::toArray (/tmp/perf-12149.map)
- # java 8301 [050] 13527.392454: cycles: 7fa8a80d9bff Dictionary::find(int, unsigned int, Symbol*, ClassLoaderData*, Handle, Thread*) (/usr/lib/jvm/java-8-oracle-1.8.0.121/jre/lib/amd64/server/libjvm.so)
- # java 4567/8603 [023] 13527.389886: cycles: 7fa863349895 Lcom/google/gson/JsonObject;::add (/tmp/perf-4567.map)
- #
- # Linux 4.8:
- # java 30894 [007] 452884.077440: 10101010 cpu-clock: 7f0acc8eff67 Lsun/nio/ch/SocketChannelImpl;::read+0x27 (/tmp/perf-30849.map)
- # bash 26858/26858 [006] 5440237.995639: cpu-clock: 433573 [unknown] (/bin/bash)
- #
- if (/^\s+(\S.+?)\s+(\d+)\/*(\d+)*\s.*?:.*:/) {
- # parse process name and pid/tid
- if ($3) {
- ($pid, $tid) = ($2, $3);
- }
- else {
- ($pid, $tid) = ("?", $2);
- }
-
- if ($include_tid) {
- $pname = "$1-$pid/$tid";
- }
- elsif ($include_pid) {
- $pname = "$1-$pid";
- }
- else {
- $pname = $1;
- }
- $pname =~ tr/ /_/;
- }
- else {
- # not a match
- next;
- }
-
- # parse rest of line
- s/^.*?:.*?:\s+//;
- s/ \(.*?\)$//;
- chomp;
- my ($addr, $func) = split(' ', $_, 2);
-
- # strip Java's leading "L"
- $func =~ s/^L//;
-
- # replace numbers with X
- $func =~ s/[0-9]/X/g;
-
- # colon delimitered
- $func =~ s:/:;:g;
- print "$pname;$func 1\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/range-perf.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/range-perf.pl
deleted file mode 100644
index 4ee49c282..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/range-perf.pl
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/perl -w
-#
-# range-perf Extract a time range from Linux "perf script" output.
-#
-# USAGE EXAMPLE:
-#
-# perf record -F 100 -a -- sleep 60
-# perf script | ./perf2range.pl 10 20 # range 10 to 20 seconds only
-# perf script | ./perf2range.pl 0 0.5 # first half second only
-#
-# MAKING A SERIES OF FLAME GRAPHS:
-#
-# Let's say you had the output of "perf script" in a file, out.stacks01, which
-# was for a 180 second profile. The following command creates a series of
-# flame graphs for each 10 second interval:
-#
-# for i in `seq 0 10 170`; do cat out.stacks01 | \
-# ./perf2range.pl $i $((i + 10)) | ./stackcollapse-perf.pl | \
-# grep -v cpu_idle | ./flamegraph.pl --hash --color=java \
-# --title="range $i $((i + 10))" > out.range_$i.svg; echo $i done; done
-#
-# In that example, I used "--color=java" for the Java palette, and excluded
-# the idle CPU task. Customize as needed.
-#
-# Copyright 2017 Netflix, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License")
-#
-# 21-Feb-2017 Brendan Gregg Created this.
-
-use strict;
-use Getopt::Long;
-use POSIX 'floor';
-
-sub usage {
- die <<USAGE_END;
-USAGE: $0 [options] min_seconds max_seconds
- --timeraw # use raw timestamps from perf
- --timezerosecs # time starts at 0 secs, but keep offset from perf
- eg,
- $0 10 20 # only include samples between 10 and 20 seconds
-USAGE_END
-}
-
-my $timeraw = 0;
-my $timezerosecs = 0;
-GetOptions(
- 'timeraw' => \$timeraw,
- 'timezerosecs' => \$timezerosecs,
-) or usage();
-
-if (@ARGV < 2 || $ARGV[0] eq "-h" || $ARGV[0] eq "--help") {
- usage();
- exit;
-}
-my $begin = $ARGV[0];
-my $end = $ARGV[1];
-
-#
-# Parsing
-#
-# IP only examples:
-#
-# java 52025 [026] 99161.926202: cycles:
-# java 14341 [016] 252732.474759: cycles: 7f36571947c0 nmethod::is_nmethod() const (/...
-# java 14514 [022] 28191.353083: cpu-clock: 7f92b4fdb7d4 Ljava_util_List$size$0;::call (/tmp/perf-11936.map)
-# swapper 0 [002] 6035557.056977: 10101010 cpu-clock: ffffffff810013aa xen_hypercall_sched_op+0xa (/lib/modules/4.9-virtual/build/vmlinux)
-# bash 25370 603are 6036.991603: 10101010 cpu-clock: 4b931e [unknown] (/bin/bash)
-# bash 25370/25370 6036036.799684: cpu-clock: 4b913b [unknown] (/bin/bash)
-# other combinations are possible.
-#
-# Stack examples (-g):
-#
-# swapper 0 [021] 28648.467059: cpu-clock:
-# ffffffff810013aa xen_hypercall_sched_op ([kernel.kallsyms])
-# ffffffff8101cb2f default_idle ([kernel.kallsyms])
-# ffffffff8101d406 arch_cpu_idle ([kernel.kallsyms])
-# ffffffff810bf475 cpu_startup_entry ([kernel.kallsyms])
-# ffffffff81010228 cpu_bringup_and_idle ([kernel.kallsyms])
-#
-# java 14375 [022] 28648.467079: cpu-clock:
-# 7f92bdd98965 Ljava/io/OutputStream;::write (/tmp/perf-11936.map)
-# 7f8808cae7a8 [unknown] ([unknown])
-#
-# swapper 0 [005] 5076.836336: cpu-clock:
-# ffffffff81051586 native_safe_halt ([kernel.kallsyms])
-# ffffffff8101db4f default_idle ([kernel.kallsyms])
-# ffffffff8101e466 arch_cpu_idle ([kernel.kallsyms])
-# ffffffff810c2b31 cpu_startup_entry ([kernel.kallsyms])
-# ffffffff810427cd start_secondary ([kernel.kallsyms])
-#
-# swapper 0 [002] 6034779.719110: 10101010 cpu-clock:
-# 2013aa xen_hypercall_sched_op+0xfe20000a (/lib/modules/4.9-virtual/build/vmlinux)
-# a72f0e default_idle+0xfe20001e (/lib/modules/4.9-virtual/build/vmlinux)
-# 2392bf arch_cpu_idle+0xfe20000f (/lib/modules/4.9-virtual/build/vmlinux)
-# a73333 default_idle_call+0xfe200023 (/lib/modules/4.9-virtual/build/vmlinux)
-# 2c91a4 cpu_startup_entry+0xfe2001c4 (/lib/modules/4.9-virtual/build/vmlinux)
-# 22b64a cpu_bringup_and_idle+0xfe20002a (/lib/modules/4.9-virtual/build/vmlinux)
-#
-# bash 25370/25370 6035935.188539: cpu-clock:
-# b9218 [unknown] (/bin/bash)
-# 2037fe8 [unknown] ([unknown])
-# other combinations are possible.
-#
-# This regexp matches the event line, and puts time in $1, and the event name
-# in $2:
-#
-my $event_regexp = qr/ +([0-9\.]+): *\S* *(\S+):/;
-
-my $line;
-my $start = 0;
-my $ok = 0;
-my $time;
-
-while (1) {
- $line = <STDIN>;
- last unless defined $line;
- next if $line =~ /^#/; # skip comments
-
- if ($line =~ $event_regexp) {
- my ($ts, $event) = ($1, $2, $3);
- $start = $ts if $start == 0;
-
- if ($timezerosecs) {
- $time = $ts - floor($start);
- }
- elsif (!$timeraw) {
- $time = $ts - $start;
- }
- else {
- $time = $ts; # raw times
- }
-
- $ok = 1 if $time >= $begin;
- # assume samples are in time order:
- exit if $time > $end;
- }
-
- print $line if $ok;
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/record-test.sh b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/record-test.sh
deleted file mode 100644
index 19b54fb40..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/record-test.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# record-test.sh - Overwrite flame graph test result files.
-#
-# See test.sh, which checks these resulting files.
-#
-# Currently only tests stackcollapse-perf.pl.
-
-set -v -x
-
-# ToDo: add some form of --inline, and --inline --context tests. These are
-# tricky since they use addr2line, whose output will vary based on the test
-# system's binaries and symbol tables.
-for opt in pid tid kernel jit all addrs; do
- for testfile in test/*.txt ; do
- echo testing $testfile : $opt
- outfile=${testfile#*/}
- outfile=test/results/${outfile%.txt}"-collapsed-${opt}.txt"
- ./stackcollapse-perf.pl --"${opt}" "${testfile}" 2> /dev/null > $outfile
- done
-done
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-aix.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-aix.pl
deleted file mode 100644
index 1fbab32f0..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-aix.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/perl -ws
-#
-# stackcollapse-aix Collapse AIX /usr/bin/procstack backtraces
-#
-# Parse a list of backtraces as generated with the poor man's aix-perf.pl
-# profiler
-#
-
-use strict;
-
-my $process = "";
-my $current = "";
-my $previous_function = "";
-
-my %stacks;
-
-while (<>) {
- chomp;
- if (m/^\d+:/) {
- if (!($current eq "")) {
- $current = $process . ";" . $current;
- $stacks{$current} += 1;
- $current = "";
- }
- m/^\d+: ([^ ]*)/;
- $process = $1;
- $current = "";
- }
- elsif (m/^---------- tid# \d+/) {
- if (!($current eq "")) {
- $current = $process . ";" . $current;
- $stacks{$current} += 1;
- }
- $current = "";
- }
- elsif (m/^(0x[0-9abcdef]*) *([^ ]*) ([^ ]*) ([^ ]*)/) {
- my $function = $2;
- my $alt = $1;
- $function =~ s/\(.*\)?//;
- if ($function =~ /^\[.*\]$/) {
- $function = $alt;
- }
- if ($current) {
- $current = $function . ";" . $current;
- }
- else {
- $current = $function;
- }
- }
-}
-
-if (!($current eq "")) {
- $current = $process . ";" . $current;
- $stacks{$current} += 1;
- $current = "";
- $process = "";
-}
-
-foreach my $k (sort {$a cmp $b} keys %stacks) {
- print "$k $stacks{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-bpftrace.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-bpftrace.pl
deleted file mode 100644
index 710641e25..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-bpftrace.pl
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-bpftrace.pl collapse bpftrace samples into single lines.
-#
-# USAGE ./stackcollapse-bpftrace.pl infile > outfile
-#
-# Example input:
-#
-# @[
-# _raw_spin_lock_bh+0
-# tcp_recvmsg+808
-# inet_recvmsg+81
-# sock_recvmsg+67
-# sock_read_iter+144
-# new_sync_read+228
-# __vfs_read+41
-# vfs_read+142
-# sys_read+85
-# do_syscall_64+115
-# entry_SYSCALL_64_after_hwframe+61
-# ]: 3
-#
-# Example output:
-#
-# entry_SYSCALL_64_after_hwframe+61;do_syscall_64+115;sys_read+85;vfs_read+142;__vfs_read+41;new_sync_read+228;sock_read_iter+144;sock_recvmsg+67;inet_recvmsg+81;tcp_recvmsg+808;_raw_spin_lock_bh+0 3
-#
-# Copyright 2018 Peter Sanford. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# (http://www.gnu.org/copyleft/gpl.html)
-#
-
-use strict;
-
-my @stack;
-my $in_stack = 0;
-
-foreach (<>) {
- chomp;
- if (!$in_stack) {
- if (/^@\[/) {
- $in_stack = 1;
- }
- }
- else {
- if (m/^\]: (\d+)/) {
- print join(';', reverse(@stack)) . " $1\n";
- $in_stack = 0;
- @stack = ();
- }
- else {
- push(@stack, $_);
- }
- }
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-elfutils.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-elfutils.pl
deleted file mode 100644
index 6f2c045b4..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-elfutils.pl
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-elfutils Collapse elfutils stack (eu-stack) backtraces
-#
-# Parse a list of elfutils backtraces as generated with the poor man's
-# profiler [1]:
-#
-# for x in $(seq 1 "$nsamples"); do
-# eu-stack -p "$pid" "$@"
-# sleep "$sleeptime"
-# done
-#
-# [1] http://poormansprofiler.org/
-#
-# Copyright 2014 Gabriel Corona. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-
-use strict;
-use Getopt::Long;
-
-my $with_pid = 0;
-my $with_tid = 0;
-
-GetOptions('pid' => \$with_pid,
- 'tid' => \$with_tid)
- or die <<USAGE_END;
-USAGE: $0 [options] infile > outfile\n
- --pid # include PID
- --tid # include TID
-USAGE_END
-
-my $pid = "";
-my $tid = "";
-my $current = "";
-my $previous_function = "";
-
-my %stacks;
-
-sub add_current {
- if (!($current eq "")) {
- my $entry;
- if ($with_tid) {
- $current = "TID=$tid;$current";
- }
- if ($with_pid) {
- $current = "PID=$pid;$current";
- }
- $stacks{$current} += 1;
- $current = "";
- }
-}
-
-while (<>) {
- chomp;
- if (m/^PID ([0-9]*)/) {
- add_current();
- $pid = $1;
- }
- elsif (m/^TID ([0-9]*)/) {
- add_current();
- $tid = $1;
- }
- elsif (m/^#[0-9]* *0x[0-9a-f]* (.*)/) {
- if ($current eq "") {
- $current = $1;
- }
- else {
- $current = "$1;$current";
- }
- }
- elsif (m/^#[0-9]* *0x[0-9a-f]*/) {
- if ($current eq "") {
- $current = "[unknown]";
- }
- else {
- $current = "[unknown];$current";
- }
- }
-}
-add_current();
-
-foreach my $k (sort {$a cmp $b} keys %stacks) {
- print "$k $stacks{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-gdb.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-gdb.pl
deleted file mode 100644
index c276c0341..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-gdb.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/perl -ws
-#
-# stackcollapse-gdb Collapse GDB backtraces
-#
-# Parse a list of GDB backtraces as generated with the poor man's
-# profiler [1]:
-#
-# for x in $(seq 1 500); do
-# gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid 2> /dev/null
-# sleep 0.01
-# done
-#
-# [1] http://poormansprofiler.org/
-#
-# Copyright 2014 Gabriel Corona. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-
-use strict;
-
-my $current = "";
-my $previous_function = "";
-
-my %stacks;
-
-while (<>) {
- chomp;
- if (m/^Thread/) {
- $current = ""
- }
- elsif (m/^#[0-9]* *([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)/) {
- my $function = $3;
- my $alt = $1;
- if (not ($1 =~ /0x[a-zA-Z0-9]*/)) {
- $function = $alt;
- }
- if ($current eq "") {
- $current = $function;
- }
- else {
- $current = $function . ";" . $current;
- }
- }
- elsif (!($current eq "")) {
- $stacks{$current} += 1;
- $current = "";
- }
-}
-
-if (!($current eq "")) {
- $stacks{$current} += 1;
- $current = "";
-}
-
-foreach my $k (sort {$a cmp $b} keys %stacks) {
- print "$k $stacks{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-go.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-go.pl
deleted file mode 100644
index 7d8a255f8..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-go.pl
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-go.pl collapse golang samples into single lines.
-#
-# Parses golang smaples generated by "go tool pprof" and outputs stacks as
-# single lines, with methods separated by semicolons, and then a space and an
-# occurrence count. For use with flamegraph.pl.
-#
-# USAGE: ./stackcollapse-go.pl infile > outfile
-#
-# Example Input:
-# ...
-# Samples:
-# samples/count cpu/nanoseconds
-# 1 10000000: 1 2
-# 2 10000000: 3 2
-# 1 10000000: 4 2
-# ...
-# Locations
-# 1: 0x58b265 scanblock :0 s=0
-# 2: 0x599530 GC :0 s=0
-# 3: 0x58a999 flushptrbuf :0 s=0
-# 4: 0x58d6a8 runtime.MSpan_Sweep :0 s=0
-# ...
-# Mappings
-# ...
-#
-# Example Output:
-#
-# GC;flushptrbuf 2
-# GC;runtime.MSpan_Sweep 1
-# GC;scanblock 1
-#
-# Input may contain many stacks as generated from go tool pprof:
-#
-# go tool pprof -seconds=60 -raw -output=a.pprof http://$ADDR/debug/pprof/profile
-#
-# For format of text profile, See golang/src/internal/pprof/profile/profile.go
-#
-# Copyright 2017 Sijie Yang (yangsijie@baidu.com). All rights reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# (http://www.gnu.org/copyleft/gpl.html)
-#
-# 16-Jan-2017 Sijie Yang Created this.
-
-use strict;
-
-use Getopt::Long;
-
-# tunables
-my $help = 0;
-
-sub usage {
- die <<USAGE_END;
-USAGE: $0 infile > outfile\n
-USAGE_END
-}
-
-GetOptions(
- 'help' => \$help,
-) or usage();
-$help && usage();
-
-# internals
-my $state = "ignore";
-my %stacks;
-my %frames;
-my %collapsed;
-
-sub remember_stack {
- my ($stack, $count) = @_;
- $stacks{$stack} += $count;
-}
-
-#
-# Output stack string in required format. For example, for the following samples,
-# format_statck() would return GC;runtime.MSpan_Sweep for stack "4 2"
-#
-# Locations
-# 1: 0x58b265 scanblock :0 s=0
-# 2: 0x599530 GC :0 s=0
-# 3: 0x58a999 flushptrbuf :0 s=0
-# 4: 0x58d6a8 runtime.MSpan_Sweep :0 s=0
-#
-sub format_statck {
- my ($stack) = @_;
- my @loc_list = split(/ /, $stack);
-
- for (my $i = 0; $i <= $#loc_list; $i++) {
- my $loc_name = $frames{$loc_list[$i]};
- $loc_list[$i] = $loc_name if ($loc_name);
- }
- return join(";", reverse(@loc_list));
-}
-
-foreach (<>) {
- next if m/^#/;
- chomp;
-
- if ($state eq "ignore") {
- if (/Samples:/) {
- $state = "sample";
- next;
- }
-
- }
- elsif ($state eq "sample") {
- if (/^\s*([0-9]+)\s*[0-9]+: ([0-9 ]+)/) {
- my $samples = $1;
- my $stack = $2;
- remember_stack($stack, $samples);
- }
- elsif (/Locations/) {
- $state = "location";
- next;
- }
-
- }
- elsif ($state eq "location") {
- if (/^\s*([0-9]*): 0x[0-9a-f]+ (M=[0-9]+ )?([^ ]+) .*/) {
- my $loc_id = $1;
- my $loc_name = $3;
- $frames{$loc_id} = $loc_name;
- }
- elsif (/Mappings/) {
- $state = "mapping";
- last;
- }
- }
-}
-
-foreach my $k (keys %stacks) {
- my $stack = format_statck($k);
- my $count = $stacks{$k};
- $collapsed{$stack} += $count;
-}
-
-foreach my $k (sort {$a cmp $b} keys %collapsed) {
- print "$k $collapsed{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-instruments.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-instruments.pl
deleted file mode 100644
index 510291faa..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-instruments.pl
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-instruments.pl
-#
-# Parses a CSV file containing a call tree as produced by XCode
-# Instruments and produces output suitable for flamegraph.pl.
-#
-# USAGE: ./stackcollapse-instruments.pl infile > outfile
-
-use strict;
-
-my @stack = ();
-
-<>;
-foreach (<>) {
- chomp;
- /\d+\.\d+ms[^,]+,(\d+(?:\.\d*)?),\s+,(\s*)(.+)/ or die;
- my $func = $3;
- my $depth = length($2);
- $stack[$depth] = $3;
- foreach my $i (0 .. $depth - 1) {
- print $stack[$i];
- print ";";
- }
- print "$func $1\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-java-exceptions.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-java-exceptions.pl
deleted file mode 100644
index 29ff84537..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-java-exceptions.pl
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcolllapse-java-exceptions.pl collapse java exceptions (found in logs) into single lines.
-#
-# Parses Java error stacks found in a log file and outputs them as
-# single lines, with methods separated by semicolons, and then a space and an
-# occurrence count. Inspired by stackcollapse-jstack.pl except that it does
-# not act as a performance profiler.
-#
-# It can be useful if a Java process dumps a lot of different stacks in its logs
-# and you want to quickly identify the biggest culprits.
-#
-# USAGE: ./stackcollapse-java-exceptions.pl infile > outfile
-#
-# Copyright 2018 Paul de Verdiere. All rights reserved.
-
-use strict;
-use Getopt::Long;
-
-# tunables
-my $shorten_pkgs = 0; # shorten package names
-my $no_pkgs = 0; # really shorten package names!!
-my $help = 0;
-
-sub usage {
- die <<USAGE_END;
-USAGE: $0 [options] infile > outfile\n
- --shorten-pkgs : shorten package names
- --no-pkgs : suppress package names (makes SVG much more readable)
-
-USAGE_END
-}
-
-GetOptions(
- 'shorten-pkgs!' => \$shorten_pkgs,
- 'no-pkgs!' => \$no_pkgs,
- 'help' => \$help,
-) or usage();
-$help && usage();
-
-my %collapsed;
-
-sub remember_stack {
- my ($stack, $count) = @_;
- $collapsed{$stack} += $count;
-}
-
-my @stack;
-
-foreach (<>) {
- chomp;
-
- if (/^\s*at ([^\(]*)/) {
- my $func = $1;
- if ($shorten_pkgs || $no_pkgs) {
- my ($pkgs, $clsFunc) = ($func =~ m/(.*\.)([^.]+\.[^.]+)$/);
- $pkgs =~ s/(\w)\w*/$1/g;
- $func = $no_pkgs ? $clsFunc : $pkgs . $clsFunc;
- }
- unshift @stack, $func;
- }
- elsif (@stack) {
- next if m/.*waiting on .*/;
- remember_stack(join(";", @stack), 1) if @stack;
- undef @stack;
- }
-}
-
-remember_stack(join(";", @stack), 1) if @stack;
-
-foreach my $k (sort {$a cmp $b} keys %collapsed) {
- print "$k $collapsed{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-jstack.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-jstack.pl
deleted file mode 100644
index a480a9425..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-jstack.pl
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-jstack.pl collapse jstack samples into single lines.
-#
-# Parses Java stacks generated by jstack(1) and outputs RUNNABLE stacks as
-# single lines, with methods separated by semicolons, and then a space and an
-# occurrence count. This also filters some other "RUNNABLE" states that we
-# know are probably not running, such as epollWait. For use with flamegraph.pl.
-#
-# You want this to process the output of at least 100 jstack(1)s. ie, run it
-# 100 times with a sleep interval, and append to a file. This is really a poor
-# man's Java profiler, due to the overheads of jstack(1), and how it isn't
-# capturing stacks asynchronously. For a better profiler, see:
-# http://www.brendangregg.com/blog/2014-06-12/java-flame-graphs.html
-#
-# USAGE: ./stackcollapse-jstack.pl infile > outfile
-#
-# Example input:
-#
-# "MyProg" #273 daemon prio=9 os_prio=0 tid=0x00007f273c038800 nid=0xe3c runnable [0x00007f28a30f2000]
-# java.lang.Thread.State: RUNNABLE
-# at java.net.SocketInputStream.socketRead0(Native Method)
-# at java.net.SocketInputStream.read(SocketInputStream.java:121)
-# ...
-# at java.lang.Thread.run(Thread.java:744)
-#
-# Example output:
-#
-# MyProg;java.lang.Thread.run;java.net.SocketInputStream.read;java.net.SocketInputStream.socketRead0 1
-#
-# Input may be created and processed using:
-#
-# i=0; while (( i++ < 200 )); do jstack PID >> out.jstacks; sleep 10; done
-# cat out.jstacks | ./stackcollapse-jstack.pl > out.stacks-folded
-#
-# WARNING: jstack(1) incurs overheads. Test before use, or use a real profiler.
-#
-# Copyright 2014 Brendan Gregg. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# (http://www.gnu.org/copyleft/gpl.html)
-#
-# 14-Sep-2014 Brendan Gregg Created this.
-
-use strict;
-
-use Getopt::Long;
-
-# tunables
-my $include_tname = 1; # include thread names in stacks
-my $include_tid = 0; # include thread IDs in stacks
-my $shorten_pkgs = 0; # shorten package names
-my $help = 0;
-
-sub usage {
- die <<USAGE_END;
-USAGE: $0 [options] infile > outfile\n
- --include-tname
- --no-include-tname # include/omit thread names in stacks (default: include)
- --include-tid
- --no-include-tid # include/omit thread IDs in stacks (default: omit)
- --shorten-pkgs
- --no-shorten-pkgs # (don't) shorten package names (default: don't shorten)
-
- eg,
- $0 --no-include-tname stacks.txt > collapsed.txt
-USAGE_END
-}
-
-GetOptions(
- 'include-tname!' => \$include_tname,
- 'include-tid!' => \$include_tid,
- 'shorten-pkgs!' => \$shorten_pkgs,
- 'help' => \$help,
-) or usage();
-$help && usage();
-
-
-# internals
-my %collapsed;
-
-sub remember_stack {
- my ($stack, $count) = @_;
- $collapsed{$stack} += $count;
-}
-
-my @stack;
-my $tname;
-my $state = "?";
-
-foreach (<>) {
- next if m/^#/;
- chomp;
-
- if (m/^$/) {
- # only include RUNNABLE states
- goto clear if $state ne "RUNNABLE";
-
- # save stack
- if (defined $tname) {unshift @stack, $tname;}
- remember_stack(join(";", @stack), 1) if @stack;
- clear:
- undef @stack;
- undef $tname;
- $state = "?";
- next;
- }
-
- #
- # While parsing jstack output, the $state variable may be altered from
- # RUNNABLE to other states. This causes the stacks to be filtered later,
- # since only RUNNABLE stacks are included.
- #
-
- if (/^"([^"]*)/) {
- my $name = $1;
-
- if ($include_tname) {
- $tname = $name;
- unless ($include_tid) {
- $tname =~ s/-\d+$//;
- }
- }
-
- # set state for various background threads
- $state = "BACKGROUND" if $name =~ /C. CompilerThread/;
- $state = "BACKGROUND" if $name =~ /Signal Dispatcher/;
- $state = "BACKGROUND" if $name =~ /Service Thread/;
- $state = "BACKGROUND" if $name =~ /Attach Listener/;
-
- }
- elsif (/java.lang.Thread.State: (\S+)/) {
- $state = $1 if $state eq "?";
- }
- elsif (/^\s*at ([^\(]*)/) {
- my $func = $1;
- if ($shorten_pkgs) {
- my ($pkgs, $clsFunc) = ($func =~ m/(.*\.)([^.]+\.[^.]+)$/);
- $pkgs =~ s/(\w)\w*/$1/g;
- $func = $pkgs . $clsFunc;
- }
- unshift @stack, $func;
-
- # fix state for epollWait
- $state = "WAITING" if $func =~ /epollWait/;
- $state = "WAITING" if $func =~ /EPoll\.wait/;
-
-
- # fix state for various networking functions
- $state = "NETWORK" if $func =~ /socketAccept$/;
- $state = "NETWORK" if $func =~ /Socket.*accept0$/;
- $state = "NETWORK" if $func =~ /socketRead0$/;
-
- }
- elsif (/^\s*-/ or /^2\d\d\d-/ or /^Full thread dump/ or
- /^JNI global references:/) {
- # skip these info lines
- next;
- }
- else {
- warn "Unrecognized line: $_";
- }
-}
-
-foreach my $k (sort {$a cmp $b} keys %collapsed) {
- print "$k $collapsed{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-ljp.awk b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-ljp.awk
deleted file mode 100644
index 59aaae3d7..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-ljp.awk
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/awk -f
-#
-# stackcollapse-ljp.awk collapse lightweight java profile reports
-# into single lines stacks.
-#
-# Parses a list of multiline stacks generated by:
-#
-# https://code.google.com/p/lightweight-java-profiler
-#
-# and outputs a semicolon separated stack followed by a space and a count.
-#
-# USAGE: ./stackcollapse-ljp.pl infile > outfile
-#
-# Example input:
-#
-# 42 3 my_func_b(prog.java:455)
-# my_func_a(prog.java:123)
-# java.lang.Thread.run(Thread.java:744)
-# [...]
-#
-# Example output:
-#
-# java.lang.Thread.run;my_func_a;my_func_b 42
-#
-# The unused number is the number of frames in each stack.
-#
-# Copyright 2014 Brendan Gregg. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# 12-Jun-2014 Brendan Gregg Created this.
-
-$1 == "Total" {
- # We're done. Print last stack and exit.
- print stack, count
- exit
-}
-
-{
- # Strip file location. Comment this out to keep.
- gsub(/\(.*\)/, "")
-}
-
-NF == 3 {
- # New stack begins. Print previous buffered stack.
- if (count)
- print stack, count
-
- # Begin a new stack.
- count = $1
- stack = $3
-}
-
-NF == 1 {
- # Build stack.
- stack = $1 ";" stack
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-perf-sched.awk b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-perf-sched.awk
deleted file mode 100644
index e1a122d45..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-perf-sched.awk
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/usr/bin/awk -f
-
-#
-# This program generates collapsed off-cpu stacks fit for use by flamegraph.pl
-# from scheduler data collected via perf_events.
-#
-# Outputs the cumulative time off cpu in us for each distinct stack observed.
-#
-# Some awk variables further control behavior:
-#
-# record_tid If truthy, causes all stack traces to include the
-# command and LWP id.
-#
-# record_wake_stack If truthy, stacks include the frames from the wakeup
-# event in addition to the sleep event.
-# See http://www.brendangregg.com/FlameGraphs/offcpuflamegraphs.html#Wakeup
-#
-# recurse If truthy, attempt to recursively identify and
-# visualize the full wakeup stack chain.
-# See http://www.brendangregg.com/FlameGraphs/offcpuflamegraphs.html#ChainGraph
-#
-# Note that this is only an approximation, as only the
-# last sleep event is recorded (e.g. if a thread slept
-# multiple times before waking another thread, only the
-# last sleep event is used). Implies record_wake_stack=1
-#
-# To set any of these variables from the command line, run via:
-#
-# stackcollapse-perf-sched.awk -v recurse=1
-#
-# == Important warning ==
-#
-# WARNING: tracing all scheduler events is very high overhead in perf. Even
-# more alarmingly, there appear to be bugs in perf that prevent it from reliably
-# getting consistent traces (even with large trace buffers), causing it to
-# produce empty perf.data files with error messages of the form:
-#
-# 0x952790 [0x736d]: failed to process type: 3410
-#
-# This failure is not determinisitic, so re-executing perf record will
-# eventually succeed.
-#
-# == Usage ==
-#
-# First, record data via perf_events:
-#
-# sudo perf record -g -e 'sched:sched_switch' \
-# -e 'sched:sched_stat_sleep' -e 'sched:sched_stat_blocked' \
-# -p <pid> -o perf.data -- sleep 1
-#
-# Then post process with this script:
-#
-# sudo perf script -f time,comm,pid,tid,event,ip,sym,dso,trace -i perf.data | \
-# stackcollapse-perf-sched.awk -v recurse=1 | \
-# flamegraph.pl --color=io --countname=us >out.svg
-#
-
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2015 by MemSQL. All rights reserved.
-#
-
-#
-# Match a perf captured variable, returning just the contents. For example, for
-# the following line, get_perf_captured_variable("pid") would return "27235":
-#
-# swapper 0 [006] 708189.626415: sched:sched_stat_sleep: comm=memsqld pid=27235 delay=100078421 [ns
-#
-function get_perf_captured_variable(variable)
-{
- match($0, variable "=[^[:space:]]+")
- return substr($0, RSTART + length(variable) + 1,
- RLENGTH - length(variable) - 1)
-}
-
-#
-# The timestamp is the first field that ends in a colon, e.g.:
-#
-# swapper 0 [006] 708189.626415: sched:sched_stat_sleep: comm=memsqld pid=27235 delay=100078421 [ns
-#
-# or
-#
-# swapper 0/0 708189.626415: sched:sched_stat_sleep: comm=memsqld pid=27235 delay=100078421 [ns]
-#
-function get_perf_timestamp()
-{
- match($0, " [^ :]+:")
- return substr($0, RSTART + 1, RLENGTH - 2)
-}
-
-!/^#/ && /sched:sched_switch/ {
- switchcommand = get_perf_captured_variable("comm")
-
- switchpid = get_perf_captured_variable("prev_pid")
-
- switchtime=get_perf_timestamp()
-
- switchstack=""
-}
-
-#
-# Strip the function name from a stack entry
-#
-# Stack entry is expected to be formatted like:
-# c60849 MyClass::Foo(unsigned long) (/home/areece/a.out)
-#
-function get_function_name()
-{
- # We start from 2 since we don't need the hex offset.
- # We stop at NF - 1 since we don't need the library path.
- funcname = $2
- for (i = 3; i <= NF - 1; i++) {
- funcname = funcname " " $i
- }
- return funcname
-}
-
-(switchpid != 0 && /^\s/) {
- if (switchstack == "") {
- switchstack = get_function_name()
- } else {
- switchstack = get_function_name() ";" switchstack
- }
-}
-
-(switchpid != 0 && /^$/) {
- switch_stacks[switchpid] = switchstack
- delete last_switch_stacks[switchpid]
- switch_time[switchpid] = switchtime
-
- switchpid=0
- switchcommand=""
- switchstack=""
-}
-
-!/^#/ && (/sched:sched_stat_sleep/ || /sched:sched_stat_blocked/) {
- wakecommand=$1
- wakepid=$2
-
- waketime=get_perf_timestamp()
-
- stat_next_command = get_perf_captured_variable("comm")
-
- stat_next_pid = get_perf_captured_variable("pid")
-
- stat_delay_ns = int(get_perf_captured_variable("delay"))
-
- wakestack=""
-}
-
-(stat_next_pid != 0 && /^\s/) {
- if (wakestack == "") {
- wakestack = get_function_name()
- } else {
- # We build the wakestack in reverse order.
- wakestack = wakestack ";" get_function_name()
- }
-}
-
-(stat_next_pid != 0 && /^$/) {
- #
- # For some reason, perf appears to output duplicate
- # sched:sched_stat_sleep and sched:sched_stat_blocked events. We only
- # handle the first event.
- #
- if (stat_next_pid in switch_stacks) {
- last_wake_time[stat_next_pid] = waketime
-
- stack = switch_stacks[stat_next_pid]
- if (recurse || record_wake_stack) {
- stack = stack ";" wakestack
- if (record_tid) {
- stack = stack ";" wakecommand "-" wakepid
- } else {
- stack = stack ";" wakecommand
- }
- }
-
- if (recurse) {
- if (last_wake_time[wakepid] > last_switch_time[stat_next_pid]) {
- stack = stack ";-;" last_switch_stacks[wakepid]
- }
- last_switch_stacks[stat_next_pid] = stack
- }
-
- delete switch_stacks[stat_next_pid]
-
- if (record_tid) {
- stack_times[stat_next_command "-" stat_next_pid ";" stack] += stat_delay_ns
- } else {
- stack_times[stat_next_command ";" stack] += stat_delay_ns
- }
- }
-
- wakecommand=""
- wakepid=0
- stat_next_pid=0
- stat_next_command=""
- stat_delay_ms=0
-}
-
-END {
- for (stack in stack_times) {
- if (int(stack_times[stack] / 1000) > 0) {
- print stack, int(stack_times[stack] / 1000)
- }
- }
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-perf.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-perf.pl
deleted file mode 100644
index 35c1c16e0..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-perf.pl
+++ /dev/null
@@ -1,358 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-perf.pl collapse perf samples into single lines.
-#
-# Parses a list of multiline stacks generated by "perf script", and
-# outputs a semicolon separated stack followed by a space and a count.
-# If memory addresses (+0xd) are present, they are stripped, and resulting
-# identical stacks are colased with their counts summed.
-#
-# USAGE: ./stackcollapse-perf.pl [options] infile > outfile
-#
-# Run "./stackcollapse-perf.pl -h" to list options.
-#
-# Example input:
-#
-# swapper 0 [000] 158665.570607: cpu-clock:
-# ffffffff8103ce3b native_safe_halt ([kernel.kallsyms])
-# ffffffff8101c6a3 default_idle ([kernel.kallsyms])
-# ffffffff81013236 cpu_idle ([kernel.kallsyms])
-# ffffffff815bf03e rest_init ([kernel.kallsyms])
-# ffffffff81aebbfe start_kernel ([kernel.kallsyms].init.text)
-# [...]
-#
-# Example output:
-#
-# swapper;start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 1
-#
-# Input may be created and processed using:
-#
-# perf record -a -g -F 997 sleep 60
-# perf script | ./stackcollapse-perf.pl > out.stacks-folded
-#
-# The output of "perf script" should include stack traces. If these are missing
-# for you, try manually selecting the perf script output; eg:
-#
-# perf script -f comm,pid,tid,cpu,time,event,ip,sym,dso,trace | ...
-#
-# This is also required for the --pid or --tid options, so that the output has
-# both the PID and TID.
-#
-# Copyright 2012 Joyent, Inc. All rights reserved.
-# Copyright 2012 Brendan Gregg. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# 02-Mar-2012 Brendan Gregg Created this.
-# 02-Jul-2014 " " Added process name to stacks.
-
-use strict;
-use Getopt::Long;
-
-my %collapsed;
-
-sub remember_stack {
- my ($stack, $count) = @_;
- $collapsed{$stack} += $count;
-}
-my $annotate_kernel = 0; # put an annotation on kernel function
-my $annotate_jit = 0; # put an annotation on jit symbols
-my $annotate_all = 0; # enale all annotations
-my $include_pname = 1; # include process names in stacks
-my $include_pid = 0; # include process ID with process name
-my $include_tid = 0; # include process & thread ID with process name
-my $include_addrs = 0; # include raw address where a symbol can't be found
-my $tidy_java = 1; # condense Java signatures
-my $tidy_generic = 1; # clean up function names a little
-my $target_pname; # target process name from perf invocation
-my $event_filter = ""; # event type filter, defaults to first encountered event
-my $event_defaulted = 0; # whether we defaulted to an event (none provided)
-my $event_warning = 0; # if we printed a warning for the event
-
-my $show_inline = 0;
-my $show_context = 0;
-GetOptions('inline' => \$show_inline,
- 'context' => \$show_context,
- 'pid' => \$include_pid,
- 'kernel' => \$annotate_kernel,
- 'jit' => \$annotate_jit,
- 'all' => \$annotate_all,
- 'tid' => \$include_tid,
- 'addrs' => \$include_addrs,
- 'event-filter=s' => \$event_filter)
- or die <<USAGE_END;
-USAGE: $0 [options] infile > outfile\n
- --pid # include PID with process names [1]
- --tid # include TID and PID with process names [1]
- --inline # un-inline using addr2line
- --all # all annotations (--kernel --jit)
- --kernel # annotate kernel functions with a _[k]
- --jit # annotate jit functions with a _[j]
- --context # adds source context to --inline
- --addrs # include raw addresses where symbols can't be found
- --event-filter=EVENT # event name filter\n
-[1] perf script must emit both PID and TIDs for these to work; eg, Linux < 4.1:
- perf script -f comm,pid,tid,cpu,time,event,ip,sym,dso,trace
- for Linux >= 4.1:
- perf script -F comm,pid,tid,cpu,time,event,ip,sym,dso,trace
- If you save this output add --header on Linux >= 3.14 to include perf info.
-USAGE_END
-
-if ($annotate_all) {
- $annotate_kernel = $annotate_jit = 1;
-}
-
-# for the --inline option
-sub inline {
- my ($pc, $mod) = @_;
-
- # capture addr2line output
- my $a2l_output = `addr2line -a $pc -e $mod -i -f -s -C`;
-
- # remove first line
- $a2l_output =~ s/^(.*\n){1}//;
-
- my @fullfunc;
- my $one_item = "";
- for (split /^/, $a2l_output) {
- chomp $_;
-
- # remove discriminator info if exists
- $_ =~ s/ \(discriminator \S+\)//;
-
- if ($one_item eq "") {
- $one_item = $_;
- }
- else {
- if ($show_context == 1) {
- unshift @fullfunc, $one_item . ":$_";
- }
- else {
- unshift @fullfunc, $one_item;
- }
- $one_item = "";
- }
- }
-
- return join(";", @fullfunc);
-}
-
-my @stack;
-my $pname;
-my $m_pid;
-my $m_tid;
-
-#
-# Main loop
-#
-while (defined($_ = <>)) {
-
- # find the name of the process launched by perf, by stepping backwards
- # over the args to find the first non-option (no dash):
- if (/^# cmdline/) {
- my @args = split ' ', $_;
- foreach my $arg (reverse @args) {
- if ($arg !~ /^-/) {
- $target_pname = $arg;
- $target_pname =~ s:.*/::; # strip pathname
- last;
- }
- }
- }
-
- # skip remaining comments
- next if m/^#/;
- chomp;
-
- # end of stack. save cached data.
- if (m/^$/) {
- # ignore filtered samples
- next if not $pname;
-
- if ($include_pname) {
- if (defined $pname) {
- unshift @stack, $pname;
- }
- else {
- unshift @stack, "";
- }
- }
- remember_stack(join(";", @stack), 1) if @stack;
- undef @stack;
- undef $pname;
- next;
- }
-
- #
- # event record start
- #
- if (/^(\S.+?)\s+(\d+)\/*(\d+)*\s+/) {
- # default "perf script" output has TID but not PID
- # eg, "java 25607 4794564.109216: cycles:"
- # eg, "java 12688 [002] 6544038.708352: cpu-clock:"
- # eg, "V8 WorkerThread 25607 4794564.109216: cycles:"
- # eg, "java 24636/25607 [000] 4794564.109216: cycles:"
- # eg, "java 12688/12764 6544038.708352: cpu-clock:"
- # eg, "V8 WorkerThread 24636/25607 [000] 94564.109216: cycles:"
- # other combinations possible
- my ($comm, $pid, $tid) = ($1, $2, $3);
- if (not $tid) {
- $tid = $pid;
- $pid = "?";
- }
-
- if (/(\S+):\s*$/) {
- my $event = $1;
-
- if ($event_filter eq "") {
- # By default only show events of the first encountered
- # event type. Merging together different types, such as
- # instructions and cycles, produces misleading results.
- $event_filter = $event;
- $event_defaulted = 1;
- }
- elsif ($event ne $event_filter) {
- if ($event_defaulted and $event_warning == 0) {
- # only print this warning if necessary:
- # when we defaulted and there was
- # multiple event types.
- print STDERR "Filtering for events of type: $event\n";
- $event_warning = 1;
- }
- next;
- }
- }
-
- ($m_pid, $m_tid) = ($pid, $tid);
-
- if ($include_tid) {
- $pname = "$comm-$m_pid/$m_tid";
- }
- elsif ($include_pid) {
- $pname = "$comm-$m_pid";
- }
- else {
- $pname = "$comm";
- }
- $pname =~ tr/ /_/;
-
- #
- # stack line
- #
- }
- elsif (/^\s*(\w+)\s*(.+) \((\S*)\)/) {
- # ignore filtered samples
- next if not $pname;
-
- my ($pc, $rawfunc, $mod) = ($1, $2, $3);
-
- # Linux 4.8 included symbol offsets in perf script output by default, eg:
- # 7fffb84c9afc cpu_startup_entry+0x800047c022ec ([kernel.kallsyms])
- # strip these off:
- $rawfunc =~ s/\+0x[\da-f]+$//;
-
- if ($show_inline == 1 && $mod !~ m/(perf-\d+.map|kernel\.|\[[^\]]+\])/) {
- unshift @stack, inline($pc, $mod);
- next;
- }
-
- next if $rawfunc =~ /^\(/; # skip process names
-
- my @inline;
- for (split /\->/, $rawfunc) {
- my $func = $_;
-
- if ($func eq "[unknown]") {
- if ($mod ne "[unknown]") {
- # use module name instead, if known
- $func = $mod;
- $func =~ s/.*\///;
- }
- else {
- $func = "unknown";
- }
-
- if ($include_addrs) {
- $func = "\[$func \<$pc\>\]";
- }
- else {
- $func = "\[$func\]";
- }
- }
-
- if ($tidy_generic) {
- $func =~ s/;/:/g;
- if ($func !~ m/\.\(.*\)\./) {
- # This doesn't look like a Go method name (such as
- # "net/http.(*Client).Do"), so everything after the first open
- # paren (that is not part of an "(anonymous namespace)") is
- # just noise.
- $func =~ s/\((?!anonymous namespace\)).*//;
- }
- # now tidy this horrible thing:
- # 13a80b608e0a RegExp:[&<>\"\'] (/tmp/perf-7539.map)
- $func =~ tr/"\'//d;
- # fall through to $tidy_java
- }
-
- if ($tidy_java and $pname eq "java") {
- # along with $tidy_generic, converts the following:
- # Lorg/mozilla/javascript/ContextFactory;.call(Lorg/mozilla/javascript/ContextAction;)Ljava/lang/Object;
- # Lorg/mozilla/javascript/ContextFactory;.call(Lorg/mozilla/javascript/C
- # Lorg/mozilla/javascript/MemberBox;.<init>(Ljava/lang/reflect/Method;)V
- # into:
- # org/mozilla/javascript/ContextFactory:.call
- # org/mozilla/javascript/ContextFactory:.call
- # org/mozilla/javascript/MemberBox:.init
- $func =~ s/^L// if $func =~ m:/:;
- }
-
- #
- # Annotations
- #
- # detect inlined from the @inline array
- # detect kernel from the module name; eg, frames to parse include:
- # ffffffff8103ce3b native_safe_halt ([kernel.kallsyms])
- # 8c3453 tcp_sendmsg (/lib/modules/4.3.0-rc1-virtual/build/vmlinux)
- # 7d8 ipv4_conntrack_local+0x7f8f80b8 ([nf_conntrack_ipv4])
- # detect jit from the module name; eg:
- # 7f722d142778 Ljava/io/PrintStream;::print (/tmp/perf-19982.map)
- if (scalar(@inline) > 0) {
- $func .= "_[i]"; # inlined
- }
- elsif ($annotate_kernel == 1 && $mod =~ m/(^\[|vmlinux$)/ && $mod !~ /unknown/) {
- $func .= "_[k]"; # kernel
- }
- elsif ($annotate_jit == 1 && $mod =~ m:/tmp/perf-\d+\.map:) {
- $func .= "_[j]"; # jitted
- }
- push @inline, $func;
- }
-
- unshift @stack, @inline;
- }
- else {
- warn "Unrecognized line: $_";
- }
-}
-
-foreach my $k (sort {$a cmp $b} keys %collapsed) {
- print "$k $collapsed{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-pmc.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-pmc.pl
deleted file mode 100644
index dd76e8254..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-pmc.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env perl
-#
-# Copyright (c) 2014 Ed Maste. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# stackcollapse-pmc.pl collapse hwpmc samples into single lines.
-#
-# Parses a list of multiline stacks generated by "hwpmc -G", and outputs a
-# semicolon-separated stack followed by a space and a count.
-#
-# Usage:
-# pmcstat -S unhalted-cycles -O pmc.out
-# pmcstat -R pmc.out -z16 -G pmc.graph
-# stackcollapse-pmc.pl pmc.graph > pmc.stack
-#
-# Example input:
-#
-# 03.07% [17] witness_unlock @ /boot/kernel/kernel
-# 70.59% [12] __mtx_unlock_flags
-# 16.67% [2] selfdfree
-# 100.0% [2] sys_poll
-# 100.0% [2] amd64_syscall
-# 08.33% [1] pmap_ts_referenced
-# 100.0% [1] vm_pageout
-# 100.0% [1] fork_exit
-# ...
-#
-# Example output:
-#
-# amd64_syscall;sys_poll;selfdfree;__mtx_unlock_flags;witness_unlock 2
-# amd64_syscall;sys_poll;pmap_ts_referenced;__mtx_unlock_flagsgeout;fork_exit 1
-# ...
-
-use warnings;
-use strict;
-
-my @stack;
-my $prev_count;
-my $prev_indent = -1;
-
-foreach (<>) {
- if (m/^( *)[0-9.]+% \[([0-9]+)\]\s*(\S+)/) {
- my $indent = length($1);
- if ($indent <= $prev_indent) {
- print join(';', reverse(@stack[0 .. $prev_indent])) .
- " $prev_count\n";
- }
- $stack[$indent] = $3;
- $prev_count = $2;
- $prev_indent = $indent;
- }
-}
-print join(';', reverse(@stack[0 .. $prev_indent])) . " $prev_count\n";
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-recursive.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-recursive.pl
deleted file mode 100644
index 756bb08f0..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-recursive.pl
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/perl -ws
-#
-# stackcollapse-recursive Collapse direct recursive backtraces
-#
-# Post-process a stack list and merge direct recursive calls:
-#
-# Example input:
-#
-# main;recursive;recursive;recursive;helper 1
-#
-# Output:
-#
-# main;recursive;helper 1
-#
-# Copyright 2014 Gabriel Corona. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-
-my %stacks;
-
-while (<>) {
- chomp;
- my ($stack_, $value) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/);
- if ($stack_) {
- my @stack = split(/;/, $stack_);
-
- my @result = ();
- my $i;
- my $last = "";
- for ($i = 0; $i != @stack; ++$i) {
- if (!($stack[$i] eq $last)) {
- $result[@result] = $stack[$i];
- $last = $stack[$i];
- }
- }
-
- $stacks{join(";", @result)} += $value;
- }
-}
-
-foreach my $k (sort {$a cmp $b} keys %stacks) {
- print "$k $stacks{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-sample.awk b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-sample.awk
deleted file mode 100644
index bafc4af34..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-sample.awk
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/awk -f
-#
-# Uses MacOS' /usr/bin/sample to generate a flamegraph of a process
-#
-# Usage:
-#
-# sudo sample [pid] -file /dev/stdout | stackcollapse-sample.awk | flamegraph.pl
-#
-# Options:
-#
-# The output will show the name of the library/framework at the call-site
-# with the form AppKit`NSApplication or libsystem`start_wqthread.
-#
-# If showing the framework or library name is not required, pass
-# MODULES=0 as an argument of the sample program.
-#
-# The generated SVG will be written to the output stream, and can be piped
-# into flamegraph.pl directly, or written to a file for conversion later.
-#
-# ---
-#
-# Copyright (c) 2017, Apple Inc.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-BEGIN {
-
- # Command line options
- MODULES = 1 # Allows the user to enable/disable printing of modules.
-
- # Internal variables
- _FOUND_STACK = 0 # Found the stack traces in the output.
- _LEVEL = -1 # The current level of indentation we are running.
-
- # The set of symbols to ignore for 'waiting' threads, for ease of use.
- # This will hide waiting threads from the view, making it easier to
- # see what is actually running in the sample. These may be adjusted
- # as necessary or appended to if other symbols need to be filtered out.
-
- _IGNORE["libsystem_kernel`__psynch_cvwait"] = 1
- _IGNORE["libsystem_kernel`__select"] = 1
- _IGNORE["libsystem_kernel`__semwait_signal"] = 1
- _IGNORE["libsystem_kernel`__ulock_wait"] = 1
- _IGNORE["libsystem_kernel`__wait4"] = 1
- _IGNORE["libsystem_kernel`__workq_kernreturn"] = 1
- _IGNORE["libsystem_kernel`kevent"] = 1
- _IGNORE["libsystem_kernel`mach_msg_trap"] = 1
- _IGNORE["libsystem_kernel`read"] = 1
- _IGNORE["libsystem_kernel`semaphore_wait_trap"] = 1
-
- # The same set of symbols as above, without the module name.
- _IGNORE["__psynch_cvwait"] = 1
- _IGNORE["__select"] = 1
- _IGNORE["__semwait_signal"] = 1
- _IGNORE["__ulock_wait"] = 1
- _IGNORE["__wait4"] = 1
- _IGNORE["__workq_kernreturn"] = 1
- _IGNORE["kevent"] = 1
- _IGNORE["mach_msg_trap"] = 1
- _IGNORE["read"] = 1
- _IGNORE["semaphore_wait_trap"] = 1
-
-}
-
-# This is the first line in the /usr/bin/sample output that indicates the
-# samples follow subsequently. Until we see this line, the rest is ignored.
-
-/^Call graph/ {
- _FOUND_STACK = 1
-}
-
-# This is found when we have reached the end of the stack output.
-# Identified by the string "Total number in stack (...)".
-
-/^Total number/ {
- _FOUND_STACK = 0
- printStack(_NEST,0)
-}
-
-# Prints the stack from FROM to TO (where FROM > TO)
-# Called when indenting back from a previous level, or at the end
-# of processing to flush the last recorded sample
-
-function printStack(FROM,TO) {
-
- # We ignore certain blocking wait states, in the absence of being
- # able to filter these threads from collection, otherwise
- # we'll end up with many threads of equal length that represent
- # the total time the sample was collected.
- #
- # Note that we need to collect the information to ensure that the
- # timekeeping for the parental functions is appropriately adjusted
- # so we just avoid printing it out when that occurs.
- _PRINT_IT = !_IGNORE[_NAMES[FROM]]
-
- # We run through all the names, from the root to the leaf, so that
- # we generate a line that flamegraph.pl will like, of the form:
- # Thread1234;example`main;example`otherFn 1234
-
- for(l = FROM; l>=TO; l--) {
- if (_PRINT_IT) {
- printf("%s", _NAMES[0])
- for(i=1; i<=l; i++) {
- printf(";%s", _NAMES[i])
- }
- print " " _TIMES[l]
- }
-
- # We clean up our current state to avoid bugs.
- delete _NAMES[l]
- delete _TIMES[l]
- }
-}
-
-# This is where we process each line, of the form:
-# 5130 Thread_8749954
-# + 5130 start_wqthread (in libsystem_pthread.dylib) ...
-# + 4282 _pthread_wqthread (in libsystem_pthread.dylib) ...
-# + ! 4282 __doworkq_kernreturn (in libsystem_kernel.dylib) ...
-# + 848 _pthread_wqthread (in libsystem_pthread.dylib) ...
-# + 848 __doworkq_kernreturn (in libsystem_kernel.dylib) ...
-
-_FOUND_STACK && match($0,/^ [^0-9]*[0-9]/) {
-
- # We maintain two counters:
- # _LEVEL: the high water mark of the indentation level we have seen.
- # _NEST: the current indentation level.
- #
- # We keep track of these two levels such that when the nesting level
- # decreases, we print out the current state of where we are.
-
- _NEST=(RLENGTH-5)/2
- sub(/^[^0-9]*/,"") # Normalise the leading content so we start with time.
- _TIME=$1 # The time recorded by 'sample', first integer value.
-
- # The function name is in one or two parts, depending on what kind of
- # function it is.
- #
- # If it is a standard C or C++ function, it will be of the form:
- # exampleFunction
- # Example::Function
- #
- # If it is an Objective-C funtion, it will be of the form:
- # -[NSExample function]
- # +[NSExample staticFunction]
- # -[NSExample function:withParameter]
- # +[NSExample staticFunction:withParameter:andAnother]
-
- _FN1 = $2
- _FN2 = $3
-
- # If it is a standard C or C++ function then the following word will
- # either be blank, or the text '(in', so we jut use the first one:
-
- if (_FN2 == "(in" || _FN2 == "") {
- _FN =_FN1
- } else {
- # Otherwise we concatenate the first two parts with .
- _FN = _FN1 "." _FN2
- }
-
- # Modules are shown with '(in libfoo.dylib)' or '(in AppKit)'
-
- _MODULE = ""
- match($0, /\(in [^)]*\)/)
-
- if (RSTART > 0 && MODULES) {
-
- # Strip off the '(in ' (4 chars) and the final ')' char (1 char)
- _MODULE = substr($0, RSTART+4, RLENGTH-5)
-
- # Remove the .dylib function, since it adds no value.
- gsub(/\.dylib/, "", _MODULE)
-
- # The function name is 'module`functionName'
- _FN = _MODULE "`" _FN
- }
-
- # Now we have set up the variables, we can decide how to apply it
- # If we are descending in the nesting, we don't print anything out:
- # a
- # ab
- # abc
- #
- # We only print out something when we go back a level, or hit the end:
- # abcd
- # abe < prints out the stack up until this point, i.e. abcd
-
- # We store a pair of arrays, indexed by the nesting level:
- #
- # _TIMES - a list of the time reported to that function
- # _NAMES - a list of the function names for each current stack trace
-
- # If we are backtracking, we need to flush the current output.
- if (_NEST <= _LEVEL) {
- printStack(_LEVEL,_NEST)
- }
-
- # Record the name and time of the function where we are.
- _NAMES[_NEST] = _FN
- _TIMES[_NEST] = _TIME
-
- # We subtract the time we took from our parent so we don't double count.
- if (_NEST > 0) {
- _TIMES[_NEST-1] -= _TIME
- }
-
- # Raise the high water mark of the level we have reached.
- _LEVEL = _NEST
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-stap.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-stap.pl
deleted file mode 100644
index caa519ae3..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-stap.pl
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-stap.pl collapse multiline SystemTap stacks
-# into single lines.
-#
-# Parses a multiline stack followed by a number on a separate line, and
-# outputs a semicolon separated stack followed by a space and the number.
-# If memory addresses (+0xd) are present, they are stripped, and resulting
-# identical stacks are colased with their counts summed.
-#
-# USAGE: ./stackcollapse.pl infile > outfile
-#
-# Example input:
-#
-# 0xffffffff8103ce3b : native_safe_halt+0xb/0x10 [kernel]
-# 0xffffffff8101c6a3 : default_idle+0x53/0x1d0 [kernel]
-# 0xffffffff81013236 : cpu_idle+0xd6/0x120 [kernel]
-# 0xffffffff815bf03e : rest_init+0x72/0x74 [kernel]
-# 0xffffffff81aebbfe : start_kernel+0x3ba/0x3c5 [kernel]
-# 2404
-#
-# Example output:
-#
-# start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 2404
-#
-# Input may contain many stacks as generated from SystemTap.
-#
-# Copyright 2011 Joyent, Inc. All rights reserved.
-# Copyright 2011 Brendan Gregg. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# 16-Feb-2012 Brendan Gregg Created this.
-
-use strict;
-
-my %collapsed;
-
-sub remember_stack {
- my ($stack, $count) = @_;
- $collapsed{$stack} += $count;
-}
-
-my @stack;
-
-foreach (<>) {
- chomp;
-
- if (m/^\s*(\d+)+$/) {
- remember_stack(join(";", @stack), $1);
- @stack = ();
- next;
- }
-
- next if (m/^\s*$/);
-
- my $frame = $_;
- $frame =~ s/^\s*//;
- $frame =~ s/\+[^+]*$//;
- $frame =~ s/.* : //;
- $frame = "-" if $frame eq "";
- unshift @stack, $frame;
-}
-
-foreach my $k (sort {$a cmp $b} keys %collapsed) {
- printf "$k $collapsed{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-vsprof.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-vsprof.pl
deleted file mode 100644
index 895686c3a..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-vsprof.pl
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-vsprof.pl
-#
-# Parses the CSV file containing a call tree from a visual studio profiler and produces an output suitable for flamegraph.pl.
-#
-# USAGE: perl stackcollapse-vsprof.pl infile > outfile
-#
-# WORKFLOW:
-#
-# This example assumes you have visual studio 2015 installed.
-#
-# 1. Profile C++ your application using visual studio
-# 2. On visual studio, choose export the call tree as csv
-# 3. Generate a flamegraph: perl stackcollapse-vsprof CallTreeSummary.csv | perl flamegraph.pl > result_vsprof.svg
-#
-# INPUT EXAMPLE :
-#
-# Level,Function Name,Inclusive Samples,Exclusive Samples,Inclusive Samples %,Exclusive Samples %,Module Name,
-# 1,"main","8,735",0,100.00,0.00,"an_executable.exe",
-# 2,"testing::UnitTest::Run","8,735",0,100.00,0.00,"an_executable.exe",
-# 3,"boost::trim_end_iter_select<std::iterator<std::val<std::types<char> > >,boost::is_classifiedF>",306,16,3.50,0.18,"an_executable.exe",
-#
-# OUTPUT EXAMPLE :
-#
-# main;testing::UnitTest::Run;boost::trim_end_iter_select<std::iterator<std::val<std::types<char>>>,boost::is_classifiedF> 306
-
-use strict;
-
-sub massage_function_names;
-sub parse_integer;
-sub print_stack_trace;
-
-# data initialization
-my @stack = ();
-my $line_number = 0;
-my $previous_samples = 0;
-
-my $num_args = $#ARGV + 1;
-if ($num_args != 1) {
- print "$ARGV[0]\n";
- print "Usage : stackcollapse-vsprof.pl <in.cvs> > out.txt\n";
- exit;
-}
-
-my $input_csv_file = $ARGV[0];
-my $line_parser_rx = qr{
- ^\s*(\d+?), # level in the stack
- ("[^"]+" | [^,]+), # function name (beware of spaces)
- ("[^"]+" | [^,]+), # number of samples (beware of locale number formatting)
-}ox;
-
-open(my $fh, '<', $input_csv_file) or die "Can't read file '$input_csv_file' [$!]\n";
-
-while (my $current_line = <$fh>) {
- $line_number = $line_number + 1;
-
- # to discard first line which typically contains headers
- next if $line_number == 1;
- next if $current_line =~ /^\s*$/o;
-
- ($current_line =~ $line_parser_rx) or die "Error in regular expression at line $line_number : $current_line\n";
-
- my $level = int $1;
- my $function = massage_function_names($2);
- my $samples = parse_integer($3);
- my $stack_len = @stack;
-
- #print "[DEBUG] $line_number : $level $function $samples $stack_len\n";
-
- next if not $level;
- ($level <= $stack_len + 1) or die "Error in stack at line $line_number : $current_line\n";
-
- if ($level <= $stack_len) {
- print_stack_trace(\@stack, $previous_samples);
- my $to_remove = $level - $stack_len - 1;
- splice(@stack, $to_remove);
- }
-
- $stack_len < 1000 or die "Stack overflow at line $line_number";
- push(@stack, $function);
- $previous_samples = $samples;
-}
-print_stack_trace(\@stack, $previous_samples);
-
-sub massage_function_names {
- return ($_[0] =~ s/\s*|^"|"$//gro);
-}
-
-sub parse_integer {
- return int($_[0] =~ s/[., ]|^"|"$//gro);
-}
-
-sub print_stack_trace {
- my ($stack_ref, $sample) = @_;
- my $stack_trace = join(";", @$stack_ref);
- print "$stack_trace $sample\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-vtune.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-vtune.pl
deleted file mode 100644
index d5740c122..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-vtune.pl
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse-vtune.pl
-#
-# Parses the CSV file containing a call tree from Intel VTune hotspots profiler and produces an output suitable for flamegraph.pl.
-#
-# USAGE: perl stackcollapse-vtune.pl infile > outfile
-#
-# WORKFLOW:
-#
-# This assumes you have Intel VTune installed and on path (using Command Line)
-#
-# 1. Profile C++ application tachyon_find_hotspots (example shipped with Intel VTune 2013):
-#
-# amplxe-cl -collect hotspots -r result_vtune_tachyon -- ./tachyon_find_hotspots
-#
-# 2. Export raw VTune data to csv file:
-# ###for Intel VTune 2013
-# amplxe-cl -R top-down -call-stack-mode all -report-out result_vtune_tachyon.csv -filter "Function Stack" -format csv -csv-delimiter comma -r result_vtune_tachyon
-#
-# ###for Intel VTune 2015 & 2016
-# amplxe-cl -R top-down -call-stack-mode all -column="CPU Time:Self","Module" -report-out result_vtune_tachyon.csv -filter "Function Stack" -format csv -csv-delimiter comma -r result_vtune_tachyon
-#
-# 3. Generate a flamegraph:
-#
-# perl stackcollapse-vtune result_vtune_tachyon.csv | perl flamegraph.pl > result_vtune_tachyon.svg
-#
-
-use strict;
-
-# data initialization
-my @stack = ();
-my $rowCounter = 0; #flag for row number
-
-my $numArgs = $#ARGV + 1;
-if ($numArgs != 1) {
- print "$ARGV[0]\n";
- print "Usage : stackcollapse-vtune.pl <out.cvs> > out.txt\n";
- exit;
-}
-
-my $inputCSVFile = $ARGV[0];
-
-open(my $fh, '<', $inputCSVFile) or die "Can't read file '$inputCSVFile' [$!]\n";
-
-while (my $currLine = <$fh>) {
- $rowCounter = $rowCounter + 1;
- # to discard first row which typically contains headers
- next if $rowCounter == 1;
- chomp $currLine;
- #VTune - sometimes the call stack information is enclosed in double quotes (?). To remove double quotes.
- $currLine =~ s/\"//g;
-
- ### for Intel VTune 2013
- #$currLine =~ /(\s*)(.*),(.*),[0-9]*\.?[0-9]+[%],([0-9]*\.?[0-9]+)/ or die "Error in regular expression on the current line\n";
- #my $func = $3.'!'.$2;
- #my $depth = length ($1);
- #my $selfTime = $4*1000; # selfTime in msec
-
- ### for Intel VTune 2015 & 2016
- $currLine =~ /(\s*)(.*?),([0-9]*\.?[0-9]+?),(.*)/ or die "Error in regular expression on the current line $currLine\n";
- my $func = $4 . '!' . $2;
- my $depth = length($1);
- my $selfTime = $3 * 1000; # selfTime in msec
-
- my $tempString = '';
- $stack[$depth] = $func;
- foreach my $i (0 .. $depth - 1) {
- $tempString = $tempString . $stack[$i] . ";";
- }
- $tempString = $tempString . $func . " $selfTime\n";
-
- if ($selfTime != 0) {
- print "$tempString";
- }
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-xdebug.php b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-xdebug.php
deleted file mode 100644
index 6548903db..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse-xdebug.php
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/usr/bin/php
-#
-# Copyright 2018 Miriam Lauter (lauter.miriam@gmail.com). All rights reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# (http://www.gnu.org/copyleft/gpl.html)
-#
-# 13-Apr-2018 Miriam Lauter Created this.
-
-<?php
-ini_set('error_log', null);
-$optind = null;
-$args = getopt("htc", ["help"], $optind);
-if (isset($args['h']) || isset($args['help'])) {
- usage();
-}
-
-function usage($exit = 0) {
- echo <<<EOT
-stackcollapse-php.php collapse php function traces into single lines.
-
-Parses php samples generated by xdebug with xdebug.trace_format = 1
-and outputs stacks as single lines, with methods separated by semicolons,
-and then a space and an occurrence count. For use with flamegraph.pl.
-See https://github.com/brendangregg/FlameGraph.
-
-USAGE: ./stackcollapse-php.php [OPTIONS] infile > outfile
- -h --help Show this message
- -t Weight stack counts by duration using the time index in the trace (default)
- -c Invocation counts only. Simply count stacks in the trace and sum duplicates, don't weight by duration.
-
-Example input:
-For more info on xdebug and generating traces see
-https://xdebug.org/docs/execution_trace.
-
-Version: 2.0.0RC4-dev
-TRACE START [2007-05-06 18:29:01]
-1 0 0 0.010870 114112 {main} 1 ../trace.php 0
-2 1 0 0.032009 114272 str_split 0 ../trace.php 8
-2 1 1 0.032073 116632
-2 2 0 0.033505 117424 ret_ord 1 ../trace.php 10
-3 3 0 0.033531 117584 ord 0 ../trace.php 5
-3 3 1 0.033551 117584
-...
-TRACE END [2007-05-06 18:29:01]
-
-Example output:
-
-- c
-{main};str_split 1
-{main};ret_ord;ord 6
-
--t
-{main} 23381
-{main};str_split 64
-{main};ret_ord 215
-{main};ret_ord;ord 106
-
-EOT;
-
- exit($exit);
-}
-
-function collapseStack(array $stack, string $func_name_key): string {
- return implode(';', array_column($stack, $func_name_key));
-}
-
-function addCurrentStackToStacks(array $stack, float $dur, array &$stacks) {
- $collapsed = implode(';', $stack);
- $duration = SCALE_FACTOR * $dur;
-
- if (array_key_exists($collapsed, $stacks)) {
- $stacks[$collapsed] += $duration;
- } else {
- $stacks[$collapsed] = $duration;
- }
-}
-
-function isEOTrace(string $l) {
- $pattern = "/^(\\t|TRACE END)/";
- return preg_match($pattern, $l);
-}
-
-$filename = $argv[$optind] ?? null;
-if ($filename === null) {
- usage(1);
-}
-
-$do_time = !isset($args['c']);
-
-// First make sure our file is consistently formatted with only one \t delimiting each field
-$out = [];
-$retval = null;
-exec("sed -in 's/\t\+/\t/g' " . escapeshellarg($filename), $out, $retval);
-if ($retval !== 0) {
- usage(1);
-}
-
-$handle = fopen($filename, 'r');
-
-if ($handle === false) {
- echo "Unable to open $filename \n\n";
- usage(1);
-}
-
-// Loop till we find TRACE START
-while ($l = fgets($handle)) {
- if (strpos($l, "TRACE START") === 0) {
- break;
- }
-}
-
-const SCALE_FACTOR = 1000000;
-$stacks = [];
-$current_stack = [];
-$was_exit = false;
-$prev_start_time = 0;
-
-if ($do_time) {
- // Weight counts by duration
- // Xdebug trace time indices have 6 sigfigs of precision
- // We have a perfect trace, but let's instead pretend that
- // this was collected by sampling at 10^6 Hz
- // then each millionth of a second this stack took to execute is 1 count
- while ($l = fgets($handle)) {
- if (isEOTrace($l)) {
- break;
- }
-
- $parts = explode("\t", $l);
- list($level, $fn_no, $is_exit, $time) = $parts;
-
- if ($is_exit) {
- if (empty($current_stack)) {
- echo "[WARNING] Found function exit without corresponding entrance. Discarding line. Check your input.\n";
- continue;
- }
-
- addCurrentStackToStacks($current_stack, $time - $prev_start_time, $stacks);
- array_pop($current_stack);
- } else {
- $func_name = $parts[5];
-
- if (!empty($current_stack)) {
- addCurrentStackToStacks($current_stack, $time - $prev_start_time, $stacks);
- }
-
- $current_stack[] = $func_name;
- }
- $prev_start_time = $time;
- }
-} else {
- // Counts only
- while ($l = fgets($handle)) {
- if (isEOTrace($l)) {
- break;
- }
-
- $parts = explode("\t", $l);
- list($level, $fn_no, $is_exit) = $parts;
-
- if ($is_exit === "1") {
- if (!$was_exit) {
- $collapsed = implode(";", $current_stack);
- if (array_key_exists($collapsed, $stacks)) {
- $stacks[$collapsed]++;
- } else {
- $stacks[$collapsed] = 1;
- }
- }
-
- array_pop($current_stack);
- $was_exit = true;
- } else {
- $func_name = $parts[5];
- $current_stack[] = $func_name;
- $was_exit = false;
- }
- }
-}
-
-foreach ($stacks as $stack => $count) {
- echo "$stack $count\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse.pl b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse.pl
deleted file mode 100644
index c33335c7c..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse.pl
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/bin/perl -w
-#
-# stackcollapse.pl collapse multiline stacks into single lines.
-#
-# Parses a multiline stack followed by a number on a separate line, and
-# outputs a semicolon separated stack followed by a space and the number.
-# If memory addresses (+0xd) are present, they are stripped, and resulting
-# identical stacks are colased with their counts summed.
-#
-# USAGE: ./stackcollapse.pl infile > outfile
-#
-# Example input:
-#
-# unix`i86_mwait+0xd
-# unix`cpu_idle_mwait+0xf1
-# unix`idle+0x114
-# unix`thread_start+0x8
-# 1641
-#
-# Example output:
-#
-# unix`thread_start;unix`idle;unix`cpu_idle_mwait;unix`i86_mwait 1641
-#
-# Input may contain many stacks, and can be generated using DTrace. The
-# first few lines of input are skipped (see $headerlines).
-#
-# Copyright 2011 Joyent, Inc. All rights reserved.
-# Copyright 2011 Brendan Gregg. All rights reserved.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at docs/cddl1.txt or
-# http://opensource.org/licenses/CDDL-1.0.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at docs/cddl1.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# 14-Aug-2011 Brendan Gregg Created this.
-
-use strict;
-
-my $headerlines = 3; # number of input lines to skip
-my $includeoffset = 0; # include function offset (except leafs)
-my %collapsed;
-
-sub remember_stack {
- my ($stack, $count) = @_;
- $collapsed{$stack} += $count;
-}
-
-my $nr = 0;
-my @stack;
-
-foreach (<>) {
- next if $nr++ < $headerlines;
- chomp;
-
- if (m/^\s*(\d+)+$/) {
- my $count = $1;
- my $joined = join(";", @stack);
-
- # trim leaf offset if these were retained:
- $joined =~ s/\+[^+]*$// if $includeoffset;
-
- remember_stack($joined, $count);
- @stack = ();
- next;
- }
-
- next if (m/^\s*$/);
-
- my $frame = $_;
- $frame =~ s/^\s*//;
- $frame =~ s/\+[^+]*$// unless $includeoffset;
-
- # Remove arguments from C++ function names:
- $frame =~ s/(::.*)[(<].*/$1/;
-
- $frame = "-" if $frame eq "";
-
- my @inline;
- for (split /\->/, $frame) {
- my $func = $_;
-
- # Strip out L and ; included in java stacks
- $func =~ tr/\;/:/;
- $func =~ s/^L//;
- $func .= "_[i]" if scalar(@inline) > 0; #inlined
-
- push @inline, $func;
- }
-
- unshift @stack, @inline;
-}
-
-foreach my $k (sort {$a cmp $b} keys %collapsed) {
- print "$k $collapsed{$k}\n";
-}
diff --git a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse.py b/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse.py
deleted file mode 100644
index e3d54111f..000000000
--- a/streampark-console/streampark-console-service/src/main/assembly/bin/flame-graph/stackcollapse.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-import argparse
-import json
-
-parser = argparse.ArgumentParser(description = 'Collapse stack trace logs to FlameGraph input file.')
-parser.add_argument("--input", "-i", type=str, required=True, help="Input stack trace file")
-
-args = parser.parse_args()
-inputFile = args.input
-
-with open(inputFile) as f:
- stacktraceDict = {}
-
- for line in f.readlines():
- stacktraceLog = json.loads(line)
-
- assert 'stacktrace' in stacktraceLog, "Malformated json. 'stacktrace' key doesn't exist."
- stacktrace = stacktraceLog['stacktrace']
-
- if len(stacktrace) == 0:
- continue
-
- assert 'count' in stacktraceLog, "Malformated json. 'count' key doesn't exist."
- count = stacktraceLog['count']
-
- key = ';'.join(list(reversed(stacktrace)))
- if key in stacktraceDict:
- stacktraceDict[key] += count
- else:
- stacktraceDict[key] = count
-
- for stacktraceItem in stacktraceDict:
- print("%s %i" % (stacktraceItem, stacktraceDict[stacktraceItem]))
diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql b/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql
index c248423dc..0fb2bef1a 100644
--- a/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql
+++ b/streampark-console/streampark-console-service/src/main/assembly/script/data/mysql-data.sql
@@ -30,7 +30,7 @@ insert into `t_team` values (100000, 'default', null, now(), now());
-- ----------------------------
-- Records of t_flink_app
-- ----------------------------
-insert into `t_flink_app` values (100000, 100000, 2, 4, null, null, 'Flink SQL Demo', null, null, null, null, null, null , null, 100000, null, 1, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, 'Flink SQL Demo', 0, null, 0, null, null, null, null, null, null, 0, 0, now(), now(), null, 1, 1, null, null, null, null, null, null, 0, null, null, null, 'streampark,test');
+insert into `t_flink_app` values (100000, 100000, 2, 4, null, null, 'Flink SQL Demo', null, null, null, null, null, null , null, 100000, null, 1, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, 'Flink SQL Demo', 0, null, null, null, null, null, null, null, 0, 0, now(), now(), null, 1, 1, null, null, null, null, null, null, 0, null, null, null, 'streampark,test');
-- ----------------------------
-- Records of t_flink_effective
@@ -81,43 +81,42 @@ insert into `t_menu` values (100029, 100015, 'savepoint delete', null, null, 'sa
insert into `t_menu` values (100030, 100015, 'backup rollback', null, null, 'backup:rollback', null, '1', 1, null, now(), now());
insert into `t_menu` values (100031, 100015, 'backup delete', null, null, 'backup:delete', null, '1', 1, null, now(), now());
insert into `t_menu` values (100032, 100015, 'conf delete', null, null, 'conf:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100033, 100015, 'flame Graph', null, null, 'app:flameGraph', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100034, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', 1, 5, now(), now());
-insert into `t_menu` values (100035, 100034, 'setting update', null, null, 'setting:update', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100036, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', 0, null, now(), now());
-insert into `t_menu` values (100037, 100015, 'delete', null, null, 'app:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100038, 100000, 'menu.tokenManagement', '/system/token', 'system/token/Token', null, 'lock', '0', 1, 1, now(), now());
-insert into `t_menu` values (100039, 100038, 'add', null, null, 'token:add', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100040, 100038, 'delete', null, null, 'token:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100041, 100034, 'add cluster', '/flink/setting/add_cluster', 'flink/setting/AddCluster', 'cluster:create', '', '0', 0, null, now(), now());
-insert into `t_menu` values (100042, 100034, 'edit cluster', '/flink/setting/edit_cluster', 'flink/setting/EditCluster', 'cluster:update', '', '0', 0, null, now(), now());
-insert into `t_menu` values (100043, 100015, 'copy', null, null, 'app:copy', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100044, 100000, 'menu.teamManagement', '/system/team', 'system/team/Team', null, 'team', '0', 1, 2, now(), now());
-insert into `t_menu` values (100045, 100044, 'add', null, null, 'team:add', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100046, 100044, 'update', null, null, 'team:update', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100047, 100044, 'delete', null, null, 'team:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100048, 100000, 'menu.memberManagement', '/system/member', 'system/member/Member', null, 'usergroup-add', '0', 1, 2, now(), now());
-insert into `t_menu` values (100049, 100048, 'add', null, null, 'member:add', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100050, 100048, 'update', null, null, 'member:update', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100051, 100048, 'delete', null, null, 'member:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100052, 100048, 'role view', null, null, 'role:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100053, 100001, 'types', null, null, 'user:types', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100054, 100013, 'menu.variable', '/flink/variable', 'flink/variable/View', null, 'code', '0', 1, 3, now(), now());
-insert into `t_menu` values (100055, 100054, 'add', NULL, NULL, 'variable:add', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100056, 100054, 'update', NULL, NULL, 'variable:update', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100057, 100054, 'delete', NULL, NULL, 'variable:delete', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100058, 100054, 'depend apps', '/flink/variable/depend_apps', 'flink/variable/DependApps', 'variable:depend_apps', '', '0', 0, NULL, now(), now());
-insert into `t_menu` values (100059, 100054, 'show original', NULL, NULL, 'variable:show_original', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100060, 100001, 'view', null, null, 'user:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100061, 100038, 'view', null, null, 'token:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100062, 100002, 'view', null, null, 'role:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100063, 100044, 'view', null, null, 'team:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100064, 100048, 'view', null, null, 'member:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100066, 100014, 'view', null, null, 'project:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100067, 100015, 'view', null, null, 'app:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100068, 100054, 'view', NULL, NULL, 'variable:view', NULL, '1', 1, null, now(), now());
-insert into `t_menu` values (100069, 100034, 'view', null, null, 'setting:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100070, 100054, 'depend view', null, null, 'variable:depend_apps', null, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100033, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', 1, 5, now(), now());
+insert into `t_menu` values (100034, 100033, 'setting update', null, null, 'setting:update', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100035, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', 0, null, now(), now());
+insert into `t_menu` values (100036, 100015, 'delete', null, null, 'app:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100037, 100000, 'menu.tokenManagement', '/system/token', 'system/token/Token', null, 'lock', '0', 1, 1, now(), now());
+insert into `t_menu` values (100038, 100037, 'add', null, null, 'token:add', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100039, 100037, 'delete', null, null, 'token:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100040, 100033, 'add cluster', '/flink/setting/add_cluster', 'flink/setting/AddCluster', 'cluster:create', '', '0', 0, null, now(), now());
+insert into `t_menu` values (100041, 100033, 'edit cluster', '/flink/setting/edit_cluster', 'flink/setting/EditCluster', 'cluster:update', '', '0', 0, null, now(), now());
+insert into `t_menu` values (100042, 100015, 'copy', null, null, 'app:copy', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100043, 100000, 'menu.teamManagement', '/system/team', 'system/team/Team', null, 'team', '0', 1, 2, now(), now());
+insert into `t_menu` values (100044, 100043, 'add', null, null, 'team:add', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100045, 100043, 'update', null, null, 'team:update', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100046, 100043, 'delete', null, null, 'team:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100047, 100000, 'menu.memberManagement', '/system/member', 'system/member/Member', null, 'usergroup-add', '0', 1, 2, now(), now());
+insert into `t_menu` values (100048, 100047, 'add', null, null, 'member:add', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100049, 100047, 'update', null, null, 'member:update', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100050, 100047, 'delete', null, null, 'member:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100051, 100047, 'role view', null, null, 'role:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100052, 100001, 'types', null, null, 'user:types', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100053, 100013, 'menu.variable', '/flink/variable', 'flink/variable/View', null, 'code', '0', 1, 3, now(), now());
+insert into `t_menu` values (100054, 100053, 'add', NULL, NULL, 'variable:add', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100055, 100053, 'update', NULL, NULL, 'variable:update', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100056, 100053, 'delete', NULL, NULL, 'variable:delete', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100057, 100053, 'depend apps', '/flink/variable/depend_apps', 'flink/variable/DependApps', 'variable:depend_apps', '', '0', 0, NULL, now(), now());
+insert into `t_menu` values (100058, 100053, 'show original', NULL, NULL, 'variable:show_original', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100059, 100001, 'view', null, null, 'user:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100060, 100037, 'view', null, null, 'token:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100061, 100002, 'view', null, null, 'role:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100062, 100043, 'view', null, null, 'team:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100063, 100047, 'view', null, null, 'member:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100065, 100014, 'view', null, null, 'project:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100066, 100015, 'view', null, null, 'app:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100067, 100053, 'view', NULL, NULL, 'variable:view', NULL, '1', 1, null, now(), now());
+insert into `t_menu` values (100068, 100033, 'view', null, null, 'setting:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100069, 100053, 'depend view', null, null, 'variable:depend_apps', null, '1', 1, NULL, now(), now());
-- ----------------------------
-- Records of t_role
@@ -128,63 +127,59 @@ insert into `t_role` values (100002, 'team admin', 'Team Admin has all permissio
-- ----------------------------
-- Records of t_role_menu
-- ----------------------------
-insert into `t_role_menu` values (100041, 100001, 100014);
-insert into `t_role_menu` values (100042, 100001, 100016);
-insert into `t_role_menu` values (100043, 100001, 100017);
-insert into `t_role_menu` values (100044, 100001, 100018);
--- insert into `t_role_menu` values (100045, 100001, 100019);
-insert into `t_role_menu` values (100046, 100001, 100020);
-insert into `t_role_menu` values (100047, 100001, 100021);
-insert into `t_role_menu` values (100048, 100001, 100022);
-insert into `t_role_menu` values (100049, 100001, 100025);
-insert into `t_role_menu` values (100050, 100001, 100026);
-insert into `t_role_menu` values (100051, 100001, 100027);
-insert into `t_role_menu` values (100052, 100001, 100028);
-insert into `t_role_menu` values (100053, 100001, 100029);
-insert into `t_role_menu` values (100054, 100001, 100030);
-insert into `t_role_menu` values (100055, 100001, 100031);
-insert into `t_role_menu` values (100056, 100001, 100032);
-insert into `t_role_menu` values (100057, 100001, 100033);
-insert into `t_role_menu` values (100058, 100001, 100013);
-insert into `t_role_menu` values (100059, 100001, 100015);
-insert into `t_role_menu` values (100060, 100002, 100014);
-insert into `t_role_menu` values (100061, 100002, 100016);
-insert into `t_role_menu` values (100062, 100002, 100017);
-insert into `t_role_menu` values (100063, 100002, 100018);
--- insert into `t_role_menu` values (100064, 100002, 100019);
-insert into `t_role_menu` values (100065, 100002, 100020);
-insert into `t_role_menu` values (100066, 100002, 100021);
-insert into `t_role_menu` values (100067, 100002, 100022);
-insert into `t_role_menu` values (100068, 100002, 100025);
-insert into `t_role_menu` values (100069, 100002, 100026);
-insert into `t_role_menu` values (100070, 100002, 100027);
-insert into `t_role_menu` values (100071, 100002, 100028);
-insert into `t_role_menu` values (100072, 100002, 100029);
-insert into `t_role_menu` values (100073, 100002, 100030);
-insert into `t_role_menu` values (100074, 100002, 100031);
-insert into `t_role_menu` values (100075, 100002, 100032);
-insert into `t_role_menu` values (100076, 100002, 100033);
-insert into `t_role_menu` values (100077, 100002, 100013);
-insert into `t_role_menu` values (100079, 100002, 100015);
-insert into `t_role_menu` values (100080, 100002, 100000);
-insert into `t_role_menu` values (100081, 100002, 100037);
-insert into `t_role_menu` values (100082, 100002, 100048);
-insert into `t_role_menu` values (100083, 100002, 100049);
-insert into `t_role_menu` values (100084, 100002, 100050);
-insert into `t_role_menu` values (100085, 100002, 100051);
-insert into `t_role_menu` values (100086, 100002, 100052);
-insert into `t_role_menu` values (100087, 100002, 100053);
-insert into `t_role_menu` values (100088, 100002, 100054);
-insert into `t_role_menu` values (100089, 100002, 100055);
-insert into `t_role_menu` values (100090, 100002, 100056);
-insert into `t_role_menu` values (100091, 100002, 100057);
-insert into `t_role_menu` values (100092, 100001, 100066);
-insert into `t_role_menu` values (100093, 100002, 100066);
-insert into `t_role_menu` values (100094, 100001, 100067);
-insert into `t_role_menu` values (100095, 100002, 100067);
-insert into `t_role_menu` values (100096, 100002, 100064);
-insert into `t_role_menu` values (100097, 100002, 100060);
-insert into `t_role_menu` values (100098, 100002, 100068);
+insert into `t_role_menu` values (100001, 100001, 100014);
+insert into `t_role_menu` values (100002, 100001, 100016);
+insert into `t_role_menu` values (100003, 100001, 100017);
+insert into `t_role_menu` values (100004, 100001, 100018);
+insert into `t_role_menu` values (100005, 100001, 100020);
+insert into `t_role_menu` values (100006, 100001, 100021);
+insert into `t_role_menu` values (100007, 100001, 100022);
+insert into `t_role_menu` values (100008, 100001, 100025);
+insert into `t_role_menu` values (100009, 100001, 100026);
+insert into `t_role_menu` values (100010, 100001, 100027);
+insert into `t_role_menu` values (100011, 100001, 100028);
+insert into `t_role_menu` values (100012, 100001, 100029);
+insert into `t_role_menu` values (100013, 100001, 100030);
+insert into `t_role_menu` values (100014, 100001, 100031);
+insert into `t_role_menu` values (100015, 100001, 100032);
+insert into `t_role_menu` values (100016, 100001, 100013);
+insert into `t_role_menu` values (100017, 100001, 100015);
+insert into `t_role_menu` values (100018, 100002, 100014);
+insert into `t_role_menu` values (100019, 100002, 100016);
+insert into `t_role_menu` values (100020, 100002, 100017);
+insert into `t_role_menu` values (100021, 100002, 100018);
+insert into `t_role_menu` values (100022, 100002, 100020);
+insert into `t_role_menu` values (100023, 100002, 100021);
+insert into `t_role_menu` values (100024, 100002, 100022);
+insert into `t_role_menu` values (100025, 100002, 100025);
+insert into `t_role_menu` values (100026, 100002, 100026);
+insert into `t_role_menu` values (100027, 100002, 100027);
+insert into `t_role_menu` values (100028, 100002, 100028);
+insert into `t_role_menu` values (100029, 100002, 100029);
+insert into `t_role_menu` values (100030, 100002, 100030);
+insert into `t_role_menu` values (100031, 100002, 100031);
+insert into `t_role_menu` values (100032, 100002, 100032);
+insert into `t_role_menu` values (100033, 100002, 100013);
+insert into `t_role_menu` values (100034, 100002, 100015);
+insert into `t_role_menu` values (100035, 100002, 100000);
+insert into `t_role_menu` values (100036, 100002, 100036);
+insert into `t_role_menu` values (100037, 100002, 100047);
+insert into `t_role_menu` values (100038, 100002, 100048);
+insert into `t_role_menu` values (100039, 100002, 100049);
+insert into `t_role_menu` values (100040, 100002, 100050);
+insert into `t_role_menu` values (100041, 100002, 100051);
+insert into `t_role_menu` values (100042, 100002, 100052);
+insert into `t_role_menu` values (100043, 100002, 100053);
+insert into `t_role_menu` values (100044, 100002, 100054);
+insert into `t_role_menu` values (100045, 100002, 100055);
+insert into `t_role_menu` values (100046, 100002, 100056);
+insert into `t_role_menu` values (100047, 100001, 100065);
+insert into `t_role_menu` values (100048, 100002, 100065);
+insert into `t_role_menu` values (100049, 100001, 100066);
+insert into `t_role_menu` values (100050, 100002, 100066);
+insert into `t_role_menu` values (100051, 100002, 100063);
+insert into `t_role_menu` values (100052, 100002, 100059);
+insert into `t_role_menu` values (100053, 100002, 100067);
-- ----------------------------
-- Records of t_setting
diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql b/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql
index 404a396a4..0b5325efc 100644
--- a/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql
+++ b/streampark-console/streampark-console-service/src/main/assembly/script/data/pgsql-data.sql
@@ -25,7 +25,7 @@ insert into "public"."t_team" values (100000, 'default', null, now(), now());
-- ----------------------------
-- Records of t_flink_app
-- ----------------------------
-insert into "public"."t_flink_app" values (100000, 100000, 2, 4, null, null, 'Flink SQL Demo', null, null, null, null, null, null , null, 100000, null, 1, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, 'Flink SQL Demo', 0, null, false, null, null, null, null, null, null, 0, 0, now(), now(), null, 1, true, null, null, null, null, null, null, false, null, null, null, 'streampark,test');
+insert into "public"."t_flink_app" values (100000, 100000, 2, 4, null, null, 'Flink SQL Demo', null, null, null, null, null , null, 100000, null, 1, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, 'Flink SQL Demo', 0, null, false, null, null, null, null, null, null, 0, 0, now(), now(), null, 1, true, null, null, null, null, null, null, false, null, null, null, 'streampark,test');
-- ----------------------------
-- Records of t_flink_effective
@@ -77,43 +77,42 @@ insert into "public"."t_menu" values (100029, 100015, 'savepoint delete', null,
insert into "public"."t_menu" values (100030, 100015, 'backup rollback', null, null, 'backup:rollback', null, '1', '1', null, now(), now());
insert into "public"."t_menu" values (100031, 100015, 'backup delete', null, null, 'backup:delete', null, '1', '1', null, now(), now());
insert into "public"."t_menu" values (100032, 100015, 'conf delete', null, null, 'conf:delete', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100033, 100015, 'flame Graph', null, null, 'app:flameGraph', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100034, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', '1', 5, now(), now());
-insert into "public"."t_menu" values (100035, 100034, 'setting update', null, null, 'setting:update', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100036, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', '0', null, now(), now());
-insert into "public"."t_menu" values (100037, 100015, 'delete', null, null, 'app:delete', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100038, 100000, 'menu.tokenManagement', '/system/token', 'system/token/Token', null, 'lock', '0', '1', 1, now(), now());
-insert into "public"."t_menu" values (100039, 100038, 'add', null, null, 'token:add', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100040, 100038, 'delete', null, null, 'token:delete', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100041, 100034, 'add cluster', '/flink/setting/add_cluster', 'flink/setting/AddCluster', 'cluster:create', '', '0', '0', null, now(), now());
-insert into "public"."t_menu" values (100042, 100034, 'edit cluster', '/flink/setting/edit_cluster', 'flink/setting/EditCluster', 'cluster:update', '', '0', '0', null, now(), now());
-insert into "public"."t_menu" values (100043, 100015, 'copy', null, null, 'app:copy', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100044, 100000, 'menu.teamManagement', '/system/team', 'system/team/Team', null, 'team', '0', '1', 2, now(), now());
-insert into "public"."t_menu" values (100045, 100044, 'add', null, null, 'team:add', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100046, 100044, 'update', null, null, 'team:update', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100047, 100044, 'delete', null, null, 'team:delete', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100048, 100000, 'menu.memberManagement', '/system/member', 'system/member/Member', null, 'usergroup-add', '0', '1', 2, now(), now());
-insert into "public"."t_menu" values (100049, 100048, 'add', null, null, 'member:add', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100050, 100048, 'update', null, null, 'member:update', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100051, 100048, 'delete', null, null, 'member:delete', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100052, 100048, 'role view', null, null, 'role:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100053, 100001, 'types', null, null, 'user:types', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100054, 100013, 'menu.variable', '/flink/variable', 'flink/variable/View', null, 'code', '0', '1', 3, now(), now());
-insert into "public"."t_menu" values (100055, 100054, 'add', NULL, NULL, 'variable:add', NULL, '1', '1', NULL, now(), now());
-insert into "public"."t_menu" values (100056, 100054, 'update', NULL, NULL, 'variable:update', NULL, '1', '1', NULL, now(), now());
-insert into "public"."t_menu" values (100057, 100054, 'delete', NULL, NULL, 'variable:delete', NULL, '1', '1', NULL, now(), now());
-insert into "public"."t_menu" values (100058, 100054, 'depend apps', '/flink/variable/depend_apps', 'flink/variable/DependApps', 'variable:depend_apps', '', '0', '0', NULL, now(), now());
-insert into "public"."t_menu" values (100059, 100054, 'show original', NULL, NULL, 'variable:show_original', NULL, '1', '1', NULL, now(), now());
-insert into "public"."t_menu" values (100060, 100001, 'view', null, null, 'user:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100061, 100038, 'view', null, null, 'token:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100062, 100002, 'view', null, null, 'role:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100063, 100044, 'view', null, null, 'team:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100064, 100048, 'view', null, null, 'member:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100066, 100014, 'view', null, null, 'project:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100067, 100015, 'view', null, null, 'app:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100068, 100054, 'view', NULL, NULL, 'variable:view', NULL, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100069, 100034, 'view', null, null, 'setting:view', null, '1', '1', null, now(), now());
-insert into "public"."t_menu" values (100070, 100054, 'depend view', null, null, 'variable:depend_apps', null, '1', '1', NULL, now(), now());
+insert into "public"."t_menu" values (100033, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', '1', 5, now(), now());
+insert into "public"."t_menu" values (100034, 100033, 'setting update', null, null, 'setting:update', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100035, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', '0', null, now(), now());
+insert into "public"."t_menu" values (100036, 100015, 'delete', null, null, 'app:delete', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100037, 100000, 'menu.tokenManagement', '/system/token', 'system/token/Token', null, 'lock', '0', '1', 1, now(), now());
+insert into "public"."t_menu" values (100038, 100037, 'add', null, null, 'token:add', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100039, 100037, 'delete', null, null, 'token:delete', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100040, 100033, 'add cluster', '/flink/setting/add_cluster', 'flink/setting/AddCluster', 'cluster:create', '', '0', '0', null, now(), now());
+insert into "public"."t_menu" values (100041, 100033, 'edit cluster', '/flink/setting/edit_cluster', 'flink/setting/EditCluster', 'cluster:update', '', '0', '0', null, now(), now());
+insert into "public"."t_menu" values (100042, 100015, 'copy', null, null, 'app:copy', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100043, 100000, 'menu.teamManagement', '/system/team', 'system/team/Team', null, 'team', '0', '1', 2, now(), now());
+insert into "public"."t_menu" values (100044, 100043, 'add', null, null, 'team:add', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100045, 100043, 'update', null, null, 'team:update', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100046, 100043, 'delete', null, null, 'team:delete', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100047, 100000, 'menu.memberManagement', '/system/member', 'system/member/Member', null, 'usergroup-add', '0', '1', 2, now(), now());
+insert into "public"."t_menu" values (100048, 100047, 'add', null, null, 'member:add', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100049, 100047, 'update', null, null, 'member:update', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100050, 100047, 'delete', null, null, 'member:delete', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100051, 100047, 'role view', null, null, 'role:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100052, 100001, 'types', null, null, 'user:types', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100053, 100013, 'menu.variable', '/flink/variable', 'flink/variable/View', null, 'code', '0', '1', 3, now(), now());
+insert into "public"."t_menu" values (100054, 100053, 'add', NULL, NULL, 'variable:add', NULL, '1', '1', NULL, now(), now());
+insert into "public"."t_menu" values (100055, 100053, 'update', NULL, NULL, 'variable:update', NULL, '1', '1', NULL, now(), now());
+insert into "public"."t_menu" values (100056, 100053, 'delete', NULL, NULL, 'variable:delete', NULL, '1', '1', NULL, now(), now());
+insert into "public"."t_menu" values (100057, 100053, 'depend apps', '/flink/variable/depend_apps', 'flink/variable/DependApps', 'variable:depend_apps', '', '0', '0', NULL, now(), now());
+insert into "public"."t_menu" values (100058, 100053, 'show original', NULL, NULL, 'variable:show_original', NULL, '1', '1', NULL, now(), now());
+insert into "public"."t_menu" values (100059, 100001, 'view', null, null, 'user:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100060, 100037, 'view', null, null, 'token:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100061, 100002, 'view', null, null, 'role:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100062, 100043, 'view', null, null, 'team:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100063, 100047, 'view', null, null, 'member:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100065, 100014, 'view', null, null, 'project:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100066, 100015, 'view', null, null, 'app:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100067, 100053, 'view', NULL, NULL, 'variable:view', NULL, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100068, 100033, 'view', null, null, 'setting:view', null, '1', '1', null, now(), now());
+insert into "public"."t_menu" values (100069, 100053, 'depend view', null, null, 'variable:depend_apps', null, '1', '1', NULL, now(), now());
-- ----------------------------
-- Records of t_role
@@ -124,63 +123,59 @@ insert into "public"."t_role" values (100002, 'team admin', 'Team Admin has all
-- ----------------------------
-- Records of t_role_menu
-- ----------------------------
-insert into "public"."t_role_menu" values (100041, 100001, 100014);
-insert into "public"."t_role_menu" values (100042, 100001, 100016);
-insert into "public"."t_role_menu" values (100043, 100001, 100017);
-insert into "public"."t_role_menu" values (100044, 100001, 100018);
--- insert into "public"."t_role_menu" values (100045, 100001, 100019);
-insert into "public"."t_role_menu" values (100046, 100001, 100020);
-insert into "public"."t_role_menu" values (100047, 100001, 100021);
-insert into "public"."t_role_menu" values (100048, 100001, 100022);
-insert into "public"."t_role_menu" values (100049, 100001, 100025);
-insert into "public"."t_role_menu" values (100050, 100001, 100026);
-insert into "public"."t_role_menu" values (100051, 100001, 100027);
-insert into "public"."t_role_menu" values (100052, 100001, 100028);
-insert into "public"."t_role_menu" values (100053, 100001, 100029);
-insert into "public"."t_role_menu" values (100054, 100001, 100030);
-insert into "public"."t_role_menu" values (100055, 100001, 100031);
-insert into "public"."t_role_menu" values (100056, 100001, 100032);
-insert into "public"."t_role_menu" values (100057, 100001, 100033);
-insert into "public"."t_role_menu" values (100058, 100001, 100013);
-insert into "public"."t_role_menu" values (100059, 100001, 100015);
-insert into "public"."t_role_menu" values (100060, 100002, 100014);
-insert into "public"."t_role_menu" values (100061, 100002, 100016);
-insert into "public"."t_role_menu" values (100062, 100002, 100017);
-insert into "public"."t_role_menu" values (100063, 100002, 100018);
--- insert into "public"."t_role_menu" values (100064, 100002, 100019);
-insert into "public"."t_role_menu" values (100065, 100002, 100020);
-insert into "public"."t_role_menu" values (100066, 100002, 100021);
-insert into "public"."t_role_menu" values (100067, 100002, 100022);
-insert into "public"."t_role_menu" values (100068, 100002, 100025);
-insert into "public"."t_role_menu" values (100069, 100002, 100026);
-insert into "public"."t_role_menu" values (100070, 100002, 100027);
-insert into "public"."t_role_menu" values (100071, 100002, 100028);
-insert into "public"."t_role_menu" values (100072, 100002, 100029);
-insert into "public"."t_role_menu" values (100073, 100002, 100030);
-insert into "public"."t_role_menu" values (100074, 100002, 100031);
-insert into "public"."t_role_menu" values (100075, 100002, 100032);
-insert into "public"."t_role_menu" values (100076, 100002, 100033);
-insert into "public"."t_role_menu" values (100077, 100002, 100013);
-insert into "public"."t_role_menu" values (100079, 100002, 100015);
-insert into "public"."t_role_menu" values (100080, 100002, 100000);
-insert into "public"."t_role_menu" values (100081, 100002, 100037);
-insert into "public"."t_role_menu" values (100082, 100002, 100048);
-insert into "public"."t_role_menu" values (100083, 100002, 100049);
-insert into "public"."t_role_menu" values (100084, 100002, 100050);
-insert into "public"."t_role_menu" values (100085, 100002, 100051);
-insert into "public"."t_role_menu" values (100086, 100002, 100052);
-insert into "public"."t_role_menu" values (100087, 100002, 100053);
-insert into "public"."t_role_menu" values (100088, 100002, 100054);
-insert into "public"."t_role_menu" values (100089, 100002, 100055);
-insert into "public"."t_role_menu" values (100090, 100002, 100056);
-insert into "public"."t_role_menu" values (100091, 100002, 100057);
-insert into "public"."t_role_menu" values (100092, 100001, 100066);
-insert into "public"."t_role_menu" values (100093, 100002, 100066);
-insert into "public"."t_role_menu" values (100094, 100001, 100067);
-insert into "public"."t_role_menu" values (100095, 100002, 100067);
-insert into "public"."t_role_menu" values (100096, 100002, 100064);
-insert into "public"."t_role_menu" values (100097, 100002, 100060);
-insert into "public"."t_role_menu" values (100098, 100002, 100068);
+insert into "public"."t_role_menu" values (100001, 100001, 100014);
+insert into "public"."t_role_menu" values (100002, 100001, 100016);
+insert into "public"."t_role_menu" values (100003, 100001, 100017);
+insert into "public"."t_role_menu" values (100004, 100001, 100018);
+insert into "public"."t_role_menu" values (100005, 100001, 100020);
+insert into "public"."t_role_menu" values (100006, 100001, 100021);
+insert into "public"."t_role_menu" values (100007, 100001, 100022);
+insert into "public"."t_role_menu" values (100008, 100001, 100025);
+insert into "public"."t_role_menu" values (100009, 100001, 100026);
+insert into "public"."t_role_menu" values (100010, 100001, 100027);
+insert into "public"."t_role_menu" values (100011, 100001, 100028);
+insert into "public"."t_role_menu" values (100012, 100001, 100029);
+insert into "public"."t_role_menu" values (100013, 100001, 100030);
+insert into "public"."t_role_menu" values (100014, 100001, 100031);
+insert into "public"."t_role_menu" values (100015, 100001, 100032);
+insert into "public"."t_role_menu" values (100016, 100001, 100013);
+insert into "public"."t_role_menu" values (100017, 100001, 100015);
+insert into "public"."t_role_menu" values (100018, 100002, 100014);
+insert into "public"."t_role_menu" values (100019, 100002, 100016);
+insert into "public"."t_role_menu" values (100020, 100002, 100017);
+insert into "public"."t_role_menu" values (100021, 100002, 100018);
+insert into "public"."t_role_menu" values (100022, 100002, 100020);
+insert into "public"."t_role_menu" values (100023, 100002, 100021);
+insert into "public"."t_role_menu" values (100024, 100002, 100022);
+insert into "public"."t_role_menu" values (100025, 100002, 100025);
+insert into "public"."t_role_menu" values (100026, 100002, 100026);
+insert into "public"."t_role_menu" values (100027, 100002, 100027);
+insert into "public"."t_role_menu" values (100028, 100002, 100028);
+insert into "public"."t_role_menu" values (100029, 100002, 100029);
+insert into "public"."t_role_menu" values (100030, 100002, 100030);
+insert into "public"."t_role_menu" values (100031, 100002, 100031);
+insert into "public"."t_role_menu" values (100032, 100002, 100032);
+insert into "public"."t_role_menu" values (100033, 100002, 100013);
+insert into "public"."t_role_menu" values (100034, 100002, 100015);
+insert into "public"."t_role_menu" values (100035, 100002, 100000);
+insert into "public"."t_role_menu" values (100036, 100002, 100036);
+insert into "public"."t_role_menu" values (100037, 100002, 100047);
+insert into "public"."t_role_menu" values (100038, 100002, 100048);
+insert into "public"."t_role_menu" values (100039, 100002, 100049);
+insert into "public"."t_role_menu" values (100040, 100002, 100050);
+insert into "public"."t_role_menu" values (100041, 100002, 100051);
+insert into "public"."t_role_menu" values (100042, 100002, 100052);
+insert into "public"."t_role_menu" values (100043, 100002, 100053);
+insert into "public"."t_role_menu" values (100044, 100002, 100054);
+insert into "public"."t_role_menu" values (100045, 100002, 100055);
+insert into "public"."t_role_menu" values (100046, 100002, 100056);
+insert into "public"."t_role_menu" values (100047, 100001, 100065);
+insert into "public"."t_role_menu" values (100048, 100002, 100065);
+insert into "public"."t_role_menu" values (100049, 100001, 100066);
+insert into "public"."t_role_menu" values (100050, 100002, 100066);
+insert into "public"."t_role_menu" values (100051, 100002, 100063);
+insert into "public"."t_role_menu" values (100052, 100002, 100059);
+insert into "public"."t_role_menu" values (100053, 100002, 100067);
-- ----------------------------
-- Records of t_setting
-- ----------------------------
diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql b/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
index ef0280a48..a7d914cec 100644
--- a/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
+++ b/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
@@ -37,23 +37,6 @@ create table `t_app_backup` (
primary key (`id`) using btree
) engine=innodb auto_increment=100000 default charset=utf8mb4 collate=utf8mb4_general_ci;
-
--- ----------------------------
--- table structure for t_flame_graph
--- ----------------------------
-drop table if exists `t_flame_graph`;
-create table `t_flame_graph` (
- `id` bigint not null auto_increment,
- `app_id` bigint default null,
- `profiler` varchar(255) collate utf8mb4_general_ci default null,
- `timeline` datetime default null,
- `content` text collate utf8mb4_general_ci,
- primary key (`id`) using btree,
- key `inx_time` (`timeline`),
- key `inx_appid` (`app_id`)
-) engine=innodb auto_increment=100000 default charset=utf8mb4 collate=utf8mb4_general_ci;
-
-
-- ----------------------------
-- Table structure for t_flink_app
-- ----------------------------
@@ -94,7 +77,6 @@ create table `t_flink_app` (
`description` varchar(255) collate utf8mb4_general_ci default null,
`resolve_order` tinyint default null,
`k8s_rest_exposed_type` tinyint default null,
- `flame_graph` tinyint default 0,
`jm_memory` int default null,
`tm_memory` int default null,
`total_task` int default null,
diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql b/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
index e6032e87b..7654c79a7 100644
--- a/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
+++ b/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
@@ -35,7 +35,6 @@ drop table if exists "public"."t_flink_effective";
drop table if exists "public"."t_flink_config";
drop table if exists "public"."t_flink_cluster";
drop table if exists "public"."t_flink_app";
-drop table if exists "public"."t_flame_graph";
drop table if exists "public"."t_app_build_pipe";
drop table if exists "public"."t_app_backup";
drop table if exists "public"."t_alert_config";
@@ -61,7 +60,6 @@ drop sequence if exists "public"."streampark_t_flink_effective_id_seq";
drop sequence if exists "public"."streampark_t_flink_config_id_seq";
drop sequence if exists "public"."streampark_t_flink_cluster_id_seq";
drop sequence if exists "public"."streampark_t_flink_app_id_seq";
-drop sequence if exists "public"."streampark_t_flame_graph_id_seq";
drop sequence if exists "public"."streampark_t_app_backup_id_seq";
drop sequence if exists "public"."streampark_t_alert_config_id_seq";
drop sequence if exists "public"."streampark_t_access_token_id_seq";
@@ -182,29 +180,6 @@ create table "public"."t_app_build_pipe" (
;
alter table "public"."t_app_build_pipe" add constraint "t_app_build_pipe_pkey" primary key ("app_id");
-
--- ----------------------------
--- table structure for t_flame_graph
--- ----------------------------
-create sequence "public"."streampark_t_flame_graph_id_seq"
- increment 1 start 10000 cache 1 minvalue 10000 maxvalue 9223372036854775807;
-
-create table "public"."t_flame_graph" (
- "id" int8 not null default nextval('streampark_t_flame_graph_id_seq'::regclass),
- "app_id" int8,
- "profiler" varchar(255) collate "pg_catalog"."default",
- "timeline" timestamp(6),
- "content" text collate "pg_catalog"."default"
-)
-;
-alter table "public"."t_flame_graph" add constraint "t_flame_graph_pkey" primary key ("id");
-create index "inx_appid" on "public"."t_flame_graph" using btree (
- "app_id" "pg_catalog"."int8_ops" asc nulls last
-);
-create index "inx_time" on "public"."t_flame_graph" using btree (
- "timeline" "pg_catalog"."timestamp_ops" asc nulls last
-);
-
-- ----------------------------
-- table structure for t_flink_app
-- ----------------------------
@@ -247,7 +222,6 @@ create table "public"."t_flink_app" (
"description" varchar(255) collate "pg_catalog"."default",
"resolve_order" int2,
"k8s_rest_exposed_type" int2,
- "flame_graph" boolean default false,
"jm_memory" int4,
"tm_memory" int4,
"total_task" int4,
diff --git a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.0.0.sql b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.0.0.sql
index d82f80bc3..735709c6a 100644
--- a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.0.0.sql
+++ b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.0.0.sql
@@ -157,43 +157,98 @@ insert into `t_menu` values (100029, 100015, 'savepoint delete', null, null, 'sa
insert into `t_menu` values (100030, 100015, 'backup rollback', null, null, 'backup:rollback', null, '1', 1, null, now(), now());
insert into `t_menu` values (100031, 100015, 'backup delete', null, null, 'backup:delete', null, '1', 1, null, now(), now());
insert into `t_menu` values (100032, 100015, 'conf delete', null, null, 'conf:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100033, 100015, 'flame Graph', null, null, 'app:flameGraph', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100034, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', 1, 5, now(), now());
-insert into `t_menu` values (100035, 100034, 'setting update', null, null, 'setting:update', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100036, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', 0, null, now(), now());
-insert into `t_menu` values (100037, 100015, 'delete', null, null, 'app:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100038, 100000, 'menu.tokenManagement', '/system/token', 'system/token/Token', null, 'lock', '0', 1, 1, now(), now());
-insert into `t_menu` values (100039, 100038, 'add', null, null, 'token:add', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100040, 100038, 'delete', null, null, 'token:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100041, 100034, 'add cluster', '/flink/setting/add_cluster', 'flink/setting/AddCluster', 'cluster:create', '', '0', 0, null, now(), now());
-insert into `t_menu` values (100042, 100034, 'edit cluster', '/flink/setting/edit_cluster', 'flink/setting/EditCluster', 'cluster:update', '', '0', 0, null, now(), now());
-insert into `t_menu` values (100043, 100015, 'copy', null, null, 'app:copy', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100044, 100000, 'menu.teamManagement', '/system/team', 'system/team/Team', null, 'team', '0', 1, 2, now(), now());
-insert into `t_menu` values (100045, 100044, 'add', null, null, 'team:add', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100046, 100044, 'update', null, null, 'team:update', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100047, 100044, 'delete', null, null, 'team:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100048, 100000, 'menu.memberManagement', '/system/member', 'system/member/Member', null, 'usergroup-add', '0', 1, 2, now(), now());
-insert into `t_menu` values (100049, 100048, 'add', null, null, 'member:add', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100050, 100048, 'update', null, null, 'member:update', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100051, 100048, 'delete', null, null, 'member:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100052, 100048, 'role view', null, null, 'role:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100053, 100001, 'types', null, null, 'user:types', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100054, 100013, 'menu.variable', '/flink/variable', 'flink/variable/View', null, 'code', '0', 1, 3, now(), now());
-insert into `t_menu` values (100055, 100054, 'add', NULL, NULL, 'variable:add', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100056, 100054, 'update', NULL, NULL, 'variable:update', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100057, 100054, 'delete', NULL, NULL, 'variable:delete', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100058, 100054, 'depend apps', '/flink/variable/depend_apps', 'flink/variable/DependApps', 'variable:depend_apps', '', '0', 0, NULL, now(), now());
-insert into `t_menu` values (100059, 100054, 'show original', NULL, NULL, 'variable:show_original', NULL, '1', 1, NULL, now(), now());
-insert into `t_menu` values (100060, 100001, 'view', null, null, 'user:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100061, 100038, 'view', null, null, 'token:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100062, 100002, 'view', null, null, 'role:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100063, 100044, 'view', null, null, 'team:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100064, 100048, 'view', null, null, 'member:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100066, 100014, 'view', null, null, 'project:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100067, 100015, 'view', null, null, 'app:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100068, 100054, 'view', NULL, NULL, 'variable:view', NULL, '1', 1, null, now(), now());
-insert into `t_menu` values (100069, 100034, 'view', null, null, 'setting:view', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100070, 100054, 'depend view', null, null, 'variable:depend_apps', null, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100033, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', 1, 5, now(), now());
+insert into `t_menu` values (100034, 100033, 'setting update', null, null, 'setting:update', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100035, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', 0, null, now(), now());
+insert into `t_menu` values (100036, 100015, 'delete', null, null, 'app:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100037, 100000, 'menu.tokenManagement', '/system/token', 'system/token/Token', null, 'lock', '0', 1, 1, now(), now());
+insert into `t_menu` values (100038, 100037, 'add', null, null, 'token:add', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100039, 100037, 'delete', null, null, 'token:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100040, 100033, 'add cluster', '/flink/setting/add_cluster', 'flink/setting/AddCluster', 'cluster:create', '', '0', 0, null, now(), now());
+insert into `t_menu` values (100041, 100033, 'edit cluster', '/flink/setting/edit_cluster', 'flink/setting/EditCluster', 'cluster:update', '', '0', 0, null, now(), now());
+insert into `t_menu` values (100042, 100015, 'copy', null, null, 'app:copy', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100043, 100000, 'menu.teamManagement', '/system/team', 'system/team/Team', null, 'team', '0', 1, 2, now(), now());
+insert into `t_menu` values (100044, 100043, 'add', null, null, 'team:add', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100045, 100043, 'update', null, null, 'team:update', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100046, 100043, 'delete', null, null, 'team:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100047, 100000, 'menu.memberManagement', '/system/member', 'system/member/Member', null, 'usergroup-add', '0', 1, 2, now(), now());
+insert into `t_menu` values (100048, 100047, 'add', null, null, 'member:add', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100049, 100047, 'update', null, null, 'member:update', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100050, 100047, 'delete', null, null, 'member:delete', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100051, 100047, 'role view', null, null, 'role:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100052, 100001, 'types', null, null, 'user:types', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100053, 100013, 'menu.variable', '/flink/variable', 'flink/variable/View', null, 'code', '0', 1, 3, now(), now());
+insert into `t_menu` values (100054, 100053, 'add', NULL, NULL, 'variable:add', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100055, 100053, 'update', NULL, NULL, 'variable:update', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100056, 100053, 'delete', NULL, NULL, 'variable:delete', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100057, 100053, 'depend apps', '/flink/variable/depend_apps', 'flink/variable/DependApps', 'variable:depend_apps', '', '0', 0, NULL, now(), now());
+insert into `t_menu` values (100058, 100053, 'show original', NULL, NULL, 'variable:show_original', NULL, '1', 1, NULL, now(), now());
+insert into `t_menu` values (100059, 100001, 'view', null, null, 'user:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100060, 100037, 'view', null, null, 'token:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100061, 100002, 'view', null, null, 'role:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100062, 100043, 'view', null, null, 'team:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100063, 100047, 'view', null, null, 'member:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100065, 100014, 'view', null, null, 'project:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100066, 100015, 'view', null, null, 'app:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100067, 100053, 'view', NULL, NULL, 'variable:view', NULL, '1', 1, null, now(), now());
+insert into `t_menu` values (100068, 100033, 'view', null, null, 'setting:view', null, '1', 1, null, now(), now());
+insert into `t_menu` values (100069, 100053, 'depend view', null, null, 'variable:depend_apps', null, '1', 1, NULL, now(), now());
+
+-- reset t_role_menu
+delete from t_role_menu;
+insert into `t_role_menu` values (100001, 100001, 100014);
+insert into `t_role_menu` values (100002, 100001, 100016);
+insert into `t_role_menu` values (100003, 100001, 100017);
+insert into `t_role_menu` values (100004, 100001, 100018);
+insert into `t_role_menu` values (100005, 100001, 100020);
+insert into `t_role_menu` values (100006, 100001, 100021);
+insert into `t_role_menu` values (100007, 100001, 100022);
+insert into `t_role_menu` values (100008, 100001, 100025);
+insert into `t_role_menu` values (100009, 100001, 100026);
+insert into `t_role_menu` values (100010, 100001, 100027);
+insert into `t_role_menu` values (100011, 100001, 100028);
+insert into `t_role_menu` values (100012, 100001, 100029);
+insert into `t_role_menu` values (100013, 100001, 100030);
+insert into `t_role_menu` values (100014, 100001, 100031);
+insert into `t_role_menu` values (100015, 100001, 100032);
+insert into `t_role_menu` values (100016, 100001, 100013);
+insert into `t_role_menu` values (100017, 100001, 100015);
+insert into `t_role_menu` values (100018, 100002, 100014);
+insert into `t_role_menu` values (100019, 100002, 100016);
+insert into `t_role_menu` values (100020, 100002, 100017);
+insert into `t_role_menu` values (100021, 100002, 100018);
+insert into `t_role_menu` values (100022, 100002, 100020);
+insert into `t_role_menu` values (100023, 100002, 100021);
+insert into `t_role_menu` values (100024, 100002, 100022);
+insert into `t_role_menu` values (100025, 100002, 100025);
+insert into `t_role_menu` values (100026, 100002, 100026);
+insert into `t_role_menu` values (100027, 100002, 100027);
+insert into `t_role_menu` values (100028, 100002, 100028);
+insert into `t_role_menu` values (100029, 100002, 100029);
+insert into `t_role_menu` values (100030, 100002, 100030);
+insert into `t_role_menu` values (100031, 100002, 100031);
+insert into `t_role_menu` values (100032, 100002, 100032);
+insert into `t_role_menu` values (100033, 100002, 100013);
+insert into `t_role_menu` values (100034, 100002, 100015);
+insert into `t_role_menu` values (100035, 100002, 100000);
+insert into `t_role_menu` values (100036, 100002, 100036);
+insert into `t_role_menu` values (100037, 100002, 100047);
+insert into `t_role_menu` values (100038, 100002, 100048);
+insert into `t_role_menu` values (100039, 100002, 100049);
+insert into `t_role_menu` values (100040, 100002, 100050);
+insert into `t_role_menu` values (100041, 100002, 100051);
+insert into `t_role_menu` values (100042, 100002, 100052);
+insert into `t_role_menu` values (100043, 100002, 100053);
+insert into `t_role_menu` values (100044, 100002, 100054);
+insert into `t_role_menu` values (100045, 100002, 100055);
+insert into `t_role_menu` values (100046, 100002, 100056);
+insert into `t_role_menu` values (100047, 100001, 100065);
+insert into `t_role_menu` values (100048, 100002, 100065);
+insert into `t_role_menu` values (100049, 100001, 100066);
+insert into `t_role_menu` values (100050, 100002, 100066);
+insert into `t_role_menu` values (100051, 100002, 100063);
+insert into `t_role_menu` values (100052, 100002, 100059);
+insert into `t_role_menu` values (100053, 100002, 100067);
-- Add team related sql
create table `t_team` (
@@ -222,45 +277,12 @@ add column `last_team_id` bigint default null comment 'last team id' after `user
update `t_user` set `user_type` = 1
where `user_id` in (select user_id from `t_user_role` where role_id = 100000);
-delete from t_role_menu where role_id = 100000;
delete from t_role where role_id = 100000;
delete from `t_user_role` where role_id = 100000;
-- Add team admin
insert into `t_role` values (100002, 'team admin', 'Team Admin has all permissions inside the team.', now(), now(), null);
-insert into `t_role_menu` values (100060, 100002, 100014);
-insert into `t_role_menu` values (100061, 100002, 100016);
-insert into `t_role_menu` values (100062, 100002, 100017);
-insert into `t_role_menu` values (100063, 100002, 100018);
--- insert into `t_role_menu` values (100064, 100002, 100019);
-insert into `t_role_menu` values (100065, 100002, 100020);
-insert into `t_role_menu` values (100066, 100002, 100021);
-insert into `t_role_menu` values (100067, 100002, 100022);
-insert into `t_role_menu` values (100068, 100002, 100025);
-insert into `t_role_menu` values (100069, 100002, 100026);
-insert into `t_role_menu` values (100070, 100002, 100027);
-insert into `t_role_menu` values (100071, 100002, 100028);
-insert into `t_role_menu` values (100072, 100002, 100029);
-insert into `t_role_menu` values (100073, 100002, 100030);
-insert into `t_role_menu` values (100074, 100002, 100031);
-insert into `t_role_menu` values (100075, 100002, 100032);
-insert into `t_role_menu` values (100076, 100002, 100033);
-insert into `t_role_menu` values (100077, 100002, 100013);
-insert into `t_role_menu` values (100079, 100002, 100015);
-insert into `t_role_menu` values (100080, 100002, 100000);
-insert into `t_role_menu` values (100081, 100002, 100037);
-insert into `t_role_menu` values (100082, 100002, 100048);
-insert into `t_role_menu` values (100083, 100002, 100049);
-insert into `t_role_menu` values (100084, 100002, 100050);
-insert into `t_role_menu` values (100085, 100002, 100051);
-insert into `t_role_menu` values (100086, 100002, 100052);
-insert into `t_role_menu` values (100087, 100002, 100053);
-insert into `t_role_menu` values (100088, 100002, 100054);
-insert into `t_role_menu` values (100089, 100002, 100055);
-insert into `t_role_menu` values (100090, 100002, 100056);
-insert into `t_role_menu` values (100091, 100002, 100057);
-
-- alter t_role_user to t_member and update the schema
alter table `t_user_role` rename `t_member`;
@@ -314,5 +336,8 @@ create table `t_variable` (
unique key `un_team_vcode_inx` (`team_id`,`variable_code`) using btree
) engine=innodb auto_increment=100000 default charset=utf8mb4 collate=utf8mb4_general_ci;
+
+drop table if exists `t_flame_graph`;
+
set foreign_key_checks = 1;
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
index 1fece41ce..7e84255f2 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ApplicationController.java
@@ -174,7 +174,6 @@ public class ApplicationController {
@ApiImplicitParam(name = "id", value = "app Id", required = true, paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "savePointed", value = "restored app from the savepoint or latest checkpoint", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
@ApiImplicitParam(name = "savePoint", value = "savepoint or checkpoint path", required = true, paramType = "query", dataTypeClass = String.class, defaultValue = ""),
- @ApiImplicitParam(name = "flameGraph", value = "whether the flame graph support", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false"),
@ApiImplicitParam(name = "allowNonRestored", value = "ignore savepoint then cannot be restored", required = true, paramType = "query", dataTypeClass = Boolean.class, defaultValue = "false")})
@PostMapping(value = "start", consumes = "application/x-www-form-urlencoded")
@RequiresPermissions("app:start")
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/MetricsController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/MetricsController.java
index 19873ffff..09a053705 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/MetricsController.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/MetricsController.java
@@ -19,42 +19,24 @@ package org.apache.streampark.console.core.controller;
import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.domain.RestResponse;
-import org.apache.streampark.console.core.entity.FlameGraph;
import org.apache.streampark.console.core.entity.Message;
import org.apache.streampark.console.core.enums.NoticeType;
-import org.apache.streampark.console.core.metrics.flink.JvmProfiler;
-import org.apache.streampark.console.core.service.FlameGraphService;
import org.apache.streampark.console.core.service.MessageService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.core.io.Resource;
-import org.springframework.http.ContentDisposition;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import java.io.IOException;
-import java.util.Date;
-
@Slf4j
@Validated
@RestController
@RequestMapping("metrics")
public class MetricsController {
- private static final String STACKTRACE_PROFILER_NAME = "Stacktrace";
-
- @Autowired
- private FlameGraphService flameGraphService;
-
@Autowired
private MessageService messageService;
@@ -70,40 +52,4 @@ public class MetricsController {
return RestResponse.success(messageService.removeById(id));
}
- @PostMapping("report")
- public RestResponse report(@RequestBody JvmProfiler jvmProfiler) {
- try {
- if (jvmProfiler != null && jvmProfiler.getProfiler().equals(STACKTRACE_PROFILER_NAME)) {
- log.info("id:{},token:{},type:{}", jvmProfiler.getId(), jvmProfiler.getToken(), jvmProfiler.getType());
- FlameGraph flameGraph = new FlameGraph();
- flameGraph.setAppId(jvmProfiler.getId());
- flameGraph.setProfiler(jvmProfiler.getProfiler());
- flameGraph.setTimeline(new Date());
- flameGraph.setContent(jvmProfiler.getMetric());
- flameGraphService.save(flameGraph);
- }
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- return RestResponse.success();
- }
-
- @PostMapping("flamegraph")
- public ResponseEntity<Resource> flameGraph(FlameGraph flameGraph) throws IOException {
- String file = flameGraphService.generateFlameGraph(flameGraph);
- if (file != null) {
- String contentDisposition = ContentDisposition
- .builder("attachment")
- .filename(file)
- .build()
- .toString();
-
- return ResponseEntity.ok()
- .header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition)
- .contentType(MediaType.parseMediaType("image/svg+xml"))
- .body(new FileSystemResource(file));
- } else {
- return null;
- }
- }
}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
index 3c2650350..6598ac26a 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
@@ -168,7 +168,6 @@ public class Application implements Serializable {
private Integer executionMode;
private String dynamicProperties;
private Integer appType;
- private Boolean flameGraph;
/**
* determine if tracking status
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlameGraph.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlameGraph.java
deleted file mode 100644
index cc9f467c7..000000000
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlameGraph.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.core.entity;
-
-import org.apache.streampark.common.util.DeflaterUtils;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-@Data
-@TableName("t_flame_graph")
-@Slf4j
-public class FlameGraph {
-
- @TableId(type = IdType.AUTO)
- private Long id;
-
- private Long appId;
-
- private String profiler;
-
- private Date timeline;
-
- private String content;
-
- private transient Date end = new Date();
-
- private transient Integer duration = 60 * 2;
-
- private transient Integer width = 1280;
-
- private static final Integer QUERY_DURATION = 60 * 4;
-
- @JsonIgnore
- public Date getStart() {
- if (this.duration > QUERY_DURATION) {
- throw new IllegalArgumentException(
- "[StreamPark] flameGraph query duration cannot be greater than 4 hours");
- }
- Calendar cal = Calendar.getInstance();
- cal.setTimeZone(TimeZone.getDefault());
- cal.setTime(this.getEnd());
- cal.add(Calendar.MINUTE, -duration);
- return cal.getTime();
- }
-
- @JsonIgnore
- public String getUnzipContent() {
- if (this.content != null) {
- return DeflaterUtils.unzipString(this.content);
- }
- return null;
- }
-}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/mapper/FlameGraphMapper.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/mapper/FlameGraphMapper.java
deleted file mode 100644
index 52ebcd442..000000000
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/mapper/FlameGraphMapper.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.core.mapper;
-
-import org.apache.streampark.console.core.entity.FlameGraph;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-public interface FlameGraphMapper extends BaseMapper<FlameGraph> {
-
-}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlameGraphService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlameGraphService.java
deleted file mode 100644
index 1713a7fd1..000000000
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlameGraphService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.core.service;
-
-import org.apache.streampark.console.core.entity.FlameGraph;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.io.IOException;
-import java.util.Date;
-
-public interface FlameGraphService extends IService<FlameGraph> {
-
- String generateFlameGraph(FlameGraph flameGraph) throws IOException;
-
- void clean(Date end);
-}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
index b87f5a9b0..46fb5880a 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
@@ -23,7 +23,6 @@ import static org.apache.streampark.console.core.task.K8sFlinkTrackMonitorWrappe
import org.apache.streampark.common.conf.ConfigConst;
import org.apache.streampark.common.conf.Workspace;
-import org.apache.streampark.common.enums.ApplicationType;
import org.apache.streampark.common.enums.DevelopmentMode;
import org.apache.streampark.common.enums.ExecutionMode;
import org.apache.streampark.common.enums.ResolveOrder;
@@ -1465,7 +1464,6 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
appConf,
application.getApplicationType(),
getSavePointed(appParam),
- appParam.getFlameGraph() ? getFlameGraph(application) : null,
getProperties(application),
applicationArgs,
buildResult,
@@ -1502,7 +1500,6 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
application.setJobManagerUrl(submitResponse.jobManagerUrl());
applicationLog.setJobManagerUrl(submitResponse.jobManagerUrl());
}
- application.setFlameGraph(appParam.getFlameGraph());
applicationLog.setYarnAppId(submitResponse.clusterId());
application.setStartTime(new Date());
application.setEndTime(null);
@@ -1681,15 +1678,4 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
return null;
}
- private Map<String, Serializable> getFlameGraph(Application application) {
- Map<String, Serializable> flameGraph = new HashMap<>(8);
- flameGraph.put("reporter", "org.apache.streampark.plugin.profiling.reporter.HttpReporter");
- flameGraph.put("type", ApplicationType.STREAMPARK_FLINK.getType());
- flameGraph.put("id", application.getId());
- flameGraph.put("url", settingService.getStreamParkAddress().concat("/metrics/report"));
- flameGraph.put("token", Utils.uuid());
- flameGraph.put("sampleInterval", 1000 * 60 * 2);
- flameGraph.put("metricInterval", 1000 * 60 * 2);
- return flameGraph;
- }
}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlameGraphServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlameGraphServiceImpl.java
deleted file mode 100644
index 516588661..000000000
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlameGraphServiceImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.core.service.impl;
-
-import org.apache.streampark.common.util.CommandUtils;
-import org.apache.streampark.console.base.util.CommonUtils;
-import org.apache.streampark.console.base.util.WebUtils;
-import org.apache.streampark.console.core.entity.Application;
-import org.apache.streampark.console.core.entity.FlameGraph;
-import org.apache.streampark.console.core.mapper.FlameGraphMapper;
-import org.apache.streampark.console.core.service.ApplicationService;
-import org.apache.streampark.console.core.service.FlameGraphService;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.IOUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-@Slf4j
-@Service
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
-public class FlameGraphServiceImpl extends ServiceImpl<FlameGraphMapper, FlameGraph>
- implements FlameGraphService {
-
- @Autowired
- private ApplicationService applicationService;
-
- @Override
- public String generateFlameGraph(FlameGraph flameGraph) throws IOException {
- LambdaQueryWrapper<FlameGraph> queryWrapper = new LambdaQueryWrapper<FlameGraph>()
- .eq(FlameGraph::getAppId, flameGraph.getAppId())
- .between(FlameGraph::getTimeline, flameGraph.getStart(), flameGraph.getEnd())
- .orderByAsc(FlameGraph::getTimeline);
- List<FlameGraph> flameGraphList = this.list(queryWrapper);
-
- if (CommonUtils.notEmpty(flameGraphList)) {
- StringBuffer jsonBuffer = new StringBuffer();
- flameGraphList.forEach(x -> jsonBuffer.append(x.getUnzipContent()).append("\r\n"));
-
- Application application = applicationService.getById(flameGraph.getAppId());
- String jsonName = String.format(
- "%d_%d_%d.json",
- flameGraph.getAppId(),
- flameGraph.getStart().getTime(),
- flameGraph.getEnd().getTime()
- );
- String jsonPath = new File(WebUtils.getAppTempDir(), jsonName).getAbsolutePath();
- String foldedPath = jsonPath.replace(".json", ".folded");
- String svgPath = jsonPath.replace(".json", ".svg");
- File flameGraphPath = WebUtils.getAppDir("bin/flame-graph");
-
- // write json
- FileOutputStream fileOutputStream = new FileOutputStream(jsonPath);
- IOUtils.write(jsonBuffer.toString().getBytes(), fileOutputStream);
-
- String title = application.getJobName().concat(" ___ FlameGraph");
- // generate...
- List<String> commands = Arrays.asList(
- String.format("python ./stackcollapse.py -i %s > %s ", jsonPath, foldedPath),
- String.format(
- "./flamegraph.pl --title=\"%s\" --width=%d --colors=java %s > %s ",
- title,
- flameGraph.getWidth(),
- foldedPath,
- svgPath
- )
- );
- CommandUtils.execute(flameGraphPath.getAbsolutePath(), commands, (line) -> log.info("flameGraph: {} ", line));
- return svgPath;
- }
- return null;
- }
-
- @Override
- public void clean(Date end) {
- LambdaQueryWrapper<FlameGraph> queryWrapper = new LambdaQueryWrapper<FlameGraph>()
- .lt(FlameGraph::getTimeline, end);
- this.remove(queryWrapper);
- }
-}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/MetricsTask.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/MetricsTask.java
deleted file mode 100644
index 6d214b1c9..000000000
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/MetricsTask.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.core.task;
-
-import org.apache.streampark.console.base.util.WebUtils;
-import org.apache.streampark.console.core.service.FlameGraphService;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Objects;
-import java.util.TimeZone;
-
-@Slf4j
-@Component
-public class MetricsTask {
-
- @Autowired
- private FlameGraphService flameGraphService;
-
- private static final String FLAME_GRAPH_FILE_REGEXP = "\\d+_\\d+\\.json|\\d+_\\d+\\.folded|\\d+_\\d+\\.svg";
-
- /**
- * hour.
- */
- @Scheduled(cron = "0 0 * * * ?")
- public void cleanFlameGraph() {
- // 1) clean file
- String tempPath = WebUtils.getAppTempDir().getAbsolutePath();
- File temp = new File(tempPath);
- Arrays.stream(Objects.requireNonNull(temp.listFiles()))
- .filter(x -> x.getName().matches(FLAME_GRAPH_FILE_REGEXP))
- .forEach(File::delete);
-
- // 2 clean date
- Date start = new Date();
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeZone(TimeZone.getDefault());
- calendar.setTime(start);
- calendar.add(Calendar.HOUR_OF_DAY, -24);
- Date end = calendar.getTime();
- flameGraphService.clean(end);
- }
-}
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
index 840edc6eb..2aca32df2 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
@@ -123,7 +123,6 @@ public class AccessTokenController {
if ("/flink/app/start".equalsIgnoreCase(path)) {
resultCURL = curlBuilder
.addFormData("allowNonRestored", "false")
- .addFormData("flameGraph", "false")
.addFormData("savePoint", "")
.addFormData("savePointed", "false")
.addFormData("id", appId)
diff --git a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
index 37b90c57a..be01ac160 100644
--- a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
+++ b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
@@ -25,7 +25,7 @@ insert into `t_team` values (100001, 'test', 'The test team', now(), now());
-- ----------------------------
-- Records of t_flink_app
-- ----------------------------
-insert into `t_flink_app` values (100000, 100000, 2, 4, null, null, 'Flink SQL Demo', null, null, null, null, null, null , null, 100000, null, 1, null, null, null, null, null, null, null, '0', 0, null, null, null, null, null, null, 'Flink SQL Demo', 0, null, 0, null, null, null, null, null, null, 0, 0, now(), now(), null, 1, 1, null, null, null, null, null, null, 0, null, null, null, 'streampark,test');
+insert into `t_flink_app` values (100000, 100000, 2, 4, null, null, 'Flink SQL Demo', null, null, null, null, null , null, 100000, null, 1, null, null, null, null, null, null, null, '0', 0, null, null, null, null, null, null, 'Flink SQL Demo', 0, null, 0, null, null, null, null, null, null, 0, 0, now(), now(), null, 1, 1, null, null, null, null, null, null, 0, null, null, null, 'streampark,test');
-- ----------------------------
-- Records of t_flink_effective
@@ -76,7 +76,6 @@ insert into `t_menu` values (100029, 100015, 'savepoint delete', null, null, 'sa
insert into `t_menu` values (100030, 100015, 'backup rollback', null, null, 'backup:rollback', null, '1', 1, null, now(), now());
insert into `t_menu` values (100031, 100015, 'backup delete', null, null, 'backup:delete', null, '1', 1, null, now(), now());
insert into `t_menu` values (100032, 100015, 'conf delete', null, null, 'conf:delete', null, '1', 1, null, now(), now());
-insert into `t_menu` values (100033, 100015, 'flame Graph', null, null, 'app:flameGraph', null, '1', 1, null, now(), now());
insert into `t_menu` values (100034, 100013, 'menu.setting', '/flink/setting', 'flink/setting/View', null, 'setting', '0', 1, 5, now(), now());
insert into `t_menu` values (100035, 100034, 'setting update', null, null, 'setting:update', null, '1', 1, null, now(), now());
insert into `t_menu` values (100036, 100014, 'edit', '/flink/project/edit', 'flink/project/Edit', 'project:update', null, '0', 0, null, now(), now());
diff --git a/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql b/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
index 6e4b7f4a3..de4f16faa 100644
--- a/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
+++ b/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
@@ -31,18 +31,6 @@ create table if not exists `t_app_backup` (
primary key(`id`)
);
--- ----------------------------
--- Table structure for t_flame_graph
--- ----------------------------
-create table if not exists `t_flame_graph` (
- `id` bigint generated by default as identity not null,
- `app_id` bigint default null,
- `profiler` varchar(255) default null,
- `timeline` datetime default null,
- `content` text,
- primary key(`id`)
-);
-
-- ----------------------------
-- Table structure for t_flink_app
-- ----------------------------
@@ -82,7 +70,6 @@ create table if not exists `t_flink_app` (
`description` varchar(255) default null,
`resolve_order` tinyint default null,
`k8s_rest_exposed_type` tinyint default null,
- `flame_graph` tinyint default 0,
`jm_memory` int default null,
`tm_memory` int default null,
`total_task` int default null,
diff --git a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
index 64be9cf55..7f23de927 100644
--- a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
+++ b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ApplicationMapper.xml
@@ -55,7 +55,6 @@
<result column="restart_count" jdbcType="INTEGER" property="restartCount"/>
<result column="launch" jdbcType="INTEGER" property="launch"/>
<result column="build" jdbcType="BOOLEAN" property="build"/>
- <result column="flame_graph" jdbcType="BOOLEAN" property="flameGraph"/>
<result column="resolve_order" jdbcType="INTEGER" property="resolveOrder"/>
<result column="total_tm" jdbcType="INTEGER" property="totalTM"/>
<result column="total_slot" jdbcType="INTEGER" property="totalSlot"/>
diff --git a/streampark-console/streampark-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml b/streampark-console/streampark-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml
deleted file mode 100644
index 1f04b421e..000000000
--- a/streampark-console/streampark-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.apache.streampark.console.core.mapper.FlameGraphMapper">
- <resultMap id="BaseResultMap" type="org.apache.streampark.console.core.entity.FlameGraph">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="app_id" jdbcType="BIGINT" property="appId"/>
- <result column="timeline" jdbcType="DATE" property="timeline"/>
- <result column="profiler" jdbcType="VARCHAR" property="profiler"/>
- <result column="content" jdbcType="LONGVARCHAR" property="content"/>
- </resultMap>
-</mapper>
diff --git a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/ApplicationServiceTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/ApplicationServiceTest.java
index c6fc0c06f..3793c88b0 100644
--- a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/ApplicationServiceTest.java
+++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/ApplicationServiceTest.java
@@ -64,7 +64,6 @@ class ApplicationServiceTest {
app.setResolveOrder(0);
app.setExecutionMode(4);
app.setAppType(2);
- app.setFlameGraph(false);
app.setTracking(0);
app.setJar("SocketWindowWordCount.jar");
app.setJarCheckSum(1553115525L);
@@ -86,7 +85,6 @@ class ApplicationServiceTest {
void start() throws Exception {
Application application = new Application();
application.setId(1304056220683497473L);
- application.setFlameGraph(false);
application.setRestart(false);
application.setSavePointed(false);
application.setAllowNonRestored(false);
diff --git a/streampark-console/streampark-console-webapp/src/api/flink/app/app.type.ts b/streampark-console/streampark-console-webapp/src/api/flink/app/app.type.ts
index fb5f1777b..ea5284f78 100644
--- a/streampark-console/streampark-console-webapp/src/api/flink/app/app.type.ts
+++ b/streampark-console/streampark-console-webapp/src/api/flink/app/app.type.ts
@@ -71,7 +71,6 @@ export interface AppListRecord {
executionMode: number;
dynamicProperties?: string;
appType: number;
- flameGraph: boolean;
tracking: number;
jar?: string;
jarCheckSum?: string;
diff --git a/streampark-console/streampark-console-webapp/src/api/flink/app/metrics.ts b/streampark-console/streampark-console-webapp/src/api/flink/app/metrics.ts
deleted file mode 100644
index e8f1a1650..000000000
--- a/streampark-console/streampark-console-webapp/src/api/flink/app/metrics.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { AxiosResponse } from 'axios';
-import { defHttp } from '/@/utils/http/axios';
-
-interface FlameGraphParam {
- //application id
- appId: string;
- //The width of the screen
- width: Number;
-}
-enum Metrics_API {
- FLAME_GRAPH = '/metrics/flamegraph',
- NOTICE = '/metrics/notice',
- DEL_NOTICE = '/metrics/delnotice',
-}
-/**
- * export
- * @param {FlameGraphParam} data
- * @returns {Promise<AxiosResponse<Blob>>}
- */
-export function fetchFlamegraph(data: FlameGraphParam): Promise<AxiosResponse<Blob>> {
- return defHttp.post(
- {
- url: Metrics_API.FLAME_GRAPH,
- data,
- responseType: 'blob',
- },
- { isReturnNativeResponse: true },
- );
-}
diff --git a/streampark-console/streampark-console-webapp/src/api/flink/setting/types/flinkCluster.type.ts b/streampark-console/streampark-console-webapp/src/api/flink/setting/types/flinkCluster.type.ts
index 5cc7306bd..5d9412f24 100644
--- a/streampark-console/streampark-console-webapp/src/api/flink/setting/types/flinkCluster.type.ts
+++ b/streampark-console/streampark-console-webapp/src/api/flink/setting/types/flinkCluster.type.ts
@@ -31,7 +31,6 @@ export interface FlinkCluster {
k8sHadoopIntegration: boolean;
dynamicProperties: string;
k8sRestExposedType: number;
- flameGraph: boolean;
k8sConf?: any;
resolveOrder: number;
exception?: any;
diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
index 10340842d..dee81a596 100644
--- a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
+++ b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
@@ -149,7 +149,6 @@ export default {
force: 'Forced Stop Application',
copy: 'Copy Application',
remapping: 'Remapping Application',
- flameGraph: 'View FlameGraph',
deleteTip: 'Are you sure delete this job ?',
},
dashboard: {
diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
index 71ae22bed..097ceda2a 100644
--- a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
+++ b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
@@ -147,7 +147,6 @@ export default {
force: '强制停止作业',
copy: '复制作业',
remapping: '重新映射作业',
- flameGraph: '查看火焰图',
deleteTip: '你确定要删除这个作业?',
},
dashboard: {
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue
index 038267aeb..998d80d01 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue
@@ -53,18 +53,6 @@
name: 'startApplicationModal',
labelWidth: 120,
schemas: [
- {
- field: 'flameGraph',
- label: 'flame Graph',
- component: 'Switch',
- componentProps: {
- checkedChildren: 'ON',
- unCheckedChildren: 'OFF',
- },
- defaultValue: false,
- afterItem: () => h('span', { class: 'conf-switch' }, 'flame Graph support'),
- ifShow: () => isK8sExecMode(receiveData.executionMode),
- },
{
field: 'startSavePointed',
label: 'from savepoint',
@@ -130,7 +118,6 @@
id: receiveData.application.id,
savePointed,
savePoint: savePointPath,
- flameGraph: formValue.flameGraph || false,
allowNonRestored: formValue.allowNonRestoredState || false,
});
if (data.data) {
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
index 49a2c10d5..9a1f406a3 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
@@ -21,7 +21,6 @@ import { useFlinkAppStore } from '/@/store/modules/flinkApplication';
import { useFlinkApplication } from './useApp';
import { fetchAppRecord, fetchAppRemove } from '/@/api/flink/app/app';
import { AppListRecord } from '/@/api/flink/app/app.type';
-import { fetchFlamegraph } from '/@/api/flink/app/metrics';
import { ActionItem, FormProps } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import {
@@ -177,13 +176,6 @@ export const useAppTableAction = (
icon: 'ant-design:deployment-unit-outlined',
onClick: handleMapping.bind(null, record),
},
- {
- label: t('flink.app.operation.flameGraph'),
- ifShow: record.flameGraph,
- auth: 'app:flameGraph',
- icon: 'ant-design:fire-outlined',
- onClick: handleFlameGraph.bind(null, record),
- },
{
popConfirm: {
title: t('flink.app.operation.deleteTip'),
@@ -208,26 +200,6 @@ export const useAppTableAction = (
];
}
- async function handleFlameGraph(app: AppListRecord) {
- const hide = createMessage.loading('flameGraph generating...', 0);
- try {
- const { data } = await fetchFlamegraph({
- appId: app.id,
- width: document.documentElement.offsetWidth || document.body.offsetWidth,
- });
- if (data) {
- const blob = new Blob([data], { type: 'image/svg+xml' });
- const imageUrl = (window.URL || window.webkitURL).createObjectURL(blob);
- window.open(imageUrl);
- }
- } catch (error) {
- console.error(error);
- createMessage.error('flameGraph generate failed');
- } finally {
- hide();
- }
- }
-
/* Click to delete */
async function handleDelete(app: AppListRecord) {
const hide = createMessage.loading('deleting', 0);
diff --git a/streampark-flink/streampark-flink-submit/streampark-flink-submit-api/src/main/scala/org/apache/streampark/flink/submit/bean/SubmitRequest.scala b/streampark-flink/streampark-flink-submit/streampark-flink-submit-api/src/main/scala/org/apache/streampark/flink/submit/bean/SubmitRequest.scala
index a39840247..9e3539214 100644
--- a/streampark-flink/streampark-flink-submit/streampark-flink-submit-api/src/main/scala/org/apache/streampark/flink/submit/bean/SubmitRequest.scala
+++ b/streampark-flink/streampark-flink-submit/streampark-flink-submit-api/src/main/scala/org/apache/streampark/flink/submit/bean/SubmitRequest.scala
@@ -52,7 +52,6 @@ case class SubmitRequest(flinkVersion: FlinkVersion,
appConf: String,
applicationType: ApplicationType,
savePoint: String,
- flameGraph: JavaMap[String, java.io.Serializable],
properties: JavaMap[String, Any],
args: String,
@Nullable buildResult: BuildResult,
diff --git a/streampark-flink/streampark-flink-submit/streampark-flink-submit-core/src/main/scala/org/apache/streampark/flink/submit/trait/FlinkSubmitTrait.scala b/streampark-flink/streampark-flink-submit/streampark-flink-submit-core/src/main/scala/org/apache/streampark/flink/submit/trait/FlinkSubmitTrait.scala
index 86f485919..e4e99eda0 100644
--- a/streampark-flink/streampark-flink-submit/streampark-flink-submit-core/src/main/scala/org/apache/streampark/flink/submit/trait/FlinkSubmitTrait.scala
+++ b/streampark-flink/streampark-flink-submit/streampark-flink-submit-core/src/main/scala/org/apache/streampark/flink/submit/trait/FlinkSubmitTrait.scala
@@ -69,7 +69,6 @@ trait FlinkSubmitTrait extends Logger {
| flinkExposedType : ${submitRequest.k8sSubmitParam.flinkRestExposedType}
| clusterId : ${submitRequest.k8sSubmitParam.clusterId}
| applicationType : ${submitRequest.applicationType.getName}
- | flameGraph : ${submitRequest.flameGraph != null}
| savePoint : ${submitRequest.savePoint}
| properties : ${submitRequest.properties.mkString(" ")}
| args : ${submitRequest.args}
@@ -187,16 +186,6 @@ trait FlinkSubmitTrait extends Logger {
//----------Public Method end ------------------
- private[submit] lazy val jvmProfilerJar: String = {
- val pluginsPath = SystemPropertyUtils.get(ConfigConst.KEY_APP_HOME).concat("/plugins")
- val pluginsDir = new File(pluginsPath)
- pluginsDir.list().filter(_.matches("streampark-jvm-profiler-.*\\.jar")) match {
- case Array() => throw new IllegalArgumentException(s"[StreamPark] can no found streampark-jvm-profiler jar in $pluginsPath")
- case array if array.length == 1 => array.head
- case more => throw new IllegalArgumentException(s"[StreamPark] found multiple streampark-jvm-profiler jar in $pluginsPath,[${more.mkString(",")}]")
- }
- }
-
private[submit] def validateAndGetActiveCommandLine(customCommandLines: JavaList[CustomCommandLine], commandLine: CommandLine): CustomCommandLine = {
val line = checkNotNull(commandLine)
logInfo(s"Custom commandline: $customCommandLines")
@@ -276,14 +265,6 @@ trait FlinkSubmitTrait extends Logger {
}
})
- //-jvm profile only on yarn support
- if (Utils.notEmpty(submitRequest.flameGraph) && ExecutionMode.isYarnMode(submitRequest.executionMode)) {
- val buffer = new StringBuffer()
- submitRequest.flameGraph.foreach(p => buffer.append(s"${p._1}=${p._2},"))
- val param = buffer.toString.dropRight(1)
- array += s"-D${CoreOptions.FLINK_TM_JVM_OPTIONS.key()}=-javaagent:$$PWD/plugins/$jvmProfilerJar=$param"
- }
-
// app properties
if (MapUtils.isNotEmpty(submitRequest.properties)) {
submitRequest.properties.foreach(x => {
diff --git a/streampark-plugin/pom.xml b/streampark-plugin/pom.xml
deleted file mode 100644
index e826f3f23..000000000
--- a/streampark-plugin/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.streampark</groupId>
- <artifactId>streampark</artifactId>
- <version>2.0.0</version>
- </parent>
-
- <artifactId>streampark-plugin</artifactId>
- <name>StreamPark : Plugin Parent</name>
- <packaging>pom</packaging>
-
- <properties>
- <scalatest.skiptests>true</scalatest.skiptests>
- </properties>
-
- <modules>
- <module>streampark-jvm-profiler</module>
- </modules>
-
- <build>
- <plugins>
- <!-- disable surefire -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.7</version>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- <!-- enable scalatest -->
- <plugin>
- <groupId>org.scalatest</groupId>
- <artifactId>scalatest-maven-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
- <junitxml>.</junitxml>
- <filereports>WDF TestSuite.txt</filereports>
- <skipTests>${scalatest.skiptests}</skipTests>
- </configuration>
- <executions>
- <execution>
- <id>test</id>
- <goals>
- <goal>test</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/streampark-plugin/streampark-jvm-profiler/.travis.yml b/streampark-plugin/streampark-jvm-profiler/.travis.yml
deleted file mode 100644
index de77bbaed..000000000
--- a/streampark-plugin/streampark-jvm-profiler/.travis.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-language: java
-dist: trusty
-jdk:
- - oraclejdk8
- - openjdk8
diff --git a/streampark-plugin/streampark-jvm-profiler/metricDetails.md b/streampark-plugin/streampark-jvm-profiler/metricDetails.md
deleted file mode 100644
index 2e9d238ff..000000000
--- a/streampark-plugin/streampark-jvm-profiler/metricDetails.md
+++ /dev/null
@@ -1,169 +0,0 @@
-# Details of Metrics Collected by the JVM-Profiler
-
-1. CPU and Memory
-2. IO
-3. Process Info
-4. Stack Trace
-
-## 1. CPU and Memory
-
-|**Name** |**Description** | **Sample Value** |**Note** |
-|-----------------------------------------------------|-----------------------------------------------------------------|---------------------------------------|---------------------------------------------------------------------------------------|
-|time |Time series value for grafana database. | 1582504748538000000 | |
-|appId |Application id of the job that is running. | application_1576797426048_311346 |If using yarn, this is the yarn application id. |
-|bufferPools-direct-count |Total number of direct byte buffers used at the recorded time. | 55 |Depending on your application, this can be a smaller number |
-|bufferPools-direct-memoryUsed |Total memory of the direct byte buffers used in bytes. | 18950 |An estimate. This value should be very similar to the total capacity for a healthy JVM.|
-|bufferPools-direct-name |Name of the buffer pool. | direct |Direct buffer pools are always named direct. |
-|bufferPools-direct-totalCapacity |Available capacity in bytes in the direct buffer pool. | 18949 |Capacity should be similar to memoryUsed for a healthy JVM. |
-|bufferPools-mapped-count |Total number of mapped byte buffers used at the recorded time. | 0 |In general, spark applications will not require mapped buffer pools. |
-|bufferPools-mapped-memoryUsed |Total memory of the mapped byte buffers used in bytes. | 0 |An estimate. This value should be very similar to the total capacity for a healthy JVM.|
-|bufferPools-mapped-name |Name of the buffer pool. | mapped |Mapped buffer pools are always named mapped. |
-|bufferPools-mapped-totalCapacity |Available capacity in bytes in the mapped buffer pool. | 0 |Capacity should be similar to memoryUsed for a healthy JVM. |
-|epochMillis |System time in milliseconds when this value was recorded. | 1582504781508 | |
-|gc-PSMarkSweep-collectionCount |Total number of collections that have occurred for PS MarkSweep. | 7 |-1 if collection count is undefined for this collector. |
-|gc-PSMarkSweep-collectionTime |approximate accumulated collection elapsed time in milliseconds. | 914 |-1 if collection count is undefined for this collector. |
-|gc-PSMarkSweep-name |Name of the collector. | PS MarkSweep |Constant value. |
-|gc-PSScavenge-collectionCount |Total number of collections that have occurred for PS Scavenge. | 25 |-1 if collection count is undefined for this collector. |
-|gc-PSScavenge-collectionTime |approximate accumulated collection elapsed time in milliseconds. | 1206 |-1 if collection count is undefined for this collector. |
-|gc-PSScavenge-name |Name of the collector. | PS Scavenge |Constant value. |
-|heapMemoryCommitted |Amount of memory in bytes guaranteed for the JVM to use. | 375914496 | |
-|heapMemoryMax |Max amount of memory in bytes that can be used | 11453595648 |Also refer to spark.memory.fraction for the fraction managed by spark |
-|heapMemoryTotalUsed |Total heap memory used in bytes | 86386032 |Total memory used should be less than committed and max heap memory. |
-|host |Hostname of the executor | bigdata-datanode1.com | |
-|memoryPools-CodeCache-name |Name of the code cache. | Code Cache |Constant value. |
-|memoryPools-CodeCache-peakUsageCommitted |Peak committed memory of this pool since the JVM was started | 2555904 | |
-|memoryPools-CodeCache-peakUsageMax |Peak value of usageMax of this pool since the JVM was started | 251658240 | |
-|memoryPools-CodeCache-peakUsageUsed |Peak value of memory of this pool used since the JVM was started.| 582656 | |
-|memoryPools-CodeCache-type |The type of this memory pool. | Non-heap memory |Code cache is a non-heap memory. So this value will always be constant. |
-|memoryPools-CodeCache-usageCommitted |Total memory in bytes committed for this pool. | 2555904 | |
-|memoryPools-CodeCache-usageMax |The maximum amount of memory that can be used by this pool. | 251658240 |-1 if undefined. Not guaranteed to be available if greater than the committed memory. |
-|memoryPools-CodeCache-usageUsed |Amount of memory used by this pool. | 582656 |Having some code cache memory free ensures it is usable for JIT compilation. |
-|memoryPools-CompressedClassSpace-name |Name of the compressed class space. | Compressed Class Space |Is constant. This space is allocated in native memory for class metadata. |
-|memoryPools-CompressedClassSpace-peakUsageCommitted |Peak committed memory of this pool since JVM was started. | 1572864 | |
-|memoryPools-CompressedClassSpace-peakUsageMax |Peak value of usageMax of this pool since the JVM was started. | 1073741824 | |
-|memoryPools-CompressedClassSpace-peakUsageUsed |Peak value of usage of this pool since the JVM was started. | 1389800 | |
-|memoryPools-CompressedClassSpace-type |Type of memory of this memory pool. | Non-heap memory |Compressed class space is native memory but is managed by the JVM |
-|memoryPools-CompressedClassSpace-usageCommitted |Total memory in bytes committed for this pool. | 1572864 | |
-|memoryPools-CompressedClassSpace-usageMax |The maximum amount of memory that can be used by this pool | 1073741824 |-1 if undefined. Not guaranteed to be available if greater than the committed memory. |
-|memoryPools-CompressedClassSpace-usageUsed |Amount of memory used by this pool. | 1389800 | |
-|memoryPools-Metaspace-name |Name of the Metaspace. | Metaspace |Is constant. Metaspace is always called metaspace. |
-|memoryPools-Metaspace-peakUsageCommitted |Peak committed memory of this pool since JVM was started. | 12320768 | |
-|memoryPools-Metaspace-peakUsageMax |Peak value of usageMax of this pool since the JVM was started. | -1 |-1 if undefined. |
-|memoryPools-Metaspace-peakUsageUsed |Peak value of usage of this pool since the JVM was started. | 11768752 | |
-|memoryPools-Metaspace-type |Type of memory of this memory pool. | Non-heap memory |Metaspace is native memory (since JDK 8) but is managed by the JVM |
-|memoryPools-Metaspace-usageCommitted |Total memory in bytes committed for this pool. | 12320768 | |
-|memoryPools-Metaspace-usageMax |The maximum amount of memory that can be used by this pool | -1 |-1 if undefined. Not guaranteed to be available if greater than the committed memory. |
-|memoryPools-Metaspace-usageUsed |Amount of memory used by this pool. | 11768752 |The amount of space used by loaded classes. |
-|memoryPools-PSEdenSpace-name |Name of the young generation heap space. | PS Eden Space |Is constant. PS Eden space is always called PS Eden Space. |
-|memoryPools-PSEdenSpace-peakUsageCommitted |Peak committed memory of this pool since JVM was started. | 98041856 | |
-|memoryPools-PSEdenSpace-peakUsageMax |Peak value of usageMax of this pool since the JVM was started. | 4262461440 |-1 if undefined. |
-|memoryPools-PSEdenSpace-peakUsageUsed |Peak value of usage of this pool since the JVM was started. | 92270136 | |
-|memoryPools-PSEdenSpace-type |Type of memory of this memory pool. | Heap memory |PS Eden space is a portion of the heap memory that is managed by the JVM |
-|memoryPools-PSEdenSpace-usageCommitted |Total memory in bytes committed for this pool. | 98041856 | |
-|memoryPools-PSEdenSpace-usageMax |The maximum amount of memory that can be used by this pool | 8589934592 |-1 if undefined. Not guaranteed to be available if greater than the committed memory. |
-|memoryPools-PSEdenSpace-usageUsed |Amount of memory used by this pool (and by newly loaded classes).| 92270136 |A continuously increasing value indicates an unhealthy garbage collection. |
-|memoryPools-PSOldGen-name |Name of the old generation heap space. | PS Old Gen |Is constant. PS Old Gen space is always called PS Old Gen. |
-|memoryPools-PSOldGen-peakUsageCommitted |Peak committed memory of this pool since JVM was started. | 261619712 | |
-|memoryPools-PSOldGen-peakUsageMax |Peak value of usageMax of this pool since the JVM was started. | 8589934592 |-1 if undefined. |
-|memoryPools-PSOldGen-peakUsageUsed |Peak value of usage of this pool since the JVM was started. | 0 | |
-|memoryPools-PSOldGen-type |Type of memory of this memory pool. | Heap memory |PS Old Gen space is a portion of the heap memory that is managed by the JVM |
-|memoryPools-PSOldGen-usageCommitted |Total memory in bytes committed for this pool. | 261619712 | |
-|memoryPools-PSOldGen-usageMax |The maximum amount of memory that can be used by this pool | 8589934592 |-1 if undefined. Not guaranteed to be available if greater than the committed memory. |
-|memoryPools-PSOldGen-usageUsed |Amount of memory used by this pool (by objects beyond threshold).| 0 |A continuously increasing value indicates an unhealthy garbage collection. |
-|memoryPools-PSSurvivorSpace-name |Name of the survivor heap space. | PS Survivor Space |Is constant. PS Survivor Space is always called PS Survivor Space. |
-|memoryPools-PSSurvivorSpace-peakUsageCommitted |Peak committed memory of this pool since JVM was started. | 16252928 | |
-|memoryPools-PSSurvivorSpace-peakUsageMax |Peak value of usageMax of this pool since the JVM was started. | 16252928 |-1 if undefined. |
-|memoryPools-PSSurvivorSpace-peakUsageUsed |Peak value of usage of this pool since the JVM was started. | 0 | |
-|memoryPools-PSSurvivorSpace-type |Type of memory of this memory pool. | Heap memory |PS Survivor Space is a portion of the heap memory that is managed by the JVM |
-|memoryPools-PSSurvivorSpace-usageCommitted |Total memory in bytes committed for this pool. | 16252928 | |
-|memoryPools-PSSurvivorSpace-usageMax |The maximum amount of memory that can be used by this pool | 16252928 |-1 if undefined. Not guaranteed to be available if greater than the committed memory. |
-|memoryPools-PSSurvivorSpace-usageUsed |Amount of memory used by this pool (and by newly loaded classes).| 0 |A continuously increasing value indicates an unhealthy garbage collection. |
-|name |Process name (number) | 12345@bigdata-datanode1.com |Also contains host name. |
-|nonHeapMemoryCommitted |Amount of non heap memory in bytes committed for the JVM to use. | 16187392 |Total of committed of all non-heap memory pools. |
-|nonHeapMemoryMax |Maximum amount of memory in bytes that can be used. | -1 |-1 if undefined. |
-|nonHeapMemoryTotalUsed |Amount of non heap memory (metaspace, code cache) used. | 13510368 |Total of usage of all non-heap memory pools. |
-|processCpuLoad |The recent cpu usage for the JVM process. | 4.335671366438364e-9 | |
-|processCpuTime |CPU time used by JVM process in nanoseconds. | 2340000000 | |
-|processUuid |UUID of the JVM process. | 48abf05b-dfd4-4069-86c6-8cdbc195bd40 | |
-|processUuid_1 |UUID of the JVM process. | 48abf05b-dfd4-4069-86c6-8cdbc195bd40 |Appears to be a duplicate metric. |
-|role |Role of this spark executor. | executor |Can be either executor or driver. |
-|systemCpuLoad |The recent cpu usage for the whole system. | 0.03703887412577616 | |
-|vmHWM |Peak resident set size ("High Water Mark") in bytes for the JVM. | 142876672 |An indication of actual physical memory (RAM) usage in linux by the JVM. |
-|vmPeak |Peak of the virtual memory usage in bytes for the JVM. | 15130554368 | |
-|vmRSS |JVM physical memory usage (resident set size) in bytes. | 142876672 | |
-|vmSize |Virtual memory size for the JVM. | 15130550272 |This memory includes swap space, so a large value can imply high swap memory usage. |
-
-## 2. IO
-
-|**Name** |**Description** | **Sample Value** |**Notes** |
-|-----------------------|-----------------------------------------------------------------|---------------------------------------|---------------------------------------------------------------------------------------|
-|time |Time series value for grafana database. | 1582504713009000000 | |
-|appId |Application id for the job that is running. | application_1576797426048_311346 |If using yarn, this is the yarn application id. |
-|epochMillis |System time in milliseconds when this value was recorded. | 1582504713001 | |
-|host |Hostname of the executor. | bigdata-datanode1.com | |
-|name |Process name (number). | 12345@bigdata-datanode1.com |Includes the hostname as well. |
-|processUuid |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 | |
-|processUuid_1 |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 |Appears to be a duplicate metric. |
-|role |Role of this spark executor. | executor |Can be either executor or driver. |
-|self-io-rchar-1 |The number of characters read by this JVM process. | 8192340 |The "-1" is coming from the formatter for influx which was used when writting this. |
-|self-io-read_bytes-1 |Attempt to count the bytes read by this JVM process from storage.| 1892352 | |
-|self-io-wchar-1 |The number of characters written to disk by this JVM process. | 51016 | |
-|self-io-write_bytes-1 |Attempt to count the bytes written by JVM process to storage. | 86016 | |
-|stat-cpu-N |CPU entry found in /proc/<pid>/stat. | cpu, cpu0, cpu1, cpu2 ... |N is the CPU number starting at cpu-1 (i.e. cpu) which aggregates all other CPU lines. |
-|stat-idle-N |Time the N-th CPU spent in the idle task. | 53679018 |Time is in USER_HZ (1/100th of a second). |
-|stat-iowait-N |Time spent by N-th CPU waiting for I/O to complete. | 137645010 | |
-|stat-nice-N |Time spent by N-th CPU in user mode with low priority (nice). | 104 |Low idle time with high nice time are indications of busy background tasks running. |
-|stat-system-N |Time spent by N-th CPU in system mode. | 32700364 |Time spent at kernel level. |
-|stat-user-N |Time spent by N-th CPU at the user (application) level | 279816973 | |
-
-## 3. Process Info
-
-|**Name** |**Description** | **Sample Value** |**Notes** |
-|------------------|-----------------------------------------------------------------|------------------------------------------------|---------------------------------------------------------------------------------------|
-|time |Time series value for grafana database. | 1582504713009000000 | |
-|agentVersion |A constant value defined in code. | 1.0.0 |Agent version will always be 1.0.0. |
-|appId |Application id for the job that is running. | application_1576797426048_311346 |If using yarn, this is the yarn application id. |
-|cmdline |Contains JVM command executed and input arguments and classpath. | /usr/jdk64/jdk1.8.0_112/bin/java -javaagent... | |
-|epochMillis |System time in milliseconds when this value was recorded. | 1582504713001 | |
-|host |Hostname of the executor. | bigdata-datanode1.com | |
-|jvmClassPath |Contains JVM classpath entries. | --user-class-path .../jvm-profiler-1.0.0.jar |This entry is emtpy if cmdLine is not empty. This is to avoid duplicate information. |
-|jvmInputArguments |Contains JVM input arguments. | metricInterval=5000,sampleInterval=5000 ... |This entry is emtpy if cmdLine is not empty. This is to avoid duplicate information. |
-|name |Process name (number). | 12345@bigdata-datanode1.com |Includes the hostname as well. |
-|processUuid |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 | |
-|processUuid_1 |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 |Appears to be a duplicate metric. |
-|role |Role of this spark executor. | executor |Can be either executor or driver. |
-|xmxBytes |Maximum JVM heap size in bytes. | 12884901888 | |
-
-## 4. Stack Trace
-
-|**Name** |**Description** | **Sample Value** |**Notes** |
-|--------------|-----------------------------------------------------------------|-----------------------------------------|---------------------------------------------------------------------------------------|
-|time |Time series value for grafana database. | 1582504713009000000 | |
-|appId |Application id for the job that is running. | application_1576797426048_311346 |If using yarn, this is the yarn application id. |
-|count |Number of elements appended to the metrics buffer. | 1 |This value is usually 1, but not guaranteed to be constant. It is thread-safe. |
-|endEpoch |System time in milliseconds after resetting the metrics buffer. | 1582504712723 |The metrics buffer is an internal buffer used by this profiling application. |
-|host |Hostname of the executor. | bigdata-datanode1.com | |
-|name |Process name (number). | 12345@bigdata-datanode1.com |Includes the hostname as well. |
-|processUuid |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 | |
-|processUuid_1 |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 |Appears to be a duplicate metric. |
-|role |Role of this spark executor. | executor |Can be either executor or driver. |
-|stacktrace |Stacktrace starting from bottom of the stacktrace. | java.lang.Object.wait,java.lang.ref ... |Trims the top method (most nested method) if the size is too large (800k characters) |
-|startEpoch |System time in milliseconds before resetting the metrics buffer. | 1582504710523 |The metrics buffer is an internal buffer used by this profiling application. |
-|threadName |Name of the thread for which stacktrace is displayed. | Signal Dispatcher | |
-|threadState |State of the thread when this stacktrace was captured. | NEW, RUNNABLE, BLOCKED, WAITING ... | |
-
-## 5. Thread Info
-
-|**Name** |**Description** | **Sample Value** |**Notes** |
-|------------------------|----------------------------------------------------------|---------------------------------------|------------------------------------------------|
-|time |Time series value for grafana database. | 1582504713009000000 | |
-|epochMillis |System time in milliseconds when this value was recorded. | 1582504781508 | |
-|host |Hostname of the executor. | bigdata-datanode1.com | |
-|name |Process name (number). | 12345@bigdata-datanode1.com |Includes the hostname as well. |
-|appId |Application id for the job that is running. | application_1576797426048_311346 |If using yarn, this is the yarn application id. |
-|processUuid |UUID of the JVM process. | 89a256c7-96c3-4e48-b5ba-f55e886ba743 | |
-|role |Role of this spark executor. | executor |Can be either executor or driver. |
-|totalStartedThreadCount |Total Number of Thread created so far since JVm Launch. | 10 | |
-|liveThreadCount |Number of thread which are currently active. | 8 | |
-|newThreadCount |Number of thread which are newly Created. | 3 | Derived from last Cycle Total Threads. |
-|peakThreadCount |the peak live thread count since the JVM start | 8 | |
diff --git a/streampark-plugin/streampark-jvm-profiler/pom.xml b/streampark-plugin/streampark-jvm-profiler/pom.xml
deleted file mode 100644
index 7d93ba214..000000000
--- a/streampark-plugin/streampark-jvm-profiler/pom.xml
+++ /dev/null
@@ -1,250 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.streampark</groupId>
- <artifactId>streampark-plugin</artifactId>
- <version>2.0.0</version>
- </parent>
-
- <artifactId>streampark-jvm-profiler</artifactId>
- <name>StreamPark : JVM Profiler</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.scalaj</groupId>
- <artifactId>scalaj-http_${scala.binary.version}</artifactId>
- <version>2.4.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.21.0-GA</version>
- </dependency>
-
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </dependency>
-
- <!--test-->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <archive>
- <manifestEntries>
- <Agent-Class>org.apache.streampark.plugin.profiling.Agent</Agent-Class>
- <Premain-Class>org.apache.streampark.plugin.profiling.Agent</Premain-Class>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <createDependencyReducedPom>true</createDependencyReducedPom>
- <dependencyReducedPomLocation>${project.basedir}/target/dependency-reduced-pom.xml</dependencyReducedPomLocation>
- <relocations>
- <relocation>
- <pattern>org.apache</pattern>
- <shadedPattern>jagent.shaded.org.apache</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.fasterxml</pattern>
- <shadedPattern>jagent.shaded.com.fasterxml</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.codehaus</pattern>
- <shadedPattern>jagent.shaded.org.codehaus</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.thoughtworks</pattern>
- <shadedPattern>jagent.shaded.com.thoughtworks</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.xerial</pattern>
- <shadedPattern>jagent.shaded.org.xerial</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.tukaani</pattern>
- <shadedPattern>jagent.shaded.org.tukaani</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.slf4j</pattern>
- <shadedPattern>jagent.shaded.org.slf4j</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.alibaba</pattern>
- <shadedPattern>jagent.shaded.com.alibaba</shadedPattern>
- </relocation>
- <relocation>
- <pattern>net.logstash</pattern>
- <shadedPattern>jagent.shaded.net.logstash</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.timgroup</pattern>
- <shadedPattern>jagent.shaded.com.timgroup</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.amazonaws</pattern>
- <shadedPattern>jagent.shaded.com.amazonaws</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.javassist</pattern>
- <shadedPattern>jagent.shaded.org.javassist</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.joda</pattern>
- <shadedPattern>jagent.shaded.org.joda</shadedPattern>
- </relocation>
- <relocation>
- <pattern>avro</pattern>
- <shadedPattern>jagent.shaded.avro</shadedPattern>
- </relocation>
- <relocation>
- <pattern>edu</pattern>
- <shadedPattern>jagent.shaded.edu</shadedPattern>
- </relocation>
- <relocation>
- <pattern>javassist</pattern>
- <shadedPattern>jagent.shaded.javassist</shadedPattern>
- </relocation>
- <relocation>
- <pattern>net</pattern>
- <shadedPattern>jagent.shaded.net</shadedPattern>
- </relocation>
- <relocation>
- <pattern>com.shade</pattern>
- <shadedPattern>jagent.shaded.com.shade</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.yaml</pattern>
- <shadedPattern>ujagent_org.yaml</shadedPattern>
- </relocation>
- <relocation>
- <pattern>redis.clients</pattern>
- <shadedPattern>jagent.shaded.redis.clients</shadedPattern>
- </relocation>
- <relocation>
- <pattern>org.influxdb</pattern>
- <shadedPattern>jagent.shaded.org.influxdb</shadedPattern>
- </relocation>
- <relocation>
- <pattern>ch</pattern>
- <shadedPattern>jagent.shaded.ch</shadedPattern>
- </relocation>
- <relocation>
- <pattern>okio</pattern>
- <shadedPattern>jagent.shaded.okio</shadedPattern>
- </relocation>
- </relocations>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/maven/**</exclude>
- <exclude>META-INF/services/com.fasterxml.**</exclude>
- <exclude>awssdk_config_default.json</exclude>
- <exclude>heatpipe.config.properties</exclude>
- <exclude>log4j.properties</exclude>
- <exclude>kafka/kafka-version.properties</exclude>
- <exclude>darwin/x86_64/liblz4-java.dylib</exclude>
- <exclude>linux/amd64/liblz4-java.so</exclude>
- <exclude>linux/i386/liblz4-java.so</exclude>
- <exclude>win32/amd64/liblz4-java.so</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.ning.maven.plugins</groupId>
- <artifactId>maven-dependency-versions-check-plugin</artifactId>
- <version>2.0.4</version>
- <executions>
- <execution>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.19.1</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Agent.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Agent.java
deleted file mode 100644
index 905ee1fa2..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Agent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-
-import java.lang.instrument.Instrumentation;
-
-public final class Agent {
-
- private static final AgentLogger LOGGER = AgentLogger.getLogger(Agent.class.getName());
-
- private static final AgentImpl AGENT_IMPL = new AgentImpl();
-
- private Agent() {
- }
-
- public static void agentmain(final String args, final Instrumentation instrumentation) {
- premain(args, instrumentation);
- }
-
- public static void premain(final String args, final Instrumentation instrumentation) {
- LOGGER.info("Java Agent " + AgentImpl.VERSION + " premain args: " + args);
- Arguments arguments = Arguments.parseArgs(args);
- arguments.runConfigProvider();
- AGENT_IMPL.run(arguments, instrumentation, null);
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/AgentImpl.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/AgentImpl.java
deleted file mode 100644
index 815db95e6..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/AgentImpl.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import org.apache.streampark.plugin.profiling.profiler.CpuAndMemoryProfiler;
-import org.apache.streampark.plugin.profiling.profiler.IOProfiler;
-import org.apache.streampark.plugin.profiling.profiler.MethodArgumentCollector;
-import org.apache.streampark.plugin.profiling.profiler.MethodArgumentProfiler;
-import org.apache.streampark.plugin.profiling.profiler.MethodDurationCollector;
-import org.apache.streampark.plugin.profiling.profiler.MethodDurationProfiler;
-import org.apache.streampark.plugin.profiling.profiler.ProcessInfoProfiler;
-import org.apache.streampark.plugin.profiling.profiler.StacktraceCollectorProfiler;
-import org.apache.streampark.plugin.profiling.profiler.StacktraceReporterProfiler;
-import org.apache.streampark.plugin.profiling.profiler.ThreadInfoProfiler;
-import org.apache.streampark.plugin.profiling.transformer.JavaAgentFileTransformer;
-import org.apache.streampark.plugin.profiling.transformer.MethodProfilerStaticProxy;
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethodLongMetricBuffer;
-import org.apache.streampark.plugin.profiling.util.ClassMethodArgumentMetricBuffer;
-import org.apache.streampark.plugin.profiling.util.SparkUtils;
-import org.apache.streampark.plugin.profiling.util.StacktraceMetricBuffer;
-
-import java.lang.instrument.Instrumentation;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-public class AgentImpl {
- public static final String VERSION = "1.0.0";
-
- private static final AgentLogger LOGGER = AgentLogger.getLogger(AgentImpl.class.getName());
-
- private static final int MAX_THREAD_POOL_SIZE = 2;
-
- private boolean started = false;
-
- public void run(
- Arguments arguments,
- Instrumentation instrumentation,
- Collection<AutoCloseable> objectsToCloseOnShutdown) {
- if (arguments.isNoop()) {
- LOGGER.info("Agent noop is true, do not run anything");
- return;
- }
-
- Reporter reporter = arguments.getReporter();
-
- String processUuid = UUID.randomUUID().toString();
-
- String appId = null;
-
- String appIdVariable = arguments.getAppIdVariable();
- if (appIdVariable != null && !appIdVariable.isEmpty()) {
- appId = System.getenv(appIdVariable);
- }
-
- if (appId == null || appId.isEmpty()) {
- appId = SparkUtils.probeAppId(arguments.getAppIdRegex());
- }
-
- if (!arguments.getDurationProfiling().isEmpty()
- || !arguments.getArgumentProfiling().isEmpty()) {
- instrumentation.addTransformer(
- new JavaAgentFileTransformer(
- arguments.getDurationProfiling(), arguments.getArgumentProfiling()));
- }
-
- List<Profiler> profilers = createProfilers(reporter, arguments, processUuid, appId);
-
- ProfilerGroup profilerGroup = startProfilers(profilers);
-
- Thread shutdownHook =
- new Thread(
- new ShutdownHookRunner(
- profilerGroup.getPeriodicProfilers(),
- Collections.singletonList(reporter),
- objectsToCloseOnShutdown));
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- }
-
- public ProfilerGroup startProfilers(Collection<Profiler> profilers) {
- if (started) {
- LOGGER.warn("Profilers already started, do not start it again");
- return new ProfilerGroup(new ArrayList<>(), new ArrayList<>());
- }
-
- List<Profiler> oneTimeProfilers = new ArrayList<>();
- List<Profiler> periodicProfilers = new ArrayList<>();
-
- for (Profiler profiler : profilers) {
- if (profiler.getInterval() == 0) {
- oneTimeProfilers.add(profiler);
- } else if (profiler.getInterval() > 0) {
- periodicProfilers.add(profiler);
- } else {
- LOGGER.log(
- String.format(
- "Ignored profiler %s due to its invalid interval %s",
- profiler, profiler.getInterval()));
- }
- }
-
- for (Profiler profiler : oneTimeProfilers) {
- try {
- profiler.profile();
- LOGGER.info("Finished one time profiler: " + profiler);
- } catch (Throwable ex) {
- LOGGER.warn("Failed to run one time profiler: " + profiler, ex);
- }
- }
-
- for (Profiler profiler : periodicProfilers) {
- try {
- profiler.profile();
- LOGGER.info("Ran periodic profiler (first run): " + profiler);
- } catch (Throwable ex) {
- LOGGER.warn("Failed to run periodic profiler (first run): " + profiler, ex);
- }
- }
- scheduleProfilers(periodicProfilers);
- started = true;
- return new ProfilerGroup(oneTimeProfilers, periodicProfilers);
- }
-
- private List<Profiler> createProfilers(
- Reporter reporter, Arguments arguments, String processUuid, String appId) {
- String tag = arguments.getTag();
- String cluster = arguments.getCluster();
- long metricInterval = arguments.getMetricInterval();
-
- List<Profiler> profilers = new ArrayList<>();
-
- CpuAndMemoryProfiler cpuAndMemoryProfiler = new CpuAndMemoryProfiler(reporter);
- cpuAndMemoryProfiler.setTag(tag);
- cpuAndMemoryProfiler.setCluster(cluster);
- cpuAndMemoryProfiler.setInterval(metricInterval);
- cpuAndMemoryProfiler.setProcessUuid(processUuid);
- cpuAndMemoryProfiler.setAppId(appId);
- profilers.add(cpuAndMemoryProfiler);
-
- ThreadInfoProfiler threadInfoProfiler = new ThreadInfoProfiler(reporter);
- threadInfoProfiler.setTag(tag);
- threadInfoProfiler.setCluster(cluster);
- threadInfoProfiler.setInterval(metricInterval);
- threadInfoProfiler.setProcessUuid(processUuid);
- threadInfoProfiler.setAppId(appId);
- profilers.add(threadInfoProfiler);
-
- ProcessInfoProfiler processInfoProfiler = new ProcessInfoProfiler(reporter);
- processInfoProfiler.setTag(tag);
- processInfoProfiler.setCluster(cluster);
- processInfoProfiler.setProcessUuid(processUuid);
- processInfoProfiler.setAppId(appId);
- profilers.add(processInfoProfiler);
-
- if (!arguments.getDurationProfiling().isEmpty()) {
- ClassAndMethodLongMetricBuffer classAndMethodMetricBuffer =
- new ClassAndMethodLongMetricBuffer();
-
- MethodDurationProfiler methodDurationProfiler =
- new MethodDurationProfiler(classAndMethodMetricBuffer, reporter);
- methodDurationProfiler.setTag(tag);
- methodDurationProfiler.setCluster(cluster);
- methodDurationProfiler.setInterval(metricInterval);
- methodDurationProfiler.setProcessUuid(processUuid);
- methodDurationProfiler.setAppId(appId);
-
- MethodDurationCollector methodDurationCollector =
- new MethodDurationCollector(classAndMethodMetricBuffer);
- MethodProfilerStaticProxy.setCollector(methodDurationCollector);
-
- profilers.add(methodDurationProfiler);
- }
-
- if (!arguments.getArgumentProfiling().isEmpty()) {
- ClassMethodArgumentMetricBuffer classAndMethodArgumentBuffer =
- new ClassMethodArgumentMetricBuffer();
-
- MethodArgumentProfiler methodArgumentProfiler =
- new MethodArgumentProfiler(classAndMethodArgumentBuffer, reporter);
- methodArgumentProfiler.setTag(tag);
- methodArgumentProfiler.setCluster(cluster);
- methodArgumentProfiler.setInterval(metricInterval);
- methodArgumentProfiler.setProcessUuid(processUuid);
- methodArgumentProfiler.setAppId(appId);
-
- MethodArgumentCollector methodArgumentCollector =
- new MethodArgumentCollector(classAndMethodArgumentBuffer);
- MethodProfilerStaticProxy.setArgumentCollector(methodArgumentCollector);
-
- profilers.add(methodArgumentProfiler);
- }
-
- if (arguments.getSampleInterval() > 0) {
- StacktraceMetricBuffer stacktraceMetricBuffer = new StacktraceMetricBuffer();
-
- StacktraceCollectorProfiler stacktraceCollectorProfiler =
- new StacktraceCollectorProfiler(stacktraceMetricBuffer, AgentThreadFactory.NAME_PREFIX);
- stacktraceCollectorProfiler.setInterval(arguments.getSampleInterval());
-
- StacktraceReporterProfiler stacktraceReporterProfiler =
- new StacktraceReporterProfiler(stacktraceMetricBuffer, reporter);
- stacktraceReporterProfiler.setTag(tag);
- stacktraceReporterProfiler.setCluster(cluster);
- stacktraceReporterProfiler.setInterval(metricInterval);
- stacktraceReporterProfiler.setProcessUuid(processUuid);
- stacktraceReporterProfiler.setAppId(appId);
-
- profilers.add(stacktraceCollectorProfiler);
- profilers.add(stacktraceReporterProfiler);
- }
-
- if (arguments.isIoProfiling()) {
- IOProfiler ioProfiler = new IOProfiler(reporter);
- ioProfiler.setTag(tag);
- ioProfiler.setCluster(cluster);
- ioProfiler.setInterval(metricInterval);
- ioProfiler.setProcessUuid(processUuid);
- ioProfiler.setAppId(appId);
-
- profilers.add(ioProfiler);
- }
-
- return profilers;
- }
-
- private void scheduleProfilers(Collection<Profiler> profilers) {
- int threadPoolSize = Math.min(profilers.size(), MAX_THREAD_POOL_SIZE);
- ScheduledExecutorService scheduledExecutorService =
- Executors.newScheduledThreadPool(threadPoolSize, new AgentThreadFactory());
- for (Profiler profiler : profilers) {
- if (profiler.getInterval() < Arguments.MIN_INTERVAL_MILLIS) {
- throw new RuntimeException(
- "Interval too short for profiler: "
- + profiler
- + ", must be at least "
- + Arguments.MIN_INTERVAL_MILLIS);
- }
- ProfilerRunner worker = new ProfilerRunner(profiler);
- scheduledExecutorService.scheduleAtFixedRate(
- worker, 0, profiler.getInterval(), TimeUnit.MILLISECONDS);
- LOGGER.info(
- String.format(
- "Scheduled profiler %s with interval %s millis", profiler, profiler.getInterval()));
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/AgentThreadFactory.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/AgentThreadFactory.java
deleted file mode 100644
index 42c928b25..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/AgentThreadFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-public class AgentThreadFactory implements ThreadFactory {
- public static final String NAME_PREFIX = "uber_java_agent";
-
- private static final ThreadFactory DEFAULT_THREAD_FACTORY = Executors.defaultThreadFactory();
-
- @Override
- public Thread newThread(Runnable r) {
- Thread thread = DEFAULT_THREAD_FACTORY.newThread(r);
- if (thread != null) {
- thread.setDaemon(true);
- thread.setName(String.format("%s-%s", NAME_PREFIX, thread.getName()));
- }
-
- return thread;
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ArgumentUtils.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ArgumentUtils.java
deleted file mode 100644
index 6dc66c7da..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ArgumentUtils.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class ArgumentUtils {
-
- public static boolean needToUpdateArg(String argValue) {
- return argValue != null && !argValue.isEmpty();
- }
-
- public static String getArgumentSingleValue(
- Map<String, List<String>> parsedArgs, String argName) {
- List<String> list = parsedArgs.get(argName);
- if (list == null) {
- return null;
- }
-
- if (list.isEmpty()) {
- return "";
- }
-
- return list.get(list.size() - 1);
- }
-
- public static List<String> getArgumentMultiValues(
- Map<String, List<String>> parsedArgs, String argName) {
- List<String> list = parsedArgs.get(argName);
- if (list == null) {
- return new ArrayList<>();
- }
- return list;
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Arguments.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Arguments.java
deleted file mode 100644
index d38f7ca17..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Arguments.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import org.apache.streampark.plugin.profiling.reporter.ConsoleOutputReporter;
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethod;
-import org.apache.streampark.plugin.profiling.util.ClassMethodArgument;
-import org.apache.streampark.plugin.profiling.util.DummyConfigProvider;
-import org.apache.streampark.plugin.profiling.util.ReflectionUtils;
-import org.apache.streampark.plugin.profiling.util.Utils;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Arguments {
- public static final String DEFAULT_APP_ID_REGEX = "application_[\\w_]+";
- public static final long DEFAULT_METRIC_INTERVAL = 60000;
- public static final long DEFAULT_SAMPLE_INTERVAL = 100;
-
- public static final String ARG_NOOP = "noop";
- public static final String ARG_REPORTER = "reporter";
- public static final String ARG_CONFIG_PROVIDER = "configProvider";
- public static final String ARG_CONFIG_FILE = "configFile";
- public static final String ARG_METRIC_INTERVAL = "metricInterval";
- public static final String ARG_SAMPLE_INTERVAL = "sampleInterval";
- public static final String ARG_TAG = "tag";
- public static final String ARG_CLUSTER = "cluster";
- public static final String ARG_APP_ID_VARIABLE = "appIdVariable";
- public static final String ARG_APP_ID_REGEX = "appIdRegex";
- public static final String ARG_DURATION_PROFILING = "durationProfiling";
- public static final String ARG_ARGUMENT_PROFILING = "argumentProfiling";
-
- public static final String ARG_IO_PROFILING = "ioProfiling";
-
- public static final long MIN_INTERVAL_MILLIS = 50;
-
- private static final AgentLogger LOGGER = AgentLogger.getLogger(Arguments.class.getName());
-
- private final Map<String, List<String>> rawArgValues = new HashMap<>();
-
- private boolean noop = false;
-
- private Constructor<Reporter> reporterConstructor;
- private Constructor<ConfigProvider> configProviderConstructor;
- private String configFile;
-
- private String appIdVariable;
- private String appIdRegex = DEFAULT_APP_ID_REGEX;
- private long metricInterval = DEFAULT_METRIC_INTERVAL;
- private long sampleInterval = 0L;
- private String tag;
- private String cluster;
- private boolean ioProfiling;
-
- private final List<ClassAndMethod> durationProfiling = new ArrayList<>();
- private final List<ClassMethodArgument> argumentProfiling = new ArrayList<>();
-
- private Arguments(Map<String, List<String>> parsedArgs) {
- doArguments(parsedArgs);
- }
-
- public static Arguments parseArgs(String args) {
- if (args == null) {
- return new Arguments(new HashMap<>());
- }
-
- args = args.trim();
- if (args.isEmpty()) {
- return new Arguments(new HashMap<>());
- }
-
- Map<String, List<String>> map = new HashMap<>();
- for (String argPair : args.split(",")) {
- String[] strs = argPair.split("=");
- if (strs.length != 2) {
- throw new IllegalArgumentException(
- "Arguments for the agent should be like: key1=value1,key2=value2");
- }
-
- String key = strs[0].trim();
- if (key.isEmpty()) {
- throw new IllegalArgumentException("Argument key should not be empty");
- }
-
- List<String> list = map.computeIfAbsent(key, k -> new ArrayList<>());
- list.add(strs[1].trim());
- }
-
- return new Arguments(map);
- }
-
- public void doArguments(Map<String, List<String>> parsedArgs) {
- rawArgValues.putAll(parsedArgs);
-
- String argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_NOOP);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- noop = Boolean.parseBoolean(argValue);
- LOGGER.info("Got argument value for noop: " + noop);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_REPORTER);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- reporterConstructor = ReflectionUtils.getConstructor(argValue, Reporter.class);
- LOGGER.info("Got argument value for reporter: " + argValue);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_CONFIG_PROVIDER);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- configProviderConstructor = ReflectionUtils.getConstructor(argValue, ConfigProvider.class);
- LOGGER.info("Got argument value for configProvider: " + argValue);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_CONFIG_FILE);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- configFile = argValue;
- LOGGER.info("Got argument value for configFile: " + configFile);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_METRIC_INTERVAL);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- metricInterval = Long.parseLong(argValue);
- LOGGER.info("Got argument value for metricInterval: " + metricInterval);
- }
-
- if (metricInterval < MIN_INTERVAL_MILLIS) {
- throw new RuntimeException(
- "Metric interval too short, must be at least " + Arguments.MIN_INTERVAL_MILLIS);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_SAMPLE_INTERVAL);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- sampleInterval = Long.parseLong(argValue);
- LOGGER.info("Got argument value for sampleInterval: " + sampleInterval);
- }
-
- if (sampleInterval != 0 && sampleInterval < MIN_INTERVAL_MILLIS) {
- throw new RuntimeException(
- "Sample interval too short, must be 0 (disable sampling) or at least "
- + Arguments.MIN_INTERVAL_MILLIS);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_TAG);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- tag = argValue;
- LOGGER.info("Got argument value for tag: " + tag);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_CLUSTER);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- cluster = argValue;
- LOGGER.info("Got argument value for cluster: " + cluster);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_APP_ID_VARIABLE);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- appIdVariable = argValue;
- LOGGER.info("Got argument value for appIdVariable: " + appIdVariable);
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_APP_ID_REGEX);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- appIdRegex = argValue;
- LOGGER.info("Got argument value for appIdRegex: " + appIdRegex);
- }
-
- List<String> argValues =
- ArgumentUtils.getArgumentMultiValues(parsedArgs, ARG_DURATION_PROFILING);
- if (!argValues.isEmpty()) {
- durationProfiling.clear();
- for (String str : argValues) {
- int index = str.lastIndexOf(".");
- if (index <= 0 || index + 1 >= str.length()) {
- throw new IllegalArgumentException("Invalid argument value: " + str);
- }
- String className = str.substring(0, index);
- String methodName = str.substring(index + 1);
- ClassAndMethod classAndMethod = new ClassAndMethod(className, methodName);
- durationProfiling.add(classAndMethod);
- LOGGER.info("Got argument value for durationProfiling: " + classAndMethod);
- }
- }
-
- argValues = ArgumentUtils.getArgumentMultiValues(parsedArgs, ARG_ARGUMENT_PROFILING);
- if (!argValues.isEmpty()) {
- argumentProfiling.clear();
- for (String str : argValues) {
- int index = str.lastIndexOf(".");
- if (index <= 0 || index + 1 >= str.length()) {
- throw new IllegalArgumentException("Invalid argument value: " + str);
- }
- String classMethodName = str.substring(0, index);
- int argumentIndex = Integer.parseInt(str.substring(index + 1));
-
- index = classMethodName.lastIndexOf(".");
- if (index <= 0 || index + 1 >= classMethodName.length()) {
- throw new IllegalArgumentException("Invalid argument value: " + str);
- }
- String className = classMethodName.substring(0, index);
- String methodName = str.substring(index + 1, classMethodName.length());
-
- ClassMethodArgument classMethodArgument =
- new ClassMethodArgument(className, methodName, argumentIndex);
- argumentProfiling.add(classMethodArgument);
- LOGGER.info("Got argument value for argumentProfiling: " + classMethodArgument);
- }
- }
-
- argValue = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_IO_PROFILING);
- if (ArgumentUtils.needToUpdateArg(argValue)) {
- ioProfiling = Boolean.parseBoolean(argValue);
- LOGGER.info("Got argument value for ioProfiling: " + ioProfiling);
- }
- }
-
- public void runConfigProvider() {
- try {
- ConfigProvider configProvider = getConfigProvider();
- if (configProvider != null) {
- Map<String, Map<String, List<String>>> extraConfig = configProvider.getConfig();
-
- // Get root level config (use empty string as key in the config map)
- Map<String, List<String>> rootConfig = extraConfig.get("");
- if (rootConfig != null) {
- doArguments(rootConfig);
- LOGGER.info("Updated arguments based on config: " + Utils.toJsonString(rootConfig));
- }
-
- // Get tag level config (use tag value to find config values in the config map)
- if (getTag() != null && !getTag().isEmpty()) {
- Map<String, List<String>> overrideConfig = extraConfig.get(getTag());
- if (overrideConfig != null) {
- doArguments(overrideConfig);
- LOGGER.info(
- "Updated arguments based on config override: "
- + Utils.toJsonString(overrideConfig));
- }
- }
- }
- } catch (Throwable ex) {
- LOGGER.warn("Failed to update arguments with config provider", ex);
- }
- }
-
- public Map<String, List<String>> getRawArgValues() {
- return rawArgValues;
- }
-
- public Reporter getReporter() {
- if (reporterConstructor == null) {
- return new ConsoleOutputReporter();
- } else {
- try {
- Reporter reporter = reporterConstructor.newInstance();
- reporter.doArguments(getRawArgValues());
- return reporter;
- } catch (Throwable e) {
- throw new RuntimeException(
- String.format(
- "Failed to create reporter instance %s", reporterConstructor.getDeclaringClass()),
- e);
- }
- }
- }
-
- public ConfigProvider getConfigProvider() {
- if (configProviderConstructor == null) {
- return new DummyConfigProvider();
- } else {
- try {
- ConfigProvider configProvider = configProviderConstructor.newInstance();
- if (configProvider instanceof YamlConfigProvider) {
- if (configFile == null || configFile.isEmpty()) {
- throw new RuntimeException(
- "Argument configFile is empty, cannot use " + configProvider.getClass());
- }
- ((YamlConfigProvider) configProvider).setFilePath(configFile);
- return configProvider;
- }
- return configProvider;
- } catch (Throwable e) {
- throw new RuntimeException(
- String.format(
- "Failed to create config provider instance %s",
- configProviderConstructor.getDeclaringClass()),
- e);
- }
- }
- }
-
- public boolean isNoop() {
- return noop;
- }
-
- public void setReporter(String className) {
- reporterConstructor = ReflectionUtils.getConstructor(className, Reporter.class);
- }
-
- public void setConfigProvider(String className) {
- configProviderConstructor = ReflectionUtils.getConstructor(className, ConfigProvider.class);
- }
-
- public long getMetricInterval() {
- return metricInterval;
- }
-
- public long getSampleInterval() {
- return sampleInterval;
- }
-
- public String getTag() {
- return tag;
- }
-
- public String getCluster() {
- return cluster;
- }
-
- public String getAppIdVariable() {
- return appIdVariable;
- }
-
- public void setAppIdVariable(String appIdVariable) {
- this.appIdVariable = appIdVariable;
- }
-
- public String getAppIdRegex() {
- return appIdRegex;
- }
-
- public List<ClassAndMethod> getDurationProfiling() {
- return durationProfiling;
- }
-
- public List<ClassMethodArgument> getArgumentProfiling() {
- return argumentProfiling;
- }
-
- public boolean isIoProfiling() {
- return ioProfiling;
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ConfigProvider.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ConfigProvider.java
deleted file mode 100644
index f74c407d2..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ConfigProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import java.util.List;
-import java.util.Map;
-
-public interface ConfigProvider {
- /**
- * * Returns a map containing multiple child maps. Each child map contains a group of key/value
- * pairs for a specific jvm profiler user (identified by tag value when start the profiler). The
- * child map for empty tag value contains the default configuration for all profilers.
- *
- * @return
- */
- Map<String, Map<String, List<String>>> getConfig();
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Profiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Profiler.java
deleted file mode 100644
index 4ccf135e4..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Profiler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-public interface Profiler {
- /**
- * @return
- */
- long getInterval();
-
- /**
- * @param reporter
- */
- void setReporter(Reporter reporter);
-
- /**
- *
- */
- void profile();
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ProfilerGroup.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ProfilerGroup.java
deleted file mode 100644
index dcda7b725..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ProfilerGroup.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProfilerGroup {
- private final List<Profiler> oneTimeProfilers;
- private final List<Profiler> periodicProfilers;
-
- public ProfilerGroup(List<Profiler> oneTimeProfilers, List<Profiler> periodicProfilers) {
- this.oneTimeProfilers = new ArrayList<>(oneTimeProfilers);
- this.periodicProfilers = new ArrayList<>(periodicProfilers);
- }
-
- public List<Profiler> getOneTimeProfilers() {
- return oneTimeProfilers;
- }
-
- public List<Profiler> getPeriodicProfilers() {
- return periodicProfilers;
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ProfilerRunner.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ProfilerRunner.java
deleted file mode 100644
index d75194318..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ProfilerRunner.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-public class ProfilerRunner implements Runnable {
- private static final AgentLogger LOGGER = AgentLogger.getLogger(ProfilerRunner.class.getName());
-
- private static final int MAX_ERROR_COUNT_TO_LOG = 100;
-
- private final Profiler profiler;
- private static final AtomicLong ERROR_COUNTER = new AtomicLong(0);
-
- public ProfilerRunner(Profiler profiler) {
- this.profiler = profiler;
- }
-
- @Override
- public void run() {
- try {
- profiler.profile();
- } catch (Throwable e) {
- long errorCountValue = ERROR_COUNTER.incrementAndGet();
- if (errorCountValue <= MAX_ERROR_COUNT_TO_LOG) {
- LOGGER.warn("Failed to run profile: " + profiler, e);
- } else {
- e.printStackTrace();
- }
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Reporter.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Reporter.java
deleted file mode 100644
index e87e7c867..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/Reporter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import java.util.List;
-import java.util.Map;
-
-public interface Reporter {
-
- default void doArguments(Map<String, List<String>> parsedArgs) {
- }
-
- void report(String profilerName, Map<String, Object> metrics);
-
- void close();
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ShutdownHookRunner.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ShutdownHookRunner.java
deleted file mode 100644
index 8f7c96e0b..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/ShutdownHookRunner.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-public class ShutdownHookRunner implements Runnable {
- private static final AgentLogger LOGGER = AgentLogger.getLogger(ShutdownHookRunner.class.getName());
-
- private final List<Profiler> profilers;
- private final List<Reporter> reporters;
- private final List<AutoCloseable> closeables;
-
- public ShutdownHookRunner(
- Collection<Profiler> profilers,
- Collection<Reporter> reporters,
- Collection<AutoCloseable> objectsToCloseOnShutdown) {
- this.profilers = profilers == null ? new ArrayList<>() : new ArrayList<>(profilers);
- this.reporters = reporters == null ? new ArrayList<>() : new ArrayList<>(reporters);
- this.closeables =
- objectsToCloseOnShutdown == null ? new ArrayList<>() : new ArrayList<>(objectsToCloseOnShutdown);
- }
-
- @Override
- public void run() {
- logShutdownMessage("Running java agent shutdown");
-
- for (Profiler profiler : profilers) {
- try {
- logShutdownMessage("Running periodic profiler (last run): " + profiler);
- profiler.profile();
- logShutdownMessage("Ran periodic profiler (last run): " + profiler);
- } catch (Throwable ex) {
- LOGGER.warn("Failed to run periodic profiler (last run): " + profiler, ex);
- }
- }
-
- for (Reporter r : reporters) {
- try {
- logShutdownMessage("Closing reporter " + r);
- r.close();
- logShutdownMessage("Closed reporter " + r);
- } catch (Throwable ex) {
- LOGGER.warn(
- "Failed to close reporter " + r + ", " + new Date() + ", " + System.currentTimeMillis(),
- ex);
- }
- }
-
- for (AutoCloseable closeable : closeables) {
- // Do not use logger.warn here because the logger may depend on error log reporter which will
- // be already closed here.
- // So we use logShutdownMessage (System.out.println) to print out logs.
- try {
- logShutdownMessage("Closing object " + closeable);
- closeable.close();
- logShutdownMessage("Closed object " + closeable);
- } catch (Throwable ex) {
- logShutdownMessage("Failed to close object " + closeable);
- ex.printStackTrace();
- }
- }
- }
-
- private void logShutdownMessage(String msg) {
- // Sometime spark log in console output seems not fully collected, thus log to error output as
- // well to make sure
- // we capture this shutdown hook execution. This is to help debug some issue when shutdown hook
- // seems not executed.
- String log = System.currentTimeMillis() + " " + msg;
- System.out.println(log);
- System.err.println(log);
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/YamlConfigProvider.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/YamlConfigProvider.java
deleted file mode 100644
index 5d7b24f73..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/YamlConfigProvider.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling;
-
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.ExponentialBackoffRetryPolicy;
-import org.apache.streampark.plugin.profiling.util.Utils;
-
-import org.yaml.snakeyaml.Yaml;
-import scalaj.http.Http;
-import scalaj.http.HttpResponse;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class YamlConfigProvider implements ConfigProvider {
- private static final AgentLogger LOGGER =
- AgentLogger.getLogger(YamlConfigProvider.class.getName());
-
- private static final String OVERRIDE_KEY = "override";
-
- private String filePath;
-
- public YamlConfigProvider() {
- }
-
- public YamlConfigProvider(String filePath) {
- setFilePath(filePath);
- }
-
- public void setFilePath(String filePath) {
- if (filePath == null || filePath.isEmpty()) {
- throw new IllegalArgumentException("filePath cannot be null or empty");
- }
-
- this.filePath = filePath;
- }
-
- @Override
- public Map<String, Map<String, List<String>>> getConfig() {
- return getConfig(filePath);
- }
-
- private static Map<String, Map<String, List<String>>> getConfig(String configFilePathOrUrl) {
- if (configFilePathOrUrl == null || configFilePathOrUrl.isEmpty()) {
- LOGGER.warn("Empty YAML config file path");
- return new HashMap<>();
- }
-
- byte[] bytes;
-
- try {
- bytes =
- new ExponentialBackoffRetryPolicy<byte[]>(3, 100)
- .attempt(
- () -> {
- String filePathLowerCase = configFilePathOrUrl.toLowerCase();
- if (filePathLowerCase.startsWith("http://")
- || filePathLowerCase.startsWith("https://")) {
- return getHttp(configFilePathOrUrl);
- } else {
- return Files.readAllBytes(Paths.get(configFilePathOrUrl));
- }
- });
-
- LOGGER.info("Read YAML config from: " + configFilePathOrUrl);
- } catch (Throwable e) {
- LOGGER.warn("Failed to read file: " + configFilePathOrUrl, e);
- return new HashMap<>();
- }
-
- if (bytes == null || bytes.length == 0) {
- return new HashMap<>();
- }
-
- Map<String, Map<String, List<String>>> result = new HashMap<>();
-
- try {
- try (ByteArrayInputStream stream = new ByteArrayInputStream(bytes)) {
- Yaml yaml = new Yaml();
- Object yamlObj = yaml.load(stream);
-
- if (!(yamlObj instanceof Map)) {
- LOGGER.warn("Invalid YAML config content: " + yamlObj);
- return result;
- }
-
- Map yamlMap = (Map) yamlObj;
-
- Map overrideMap = null;
-
- for (Object key : yamlMap.keySet()) {
- String configKey = key.toString();
- Object valueObj = yamlMap.get(key);
- if (valueObj == null) {
- continue;
- }
-
- if (configKey.equals(OVERRIDE_KEY)) {
- if (valueObj instanceof Map) {
- overrideMap = (Map) valueObj;
- } else {
- LOGGER.warn("Invalid override property: " + valueObj);
- }
- } else {
- addConfig(result, "", configKey, valueObj);
- }
- }
-
- if (overrideMap != null) {
- for (Object key : overrideMap.keySet()) {
- String overrideKey = key.toString();
- Object valueObj = overrideMap.get(key);
- if (valueObj == null) {
- continue;
- }
-
- if (!(valueObj instanceof Map)) {
- LOGGER.warn("Invalid override section: " + key + ": " + valueObj);
- continue;
- }
-
- Map<Object, Object> overrideValues = (Map<Object, Object>) valueObj;
- for (Map.Entry<Object, Object> entry : overrideValues.entrySet()) {
- if (entry.getValue() == null) {
- continue;
- }
- String configKey = entry.getKey().toString();
- addConfig(result, overrideKey, configKey, entry.getValue());
- }
- }
- }
-
- return result;
- }
- } catch (Throwable e) {
- LOGGER.warn("Failed to read config file: " + configFilePathOrUrl, e);
- return new HashMap<>();
- }
- }
-
- private static void addConfig(
- Map<String, Map<String, List<String>>> config, String override, String key, Object value) {
- Map<String, List<String>> configMap = config.computeIfAbsent(override, k -> new HashMap<>());
-
- if (value instanceof List) {
- List<String> configValueList = configMap.computeIfAbsent(key, k -> new ArrayList<>());
- for (Object entry : (List) value) {
- configValueList.add(entry.toString());
- }
- } else if (value instanceof Object[]) {
- List<String> configValueList = configMap.computeIfAbsent(key, k -> new ArrayList<>());
- for (Object entry : (Object[]) value) {
- configValueList.add(entry.toString());
- }
- } else if (value instanceof Map) {
- for (Object mapKey : ((Map) value).keySet()) {
- String propKey = mapKey.toString();
- Object propValue = ((Map) value).get(propKey);
- if (propValue != null) {
- addConfig(config, override, key + "." + propKey, propValue);
- }
- }
- } else {
- List<String> configValueList = configMap.computeIfAbsent(key, k -> new ArrayList<>());
- configValueList.add(value.toString());
- }
- }
-
- private static byte[] getHttp(String url) {
- try {
- LOGGER.debug(String.format("Getting url: %s", url));
- HttpResponse response = Http.apply(url).timeout(1000, 5000).asString();
- if (response.isError()) {
- throw new RuntimeException(
- "Failed response from url: " + url + ", response code: " + response.code());
- }
- return Utils.toByteArray((InputStream) response.body());
- } catch (Throwable ex) {
- throw new RuntimeException("Failed getting url: " + url, ex);
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/example/HelloWorldApplication.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/example/HelloWorldApplication.java
deleted file mode 100644
index c6cceb248..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/example/HelloWorldApplication.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.example;
-
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicLong;
-
-public class HelloWorldApplication {
-
- /**
- * This application could be used to test the java agent. For example, you could run it with
- * following argument:
- * -javaagent:target/jvm-profiler-1.0.0.jar=reporter=org.apache.streampark.plugin.profiling.reporter.ConsoleOutputReporter,tag=tag1,metricInterval=10000,durationProfiling=org.apache.streampark.plugin.profiling.example.HelloWorldApplication.*
- */
- public static void main(String[] args) throws Throwable {
- long totalRunningMillis = 60 * 1000;
- long sleepMillis = 1000;
-
- if (args.length >= 1) {
- totalRunningMillis = Long.parseLong(args[0]);
- }
-
- if (args.length >= 2) {
- sleepMillis = Long.parseLong(args[1]);
- }
-
- long startMillis = System.currentTimeMillis();
- long lastPrintMillis = 0;
-
- Random random = new Random();
-
- while (System.currentTimeMillis() - startMillis < totalRunningMillis) {
- if (System.currentTimeMillis() - lastPrintMillis >= 10000) {
- lastPrintMillis = System.currentTimeMillis();
- }
-
- sleepMillis += random.nextInt(100);
- sleepMillis -= random.nextInt(100);
-
- privateSleepMethod(sleepMillis);
-
- AtomicLong atomicLong = new AtomicLong(sleepMillis);
- publicSleepMethod(atomicLong);
- }
- }
-
- private static void privateSleepMethod(long millis) {
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static void publicSleepMethod(AtomicLong millis) {
- try {
- Thread.sleep(millis.get());
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/Constants.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/Constants.java
deleted file mode 100644
index 942114517..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/Constants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-public class Constants {
- public static final long DEFAULT_METRIC_INTERVAL = 60000;
-
- public static final int MAX_STRING_LENGTH = 800000;
-
- public static final String EXECUTOR_ROLE = "executor";
- public static final String DRIVER_ROLE = "driver";
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/CpuAndMemoryProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/CpuAndMemoryProfiler.java
deleted file mode 100644
index 332811019..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/CpuAndMemoryProfiler.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.ProcFileUtils;
-
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import java.lang.management.BufferPoolMXBean;
-import java.lang.management.GarbageCollectorMXBean;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.management.MemoryUsage;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class CpuAndMemoryProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "CpuAndMemory";
-
- private static final AgentLogger LOGGER =
- AgentLogger.getLogger(CpuAndMemoryProfiler.class.getName());
-
- private static final String ATTRIBUTE_NAME_PROCESS_CPU_LOAD = "ProcessCpuLoad";
- private static final int ATTRIBUTE_INDEX_PROCESS_CPU_LOAD = 0;
-
- private static final String ATTRIBUTE_NAME_SYSTEM_CPU_LOAD = "SystemCpuLoad";
- private static final int ATTRIBUTE_INDEX_SYSTEM_CPU_LOAD = 1;
-
- private static final String ATTRIBUTE_NAME_PROCESS_CPU_TIME = "ProcessCpuTime";
- private static final int ATTRIBUTE_INDEX_PROCESS_CPU_TIME = 2;
-
- private long interval = Constants.DEFAULT_METRIC_INTERVAL;
-
- private MBeanServer platformMBeanServer;
- private ObjectName operatingSystemObjectName;
-
- private MemoryMXBean memoryMXBean;
-
- private Reporter reporter;
-
- public CpuAndMemoryProfiler(Reporter reporter) {
- setReporter(reporter);
-
- init();
- }
-
- @Override
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public synchronized void profile() {
- Double processCpuLoad = null;
- Double systemCpuLoad = null;
- Long processCpuTime = null;
-
- AttributeList cpuAttributes = getCpuAttributes();
- if (cpuAttributes != null && cpuAttributes.size() > 0) {
- Attribute att = (Attribute) cpuAttributes.get(ATTRIBUTE_INDEX_PROCESS_CPU_LOAD);
- processCpuLoad = (Double) att.getValue();
- if (processCpuLoad == Double.NaN) {
- processCpuLoad = null;
- }
-
- att = (Attribute) cpuAttributes.get(ATTRIBUTE_INDEX_SYSTEM_CPU_LOAD);
- systemCpuLoad = (Double) att.getValue();
- if (systemCpuLoad == Double.NaN) {
- systemCpuLoad = null;
- }
-
- att = (Attribute) cpuAttributes.get(ATTRIBUTE_INDEX_PROCESS_CPU_TIME);
- processCpuTime = (Long) att.getValue();
- }
-
- Double heapMemoryTotalUsed = null;
- Double heapMemoryCommitted = null;
- Double heapMemoryMax = null;
-
- Double nonHeapMemoryTotalUsed = null;
- Double nonHeapMemoryCommitted = null;
- Double nonHeapMemoryMax = null;
-
- if (memoryMXBean != null) {
- MemoryUsage memoryUsage = memoryMXBean.getHeapMemoryUsage();
- heapMemoryTotalUsed = new Double(memoryUsage.getUsed());
- heapMemoryCommitted = new Double(memoryUsage.getCommitted());
- heapMemoryMax = new Double(memoryUsage.getMax());
-
- memoryUsage = memoryMXBean.getNonHeapMemoryUsage();
- nonHeapMemoryTotalUsed = new Double(memoryUsage.getUsed());
- nonHeapMemoryCommitted = new Double(memoryUsage.getCommitted());
- nonHeapMemoryMax = new Double(memoryUsage.getMax());
- }
-
- List<Map<String, Object>> gcMetrics = new ArrayList<>();
-
- List<GarbageCollectorMXBean> gcMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
-
- if (gcMXBeans != null) {
- for (GarbageCollectorMXBean gcMXBean : gcMXBeans) {
- Map<String, Object> gcMap = new HashMap<>();
- gcMap.put("name", gcMXBean.getName());
- gcMap.put("collectionCount", Long.valueOf(gcMXBean.getCollectionCount()));
- gcMap.put("collectionTime", Long.valueOf(gcMXBean.getCollectionTime()));
-
- gcMetrics.add(gcMap);
- }
- }
-
- List<Map<String, Object>> memoryPoolsMetrics = new ArrayList<>();
-
- for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) {
- Map<String, Object> memoryPoolMap = new HashMap<>();
-
- memoryPoolMap.put("name", pool.getName());
- memoryPoolMap.put("type", pool.getType().toString());
- memoryPoolMap.put("usageCommitted", pool.getUsage().getCommitted());
- memoryPoolMap.put("usageMax", pool.getUsage().getMax());
- memoryPoolMap.put("usageUsed", pool.getUsage().getUsed());
- memoryPoolMap.put("peakUsageCommitted", pool.getPeakUsage().getCommitted());
- memoryPoolMap.put("peakUsageMax", pool.getPeakUsage().getMax());
- memoryPoolMap.put("peakUsageUsed", pool.getPeakUsage().getUsed());
-
- memoryPoolsMetrics.add(memoryPoolMap);
- }
-
- List<Map<String, Object>> bufferPoolsMetrics = new ArrayList<>();
-
- List<BufferPoolMXBean> bufferPools =
- ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
- if (bufferPools != null) {
- for (BufferPoolMXBean pool : bufferPools) {
- Map<String, Object> bufferPoolMap = new HashMap<>();
-
- bufferPoolMap.put("name", pool.getName());
- bufferPoolMap.put("count", Long.valueOf(pool.getCount()));
- bufferPoolMap.put("memoryUsed", Long.valueOf(pool.getMemoryUsed()));
- bufferPoolMap.put("totalCapacity", Long.valueOf(pool.getTotalCapacity()));
-
- bufferPoolsMetrics.add(bufferPoolMap);
- }
- }
-
- // See http://man7.org/linux/man-pages/man5/proc.5.html for details about proc status
- Map<String, String> procStatus = ProcFileUtils.getProcStatus();
- Long procStatusVmRSS = ProcFileUtils.getBytesValue(procStatus, "VmRSS");
- Long procStatusVmHWM = ProcFileUtils.getBytesValue(procStatus, "VmHWM");
- Long procStatusVmSize = ProcFileUtils.getBytesValue(procStatus, "VmSize");
- Long procStatusVmPeak = ProcFileUtils.getBytesValue(procStatus, "VmPeak");
-
- Map<String, Object> map = new HashMap<String, Object>();
-
- map.put("epochMillis", System.currentTimeMillis());
- map.put("name", getProcessName());
- map.put("host", getHostName());
- map.put("processUuid", getProcessUuid());
- map.put("appId", getAppId());
-
- if (getTag() != null) {
- map.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- map.put("cluster", getCluster());
- }
-
- if (getRole() != null) {
- map.put("role", getRole());
- }
-
- map.put("processCpuLoad", processCpuLoad);
- map.put("systemCpuLoad", systemCpuLoad);
- map.put("processCpuTime", processCpuTime);
-
- map.put("heapMemoryTotalUsed", heapMemoryTotalUsed);
- map.put("heapMemoryCommitted", heapMemoryCommitted);
- map.put("heapMemoryMax", heapMemoryMax);
-
- map.put("nonHeapMemoryTotalUsed", nonHeapMemoryTotalUsed);
- map.put("nonHeapMemoryCommitted", nonHeapMemoryCommitted);
- map.put("nonHeapMemoryMax", nonHeapMemoryMax);
-
- map.put("gc", gcMetrics);
-
- map.put("memoryPools", memoryPoolsMetrics);
- map.put("bufferPools", bufferPoolsMetrics);
-
- if (procStatusVmRSS != null) {
- map.put("vmRSS", procStatusVmRSS);
- }
- if (procStatusVmHWM != null) {
- map.put("vmHWM", procStatusVmHWM);
- }
- if (procStatusVmSize != null) {
- map.put("vmSize", procStatusVmSize);
- }
- if (procStatusVmPeak != null) {
- map.put("vmPeak", procStatusVmPeak);
- }
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, map);
- }
- }
-
- private void init() {
- try {
- platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
- operatingSystemObjectName = ObjectName.getInstance("java.lang:type=OperatingSystem");
- } catch (Throwable ex) {
- LOGGER.warn("Failed to get Operation System MBean", ex);
- }
-
- try {
- memoryMXBean = ManagementFactory.getMemoryMXBean();
- } catch (Throwable ex) {
- LOGGER.warn("Failed to get Memory MBean", ex);
- }
- }
-
- private AttributeList getCpuAttributes() {
- try {
- String[] names =
- new String[]{
- ATTRIBUTE_NAME_PROCESS_CPU_LOAD,
- ATTRIBUTE_NAME_SYSTEM_CPU_LOAD,
- ATTRIBUTE_NAME_PROCESS_CPU_TIME
- };
- AttributeList list = platformMBeanServer.getAttributes(operatingSystemObjectName, names);
- if (list.size() != names.length) {
- LOGGER.warn("Failed to get all attributes");
- return new AttributeList();
- }
- return list;
- } catch (Throwable ex) {
- LOGGER.warn("Failed to get CPU MBean attributes", ex);
- return null;
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/IOProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/IOProfiler.java
deleted file mode 100644
index c68e02be3..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/IOProfiler.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.ProcFileUtils;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class IOProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "IO";
-
- private long interval = Constants.DEFAULT_METRIC_INTERVAL;
-
- private Reporter reporter;
-
- public IOProfiler(Reporter reporter) {
- setReporter(reporter);
- }
-
- @Override
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public synchronized void profile() {
- // See http://man7.org/linux/man-pages/man5/proc.5.html for details about /proc/[pid]/io
- Map<String, String> procMap = ProcFileUtils.getProcIO();
- Long rchar = ProcFileUtils.getBytesValue(procMap, "rchar");
- Long wchar = ProcFileUtils.getBytesValue(procMap, "wchar");
- Long readBytes = ProcFileUtils.getBytesValue(procMap, "read_bytes");
- Long writeBytes = ProcFileUtils.getBytesValue(procMap, "write_bytes");
-
- List<Map<String, Object>> cpuTime = ProcFileUtils.getProcStatCpuTime();
-
- Map<String, Object> map = new HashMap<>();
-
- map.put("epochMillis", System.currentTimeMillis());
- map.put("name", getProcessName());
- map.put("host", getHostName());
- map.put("processUuid", getProcessUuid());
- map.put("appId", getAppId());
-
- if (getTag() != null) {
- map.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- map.put("cluster", getCluster());
- }
-
- if (getRole() != null) {
- map.put("role", getRole());
- }
-
- Map<String, Object> selfMap = new HashMap<String, Object>();
- map.put("self", selfMap);
-
- Map<String, Object> ioMap = new HashMap<String, Object>();
- selfMap.put("io", ioMap);
-
- ioMap.put("rchar", rchar);
- ioMap.put("wchar", wchar);
- ioMap.put("read_bytes", readBytes);
- ioMap.put("write_bytes", writeBytes);
-
- map.put("stat", cpuTime);
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, map);
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodArgumentCollector.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodArgumentCollector.java
deleted file mode 100644
index b4b07c66f..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodArgumentCollector.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.util.ClassMethodArgumentMetricBuffer;
-
-public class MethodArgumentCollector {
- private final ClassMethodArgumentMetricBuffer buffer;
-
- public MethodArgumentCollector(ClassMethodArgumentMetricBuffer buffer) {
- this.buffer = buffer;
- }
-
- public void collectMetric(String className, String methodName, String argument) {
- if (argument == null) {
- argument = "";
- }
-
- if (argument.length() > Constants.MAX_STRING_LENGTH) {
- argument = argument.substring(0, Constants.MAX_STRING_LENGTH);
- }
-
- buffer.appendValue(className, methodName, argument);
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodArgumentProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodArgumentProfiler.java
deleted file mode 100644
index dc11dbd60..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodArgumentProfiler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.reporter.ConsoleOutputReporter;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethodMetricKey;
-import org.apache.streampark.plugin.profiling.util.ClassMethodArgumentMetricBuffer;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-public class MethodArgumentProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "MethodArgument";
-
- private final ClassMethodArgumentMetricBuffer buffer;
-
- private Reporter reporter = new ConsoleOutputReporter();
-
- private long interval = Constants.DEFAULT_METRIC_INTERVAL;
-
- public MethodArgumentProfiler(ClassMethodArgumentMetricBuffer buffer, Reporter reporter) {
- this.buffer = buffer;
- this.reporter = reporter;
- }
-
- @Override
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public void profile() {
- if (buffer == null) {
- return;
- }
-
- if (reporter == null) {
- return;
- }
-
- Map<ClassAndMethodMetricKey, AtomicLong> metrics = buffer.reset();
-
- long epochMillis = System.currentTimeMillis();
-
- for (Map.Entry<ClassAndMethodMetricKey, AtomicLong> entry : metrics.entrySet()) {
- Map<String, Object> commonMap = new HashMap<>();
-
- commonMap.put("epochMillis", epochMillis);
- commonMap.put("processName", getProcessName());
- commonMap.put("host", getHostName());
- commonMap.put("processUuid", getProcessUuid());
- commonMap.put("appId", getAppId());
-
- commonMap.put("className", entry.getKey().getClassName());
- commonMap.put("methodName", entry.getKey().getMethodName());
-
- if (getTag() != null) {
- commonMap.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- commonMap.put("cluster", getCluster());
- }
-
- if (getRole() != null) {
- commonMap.put("role", getRole());
- }
-
- {
- Map<String, Object> metricMap = new HashMap<>(commonMap);
- metricMap.put("metricName", entry.getKey().getMetricName());
- metricMap.put("metricValue", (double) entry.getValue().get());
- reporter.report(PROFILER_NAME, metricMap);
- }
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodDurationCollector.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodDurationCollector.java
deleted file mode 100644
index 14ae03d62..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodDurationCollector.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.util.ClassAndMethodLongMetricBuffer;
-
-public class MethodDurationCollector {
- private final ClassAndMethodLongMetricBuffer buffer;
-
- public MethodDurationCollector(ClassAndMethodLongMetricBuffer buffer) {
- this.buffer = buffer;
- }
-
- public void collectLongMetric(
- String className, String methodName, String metricName, long metricValue) {
- buffer.appendValue(className, methodName, metricName, metricValue);
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodDurationProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodDurationProfiler.java
deleted file mode 100644
index 2eb8dc8ef..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/MethodDurationProfiler.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.reporter.ConsoleOutputReporter;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethodLongMetricBuffer;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethodMetricKey;
-import org.apache.streampark.plugin.profiling.util.Histogram;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MethodDurationProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "MethodDuration";
-
- private final ClassAndMethodLongMetricBuffer buffer;
-
- private Reporter reporter = new ConsoleOutputReporter();
-
- private long interval = Constants.DEFAULT_METRIC_INTERVAL;
-
- public MethodDurationProfiler(ClassAndMethodLongMetricBuffer buffer, Reporter reporter) {
- this.buffer = buffer;
- this.reporter = reporter;
- }
-
- @Override
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public void profile() {
- if (buffer == null) {
- return;
- }
-
- if (reporter == null) {
- return;
- }
-
- Map<ClassAndMethodMetricKey, Histogram> metrics = buffer.reset();
-
- long epochMillis = System.currentTimeMillis();
-
- for (Map.Entry<ClassAndMethodMetricKey, Histogram> entry : metrics.entrySet()) {
- Map<String, Object> commonMap = new HashMap<>();
-
- commonMap.put("epochMillis", epochMillis);
- commonMap.put("processName", getProcessName());
- commonMap.put("host", getHostName());
- commonMap.put("processUuid", getProcessUuid());
- commonMap.put("appId", getAppId());
-
- commonMap.put("className", entry.getKey().getClassName());
- commonMap.put("methodName", entry.getKey().getMethodName());
-
- if (getTag() != null) {
- commonMap.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- commonMap.put("cluster", getCluster());
- }
-
- if (getRole() != null) {
- commonMap.put("role", getRole());
- }
-
- {
- Map<String, Object> metricMap = new HashMap<>(commonMap);
- metricMap.put("metricName", entry.getKey().getMetricName() + ".count");
- metricMap.put("metricValue", (double) entry.getValue().getCount());
- reporter.report(PROFILER_NAME, metricMap);
- }
- {
- Map<String, Object> metricMap = new HashMap<>(commonMap);
- metricMap.put("metricName", entry.getKey().getMetricName() + ".sum");
- metricMap.put("metricValue", (double) entry.getValue().getSum());
- reporter.report(PROFILER_NAME, metricMap);
- }
- {
- Map<String, Object> metricMap = new HashMap<>(commonMap);
- metricMap.put("metricName", entry.getKey().getMetricName() + ".min");
- metricMap.put("metricValue", (double) entry.getValue().getMin());
- reporter.report(PROFILER_NAME, metricMap);
- }
- {
- Map<String, Object> metricMap = new HashMap<>(commonMap);
- metricMap.put("metricName", entry.getKey().getMetricName() + ".max");
- metricMap.put("metricValue", (double) entry.getValue().getMax());
- reporter.report(PROFILER_NAME, metricMap);
- }
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ProcessInfoProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ProcessInfoProfiler.java
deleted file mode 100644
index 1182142de..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ProcessInfoProfiler.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.AgentImpl;
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.ProcFileUtils;
-import org.apache.streampark.plugin.profiling.util.ProcessUtils;
-import org.apache.streampark.plugin.profiling.util.SparkAppCmdInfo;
-import org.apache.streampark.plugin.profiling.util.SparkUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ProcessInfoProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "ProcessInfo";
-
- private String jvmInputArguments = "";
- private String jvmClassPath = "";
- private Long jvmXmxBytes = null;
- private String cmdline = "";
-
- private Reporter reporter;
-
- public ProcessInfoProfiler(Reporter reporter) {
- setReporter(reporter);
-
- init();
- }
-
- @Override
- public long getInterval() {
- return 0;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public void profile() {
- Map<String, Object> map = new HashMap<String, Object>();
-
- map.put("agentVersion", AgentImpl.VERSION);
-
- map.put("epochMillis", System.currentTimeMillis());
- map.put("name", getProcessName());
- map.put("host", getHostName());
- map.put("processUuid", getProcessUuid());
- map.put("appId", getAppId());
-
- if (getTag() != null) {
- map.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- map.put("cluster", getCluster());
- }
-
- // TODO support non spark application
- // TODO also possible to use SparkContext to get spark jar/class info
-
- SparkAppCmdInfo cmdInfo = SparkUtils.probeCmdInfo();
- if (cmdInfo != null) {
- map.put("appJar", cmdInfo.getAppJar());
- map.put("appClass", cmdInfo.getAppClass());
-
- // TODO add app arguments
- }
-
- if (getRole() != null) {
- map.put("role", getRole());
- }
-
- if (jvmXmxBytes != null) {
- map.put("xmxBytes", jvmXmxBytes);
- }
-
- String jvmInputArgumentsToReport = jvmInputArguments;
- String jvmClassPathToReport = jvmClassPath;
-
- // Do not report jvmInputArguments and jvmClassPath if cmdline is not empty.
- // This is because cmdline will contain duplicate information for
- // jvmInputArguments/jvmClassPath.
- if (!cmdline.isEmpty()) {
- jvmInputArgumentsToReport = "";
- jvmClassPathToReport = "";
- }
-
- if (jvmInputArgumentsToReport.length() + jvmClassPathToReport.length() + cmdline.length() <= Constants.MAX_STRING_LENGTH) {
- map.put("jvmInputArguments", jvmInputArgumentsToReport);
- map.put("jvmClassPath", jvmClassPathToReport);
- map.put("cmdline", cmdline);
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, map);
- }
- } else {
- List<String> jvmInputArgumentsFragements =
- org.apache.streampark.plugin.profiling.util.StringUtils.splitByLength(
- jvmInputArgumentsToReport, Constants.MAX_STRING_LENGTH);
- List<String> jvmClassPathFragements =
- org.apache.streampark.plugin.profiling.util.StringUtils.splitByLength(
- jvmClassPathToReport, Constants.MAX_STRING_LENGTH);
- List<String> cmdlineFragements =
- org.apache.streampark.plugin.profiling.util.StringUtils.splitByLength(
- cmdline, Constants.MAX_STRING_LENGTH);
-
- long fragmentSeq = 0;
- long fragmentCount =
- jvmInputArgumentsFragements.size()
- + jvmClassPathFragements.size()
- + cmdlineFragements.size();
-
- for (String entry : jvmInputArgumentsFragements) {
- Map<String, Object> fragmentMap = createFragmentMap(map, fragmentSeq++, fragmentCount);
- fragmentMap.put("jvmInputArguments", entry);
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, fragmentMap);
- }
- }
-
- for (String entry : jvmClassPathFragements) {
- Map<String, Object> fragmentMap = createFragmentMap(map, fragmentSeq++, fragmentCount);
- fragmentMap.put("jvmClassPath", entry);
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, fragmentMap);
- }
- }
-
- for (String entry : cmdlineFragements) {
- Map<String, Object> fragmentMap = createFragmentMap(map, fragmentSeq++, fragmentCount);
- fragmentMap.put("cmdline", entry);
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, fragmentMap);
- }
- }
- }
- }
-
- private void init() {
- jvmInputArguments = StringUtils.join(ProcessUtils.getJvmInputArguments(), " ");
- jvmClassPath = ProcessUtils.getJvmClassPath();
- jvmXmxBytes = ProcessUtils.getJvmXmxBytes();
-
- cmdline = ProcFileUtils.getCmdline();
- if (cmdline == null) {
- cmdline = "";
- }
- }
-
- private Map<String, Object> createFragmentMap(
- Map<String, Object> copyFrom, long fragmentSeq, long fragmentCount) {
- Map<String, Object> fragmentMap = new HashMap<String, Object>(copyFrom);
- fragmentMap.put("fragmentSeq", fragmentSeq);
- fragmentMap.put("fragmentCount", fragmentCount);
- fragmentMap.put("jvmInputArguments", "");
- fragmentMap.put("jvmClassPath", "");
- fragmentMap.put("cmdline", "");
-
- return fragmentMap;
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ProfilerBase.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ProfilerBase.java
deleted file mode 100644
index d886aee6e..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ProfilerBase.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.util.ProcFileUtils;
-import org.apache.streampark.plugin.profiling.util.ProcessUtils;
-import org.apache.streampark.plugin.profiling.util.SparkUtils;
-import org.apache.streampark.plugin.profiling.util.Utils;
-
-import java.util.UUID;
-
-public class ProfilerBase {
- private String tag = null;
- private String cluster = null;
- private String hostName = null;
- private String processName = null;
- private String processUuid = UUID.randomUUID().toString();
-
- private String jobId = null;
- private String appId = null;
-
- private String role = null;
-
- public ProfilerBase() {
- setHostName(Utils.getLocalHostName());
- setProcessName(ProcessUtils.getCurrentProcessName());
- }
-
- public String getTag() {
- return tag;
- }
-
- public void setTag(String tag) {
- this.tag = tag;
- }
-
- public String getCluster() {
- return cluster;
- }
-
- public void setCluster(String cluster) {
- this.cluster = cluster;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String getProcessName() {
- return processName;
- }
-
- public void setProcessName(String processName) {
- this.processName = processName;
- }
-
- public String getProcessUuid() {
- return processUuid;
- }
-
- public void setProcessUuid(String processUuid) {
- this.processUuid = processUuid;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public String getAppId() {
- if (appId != null && !appId.isEmpty()) {
- return appId;
- }
-
- appId = SparkUtils.getSparkEnvAppId();
- return appId;
- }
-
- public void setAppId(String appId) {
- this.appId = appId;
- }
-
- public void setRole(String role) {
- this.role = role;
- }
-
- public String getRole() {
- if (role != null && !role.isEmpty()) {
- return role;
- }
-
- String cmdline = ProcFileUtils.getCmdline();
- role = SparkUtils.probeRole(cmdline);
- return role;
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/StacktraceCollectorProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/StacktraceCollectorProfiler.java
deleted file mode 100644
index 189d73201..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/StacktraceCollectorProfiler.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethod;
-import org.apache.streampark.plugin.profiling.util.Stacktrace;
-import org.apache.streampark.plugin.profiling.util.StacktraceMetricBuffer;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This class collects stacktraces by getting thread dump via JMX, and stores the stacktraces into
- * the given buffer.
- *
- */
-public class StacktraceCollectorProfiler implements Profiler {
- private long interval;
- private final StacktraceMetricBuffer buffer;
- private String ignoreThreadNamePrefix = "";
- private int maxStringLength = Constants.MAX_STRING_LENGTH;
- private final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
-
- public StacktraceCollectorProfiler(StacktraceMetricBuffer buffer, String ignoreThreadNamePrefix) {
- this(buffer, ignoreThreadNamePrefix, Constants.MAX_STRING_LENGTH);
- }
-
- public StacktraceCollectorProfiler(
- StacktraceMetricBuffer buffer, String ignoreThreadNamePrefix, int maxStringLength) {
- this.buffer = buffer;
- this.ignoreThreadNamePrefix = ignoreThreadNamePrefix == null ? "" : ignoreThreadNamePrefix;
- this.maxStringLength = maxStringLength;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public long getInterval() {
- return this.interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- }
-
- @Override
- public void profile() {
- ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false, false);
- if (threadInfos == null) {
- return;
- }
-
- for (ThreadInfo threadInfo : threadInfos) {
- String threadName = threadInfo.getThreadName();
- if (threadName == null) {
- threadName = "";
- }
-
- if (!ignoreThreadNamePrefix.isEmpty() && threadName.startsWith(ignoreThreadNamePrefix)) {
- continue;
- }
-
- StackTraceElement[] stackTraceElements = threadInfo.getStackTrace();
-
- Stacktrace stacktrace = new Stacktrace();
- stacktrace.setThreadName(threadName);
- stacktrace.setThreadState(String.valueOf(threadInfo.getThreadState()));
-
- // Start from bottom of the stacktrace so we could trim top method (most nested method) if the
- // size is too large
- int totalLength = 0;
- List<ClassAndMethod> stack = new ArrayList<>(stackTraceElements.length);
- for (int i = stackTraceElements.length - 1; i >= 0; i--) {
- StackTraceElement stackTraceElement = stackTraceElements[i];
- String className = stackTraceElement.getClassName();
- String methodName = stackTraceElement.getMethodName();
- stack.add(new ClassAndMethod(className, methodName));
-
- totalLength += className.length() + methodName.length();
-
- if (totalLength >= maxStringLength) {
- stack.add(new ClassAndMethod("_stack_", "_trimmed_"));
- break;
- }
- }
-
- // Reverse the stack so the top method (most nested method) is the first element of the array
- ClassAndMethod[] classAndMethodArray = new ClassAndMethod[stack.size()];
- for (int i = 0; i < stack.size(); i++) {
- classAndMethodArray[classAndMethodArray.length - 1 - i] = stack.get(i);
- }
-
- stacktrace.setStack(classAndMethodArray);
-
- buffer.appendValue(stacktrace);
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/StacktraceReporterProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/StacktraceReporterProfiler.java
deleted file mode 100644
index b68697123..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/StacktraceReporterProfiler.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.reporter.ConsoleOutputReporter;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethod;
-import org.apache.streampark.plugin.profiling.util.Stacktrace;
-import org.apache.streampark.plugin.profiling.util.StacktraceMetricBuffer;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * This class reads the stacktraces from the given buffer and send out via given reporter.
- */
-public class StacktraceReporterProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "Stacktrace";
-
- private final StacktraceMetricBuffer buffer;
-
- private Reporter reporter = new ConsoleOutputReporter();
-
- private long interval = Constants.DEFAULT_METRIC_INTERVAL;
-
- public StacktraceReporterProfiler(StacktraceMetricBuffer buffer, Reporter reporter) {
- this.buffer = buffer;
- this.reporter = reporter;
- }
-
- @Override
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public void profile() {
- if (buffer == null) {
- return;
- }
-
- if (reporter == null) {
- return;
- }
-
- long startEpoch = buffer.getLastResetMillis();
-
- Map<Stacktrace, AtomicLong> metrics = buffer.reset();
-
- long endEpoch = buffer.getLastResetMillis();
-
- for (Map.Entry<Stacktrace, AtomicLong> entry : metrics.entrySet()) {
- Map<String, Object> map = new HashMap<>();
-
- map.put("startEpoch", startEpoch);
- map.put("endEpoch", endEpoch);
-
- map.put("host", getHostName());
- map.put("name", getProcessName());
- map.put("processUuid", getProcessUuid());
- map.put("appId", getAppId());
-
- if (getTag() != null) {
- map.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- map.put("cluster", getCluster());
- }
-
- if (getRole() != null) {
- map.put("role", getRole());
- }
-
- Stacktrace stacktrace = entry.getKey();
-
- map.put("threadName", stacktrace.getThreadName());
- map.put("threadState", stacktrace.getThreadState());
-
- ClassAndMethod[] classAndMethodArray = stacktrace.getStack();
- if (classAndMethodArray != null) {
- List<String> stackArray = new ArrayList<>(classAndMethodArray.length);
- for (int i = 0; i < classAndMethodArray.length; i++) {
- ClassAndMethod classAndMethod = classAndMethodArray[i];
- stackArray.add(classAndMethod.getClassName() + "." + classAndMethod.getMethodName());
- }
- map.put("stacktrace", stackArray);
- }
-
- map.put("count", entry.getValue().get());
-
- reporter.report(PROFILER_NAME, map);
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ThreadInfoProfiler.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ThreadInfoProfiler.java
deleted file mode 100644
index 6f744b9e1..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/profiler/ThreadInfoProfiler.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.profiler;
-
-import org.apache.streampark.plugin.profiling.Profiler;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadMXBean;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * ThreadInfoProfiler is used to Collects the Thread Related Metrics.
- *
- */
-public class ThreadInfoProfiler extends ProfilerBase implements Profiler {
- public static final String PROFILER_NAME = "ThreadInfo";
- public static final AgentLogger LOGGER =
- AgentLogger.getLogger(ThreadInfoProfiler.class.getName());
- private long interval = Constants.DEFAULT_METRIC_INTERVAL;
-
- private ThreadMXBean threadMXBean;
- /**
- * to keep track of Total Thread.
- */
- private long previousTotalStartedThreadCount = 0L;
-
- private Reporter reporter;
-
- public ThreadInfoProfiler(Reporter reporter) {
- setReporter(reporter);
- init();
- }
-
- private void init() {
- try {
- this.threadMXBean = ManagementFactory.getThreadMXBean();
- } catch (Throwable ex) {
- LOGGER.warn("Failed to get Thread MXBean", ex);
- }
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- @Override
- public long getInterval() {
- return interval;
- }
-
- @Override
- public void setReporter(Reporter reporter) {
- this.reporter = reporter;
- }
-
- @Override
- public void profile() {
- /** total Thread created so far since JVm Launch. */
- long totalStartedThreadCount = 0L;
- /** Number of thread which are currently active. */
- int liveThreadCount = 0;
- /** the peak live thread count since the Java virtual machine started or peak was reset */
- int peakThreadCount = 0;
- /** Number of new thread created since last time time the metrics was created. */
- long newThreadCount = 0;
- /** This is a Derived metrics from previous data point. */
- if (threadMXBean != null) {
- liveThreadCount = threadMXBean.getThreadCount();
- peakThreadCount = threadMXBean.getPeakThreadCount();
- totalStartedThreadCount = threadMXBean.getTotalStartedThreadCount();
- newThreadCount = totalStartedThreadCount - this.previousTotalStartedThreadCount;
- this.previousTotalStartedThreadCount = totalStartedThreadCount;
- }
-
- Map<String, Object> map = new HashMap<>();
-
- map.put("epochMillis", System.currentTimeMillis());
- map.put("name", getProcessName());
- map.put("host", getHostName());
- map.put("processUuid", getProcessUuid());
- map.put("appId", getAppId());
-
- if (getTag() != null) {
- map.put("tag", getTag());
- }
-
- if (getCluster() != null) {
- map.put("cluster", getCluster());
- }
-
- if (getRole() != null) {
- map.put("role", getRole());
- }
-
- map.put("totalStartedThreadCount", totalStartedThreadCount);
- map.put("newThreadCount", newThreadCount);
- map.put("liveThreadCount", liveThreadCount);
- map.put("peakThreadCount", peakThreadCount);
-
- if (reporter != null) {
- reporter.report(PROFILER_NAME, map);
- }
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/reporter/ConsoleOutputReporter.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/reporter/ConsoleOutputReporter.java
deleted file mode 100644
index 9ce55121b..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/reporter/ConsoleOutputReporter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.reporter;
-
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.Utils;
-
-import java.util.Map;
-
-public class ConsoleOutputReporter implements Reporter {
-
- private static final AgentLogger LOGGER = AgentLogger.getLogger(ConsoleOutputReporter.class.getName());
-
- @Override
- public void report(String profilerName, Map<String, Object> metrics) {
- LOGGER.info(String.format("ConsoleOutputReporter - %s: %s", profilerName, Utils.toJsonString(metrics)));
- }
-
- @Override
- public void close() {
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/reporter/HttpReporter.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/reporter/HttpReporter.java
deleted file mode 100644
index 83147b89a..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/reporter/HttpReporter.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.reporter;
-
-import org.apache.streampark.plugin.profiling.ArgumentUtils;
-import org.apache.streampark.plugin.profiling.Reporter;
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.Utils;
-
-import scalaj.http.Http;
-import scalaj.http.HttpResponse;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-public class HttpReporter implements Reporter {
-
- private static final AgentLogger LOGGER = AgentLogger.getLogger(HttpReporter.class.getName());
-
- private static final String ARG_ID = "id";
- private static final String ARG_TOKEN = "token";
- private static final String ARG_URL = "url";
- private static final String ARG_TYPE = "type";
- private Long id;
- private String token;
- private String url;
- private String type;
-
- public HttpReporter() {
- }
-
- @Override
- public void doArguments(Map<String, List<String>> parsedArgs) {
- id = Long.parseLong(Objects.requireNonNull(ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_ID)).trim());
- token = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_TOKEN);
- url = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_URL);
- type = ArgumentUtils.getArgumentSingleValue(parsedArgs, ARG_TYPE);
- }
-
- @Override
- public void report(String profilerName, Map<String, Object> metrics) {
- String json = Utils.toJsonString(metrics);
- Map<String, Object> param = new HashMap<>(5);
- param.put("id", id);
- param.put("type", type);
- param.put("token", token);
- param.put("profiler", profilerName);
- param.put("metric", Utils.zipString(json));
- HttpResponse<String> response =
- Http.apply(url)
- .timeout(1000, 5000)
- .header("content-type", "application/json;charset=UTF-8")
- .postData(Utils.toJsonString(param))
- .asString();
- LOGGER.log("jvm-profiler profiler:" + profilerName + ",report result:" + response.body());
- }
-
- @Override
- public void close() {
- }
-}
diff --git a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/transformer/JavaAgentFileTransformer.java b/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/transformer/JavaAgentFileTransformer.java
deleted file mode 100644
index 1ec74dca3..000000000
--- a/streampark-plugin/streampark-jvm-profiler/src/main/java/org/apache/streampark/plugin/profiling/transformer/JavaAgentFileTransformer.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.plugin.profiling.transformer;
-
-import org.apache.streampark.plugin.profiling.util.AgentLogger;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethod;
-import org.apache.streampark.plugin.profiling.util.ClassAndMethodFilter;
-import org.apache.streampark.plugin.profiling.util.ClassMethodArgument;
-import org.apache.streampark.plugin.profiling.util.ClassMethodArgumentFilter;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtMethod;
-import javassist.LoaderClassPath;
-
-import java.io.ByteArrayInputStream;
-import java.lang.instrument.ClassFileTransformer;
-import java.lang.instrument.IllegalClassFormatException;
-import java.security.ProtectionDomain;
-import java.util.List;
-
-public class JavaAgentFileTransformer implements ClassFileTransformer {
- private static final AgentLogger LOGGER =
- AgentLogger.getLogger(JavaAgentFileTransformer.class.getName());
-
- private final ClassAndMethodFilter durationProfilingFilter;
- private final ClassMethodArgumentFilter argumentFilterProfilingFilter;
-
- public JavaAgentFileTransformer(
- List<ClassAndMethod> durationProfiling, List<ClassMethodArgument> argumentProfiling) {
- this.durationProfilingFilter = new ClassAndMethodFilter(durationProfiling);
- this.argumentFilterProfilingFilter = new ClassMethodArgumentFilter(argumentProfiling);
- }
-
- @Override
- public byte[] transform(
- ClassLoader loader,
- String className,
- Class<?> classBeingRedefined,
- ProtectionDomain protectionDomain,
- byte[] classfileBuffer)
... 5457 lines suppressed ...