Skip to content

Commit

Permalink
[Feature] Implementation to obtain the list of jar files loaded by th…
Browse files Browse the repository at this point in the history
…e class loader (#3087)

Co-authored-by: Zzm0809 <[email protected]>
  • Loading branch information
Zzm0809 and Zzm0809 authored Jan 30, 2024
1 parent a738fe9 commit fa3ca0d
Show file tree
Hide file tree
Showing 23 changed files with 283 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
name: Bug report
title: "[Bug] [Module Name] Bug title "
description: Problems and issues with code of Dinky
labels: [ "bug", "Waiting for reply" ]
labels: [ "Bug", "Waiting for reply" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/document-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
name: Document request
description: Modify the document
title: "[Document][doc] Document title"
labels: [ "documentation", "Waiting for reply" ]
labels: [ "Doc", "Waiting for reply" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
name: Feature request
description: Suggest an idea for this project
title: "[Feature][Module Name] Feature title"
labels: [ "new feature", "Waiting for reply" ]
labels: [ "New Feature", "Waiting for reply" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/optimization-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
name: Optimization request
description: Suggest a optimization for this project
title: "[Optimization][Module Name] Optimization title"
labels: [ "optimization", "Waiting for reply" ]
labels: [ "Optimization", "Waiting for reply" ]
body:
- type: markdown
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/add-assignees.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
assign-udf-problem-to-developer:
runs-on: ubuntu-latest
if: contains(github.event.issue.labels.*.name, 'bug')
if: contains(github.event.issue.title, 'udf') == true || contains(github.event.issue.title, 'udtf') == true || contains(github.event.issue.body, 'udaf') == true
steps:
- name: assign problem to developer of udf
uses: actions-cool/issues-helper@v3
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
assign-cdc-problem-to-developer:
runs-on: ubuntu-latest
if: contains(github.event.issue.title, 'cdc') == true || contains(github.event.issue.title, 'cdcsource') == true || contains(github.event.issue.body, 'cdcsource') == true
if: contains(github.event.issue.title, 'cdc') == true || contains(github.event.issue.title, 'cdcsource') == true || contains(github.event.issue.body, 'pipeline') == true
steps:
- name: assign problem to developer of cdc and cdcsource
uses: actions-cool/issues-helper@v3
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/auto-realease-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# 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.

name: "Release Dinky"

on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Dinky version'
required: true
prerelease:
type: boolean
description: 'Is this a pre-release?'
required: true
release_notes:
type: string
description: 'Release notes'
required: true

jobs:
release:
name: ${{ inputs.prerelease == 'true' && 'Pre Release' || 'Release' }}
runs-on: "ubuntu-latest"

steps:
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'adopt'

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'


- name: "Checkout Dinky"
uses: actions/checkout@v3


- name: "Build Dinky ${{ inputs.version }} with Fink 1.14 Pre Release/Release Artifact"
id: build_dinky1_14
run: |
./mvnw -B clean package \
-Dmaven.test.skip=false \
-Dspotless.check.skip=true \
-Denforcer.skip=false \
-Dmaven.javadoc.skip=true \
-Pprod,scala-2.12,flink-single-version,flink-1.14,maven-central,web,fast \
--no-snapshot-updates
- name: "Build Dinky ${{ inputs.version }} with Fink 1.15 Pre Release/Release Artifact"
id: build_dinky1_15
run: |
./mvnw -B clean package \
-Dmaven.test.skip=false \
-Dspotless.check.skip=true \
-Denforcer.skip=false \
-Dmaven.javadoc.skip=true \
-Pprod,scala-2.12,flink-single-version,flink-1.15,maven-central,web,fast \
--no-snapshot-updates
- name: "Build Dinky ${{ inputs.version }} with Fink 1.16 Pre Release/Release Artifact"
id: build_dinky1_16
run: |
./mvnw -B clean package \
-Dmaven.test.skip=false \
-Dspotless.check.skip=true \
-Denforcer.skip=false \
-Dmaven.javadoc.skip=true \
-Pprod,scala-2.12,flink-single-version,flink-1.16,maven-central,web,fast \
--no-snapshot-updates
- name: "Build Dinky ${{ inputs.version }} with Fink 1.17 Pre Release/Release Artifact"
id: build_dinky1_17
run: |
./mvnw -B clean package \
-Dmaven.test.skip=false \
-Dspotless.check.skip=true \
-Denforcer.skip=false \
-Dmaven.javadoc.skip=true \
-Pprod,scala-2.12,flink-single-version,flink-1.17,maven-central,web,fast \
--no-snapshot-updates
- name: "Build Dinky ${{ inputs.version }} with Fink 1.18 Pre Release/Release Artifact"
id: build_dinky1_18
run: |
./mvnw -B clean package \
-Dmaven.test.skip=false \
-Dspotless.check.skip=true \
-Denforcer.skip=false \
-Dmaven.javadoc.skip=true \
-Pprod,scala-2.12,flink-single-version,flink-1.18,maven-central,web,fast \
--no-snapshot-updates
- name: Automatic Upload Releases to GitHub Releases Page
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
draft: false
upload_url: https://github.com/DataLinkDC/dinky/releases
title: "Dinky ${{ inputs.version }} Release"
body: |
${{ inputs.release_notes }}
files: |
./build/dinky-release-*.tar.gz
28 changes: 28 additions & 0 deletions .github/workflows/issue-title-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Issue Title Standard Check

on:
issues:
types: [opened, edited]

jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/[email protected]
id: check
name: Check Issue Title
with:
actions: 'check-issue'
issue-number: ${{ github.event.issue.number }}
title-excludes: '[Bug],[Feature],[Doc],[Refactor],[Optimization],[Improvement]'

- if: steps.check.outputs.check-result == 'false' && github.event.issue.state == 'open'
uses: actions-cool/[email protected]
name: Create Comment
with:
actions: 'create-comment'
issue-number: ${{ github.event.issue.number }}
body: |
Hi @${{ github.event.issue.user.login }}, It is detected that the current Issue title is not standardized. Please refer to [Issue Notes](http://www.dinky.org.cn/docs/next/developer_guide/contribution/issue) to modify it.
你好 @${{ github.event.issue.user.login }}, 检测到当前 Issue 标题不规范, 请参考 [Issue 须知](http://www.dinky.org.cn/docs/next/developer_guide/contribution/issue) 进行修改
18 changes: 9 additions & 9 deletions .github/workflows/pr-reviewer-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
reviewers: 'zackyoungh,gaoyan1998,Zzm0809,aiwenmo'
review-creator: false

#
# - name: Add project
# if: "github.event_name == 'pull_request_target'"
# uses: alex-page/[email protected]
# with:
# project: Dinky Roadmap
# column: Doing
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# action: 'add-project-column'

- name: Add project
if: "github.event_name == 'pull_request_target'"
uses: alex-page/[email protected]
with:
project: Dinky Roadmap
column: RoadMap
repo-token: ${{ secrets.GITHUB_TOKEN }}
action: add
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Api(tags = "System Controller")
@RequestMapping("/api/system")
@RequiredArgsConstructor
public class SystemInfoController {
public class SystemController {

private final SystemService systemService;

Expand Down Expand Up @@ -83,4 +83,10 @@ public Result<String> getRootLog() {
public Result<String> readFile(@RequestParam String path) {
return Result.data(systemService.readFile(path));
}

@GetMapping("/queryAllClassLoaderJarFiles")
@ApiOperation("Query All ClassLoader Jar Files")
public Result<List<String>> queryAllClassLoaderJarFiles() {
return Result.succeed(systemService.queryAllClassLoaderJarFiles());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ public interface SystemService {
* @return {@link String}
*/
String readFile(String path);

List<String> queryAllClassLoaderJarFiles();
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@
import org.dinky.utils.TreeUtil;

import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import cn.hutool.core.util.ClassLoaderUtil;

/**
* SystemServiceImpl
*
Expand All @@ -48,4 +53,21 @@ public List<TreeNodeDTO> listLogDir() {
public String readFile(String path) {
return DirUtil.readFile(path);
}

/**
* @return
*/
@Override
public List<String> queryAllClassLoaderJarFiles() {
List<String> jarFiles = new ArrayList<>();
ClassLoader systemClassLoader = ClassLoaderUtil.getSystemClassLoader();
if (systemClassLoader instanceof URLClassLoader) {
URLClassLoader urlClassLoader = (URLClassLoader) systemClassLoader;
URL[] urlClassLoaderURLs = urlClassLoader.getURLs();
for (URL url : urlClassLoaderURLs) {
jarFiles.add(url.getFile());
}
}
return jarFiles;
}
}
1 change: 1 addition & 0 deletions dinky-admin/src/main/resources/db/db-h2-dml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ insert into dinky_sys_menu values (153, 150, '查询', '/registration/datasource
insert into dinky_sys_menu values (154, 150, '生成 SQL', '/registration/datasource/detail/gensql', null, 'registration:datasource:detail:gensql', 'ConsoleSqlOutlined', 'F', 0, 152, '2024-01-18 21:52:06', '2024-01-18 22:10:29', null);
insert into dinky_sys_menu values (155, 150, ' 控制台', '/registration/datasource/detail/console', null, 'registration:datasource:detail:console', 'ConsoleSqlOutlined', 'F', 0, 153, '2024-01-18 21:52:47', '2024-01-18 22:10:37', null);
insert into dinky_sys_menu values (156, 150, ' 刷新', '/registration/datasource/detail/refresh', null, 'registration:datasource:detail:refresh', 'ReloadOutlined', 'F', 0, 154, '2024-01-18 22:13:47', '2024-01-18 22:13:47', null);
insert into dinky_sys_menu values (157, 6, '类加载器 Jars', '/settings/classloaderjars', './SettingCenter/ClassLoaderJars', 'settings:classloaderjars', 'CodeSandboxOutlined', 'C', 0, 155, '2024-01-29 16:51:51', '2024-01-29 16:51:51', null);

-- ----------------------------
-- Records of dinky_alert_rule
Expand Down
6 changes: 6 additions & 0 deletions dinky-web/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ export default [
name: 'alertrulelist',
icon: 'ReconciliationOutlined',
component: './SettingCenter/AlertRule'
},
{
path: '/settings/classloaderjars',
name: 'classloaderjars',
icon: 'CodepenOutlined',
component: './SettingCenter/ClassLoaderJars'
}
]
},
Expand Down
1 change: 1 addition & 0 deletions dinky-web/src/locales/en-US/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default {
'menu.settings': 'Setting Center',
'menu.settings.globalsetting': 'Global Settings',
'menu.settings.systemlog': 'System Log',
'menu.settings.classloaderjars': 'ClassLoader Jars',
'menu.settings.process': 'Process List',
'menu.settings.services': 'Servers List',
'menu.settings.alertrulelist': 'Alert Rules',
Expand Down
5 changes: 4 additions & 1 deletion dinky-web/src/locales/en-US/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1215,5 +1215,8 @@ export default {
'lineage.collapseUpstream': 'Collapse Upstream(UnSupported)',
'lineage.showMap': 'Show Map',
'lineage.hideMap': 'Hide Map',
'lineage.refresh': 'Refresh'
'lineage.refresh': 'Refresh',

'sys.classLoaderJars.tips':
'The following content shows the list of jar packages loaded by the system class loader inside the Dinky service. In this way, you can visually view all Jar files that have been loaded inside the service to help troubleshoot Jar package conflicts and other issues.'
};
1 change: 1 addition & 0 deletions dinky-web/src/locales/zh-CN/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default {
'menu.settings': '配置中心',
'menu.settings.globalsetting': '全局配置',
'menu.settings.systemlog': '系统日志',
'menu.settings.classloaderjars': '类加载器 Jars',
'menu.settings.process': '进程列表',
'menu.settings.services': '服务器列表',
'menu.settings.alertrulelist': '告警策略',
Expand Down
5 changes: 4 additions & 1 deletion dinky-web/src/locales/zh-CN/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1171,5 +1171,8 @@ export default {
'lineage.collapseUpstream': '收起上游(暂未实现)',
'lineage.showMap': '显示小地图',
'lineage.hideMap': '隐藏小地图',
'lineage.refresh': '刷新血缘'
'lineage.refresh': '刷新血缘',

'sys.classLoaderJars.tips':
'下述内容展示了 Dinky 服务内部的系统类加载器加载的 jar 包列表,可以通过此种方式直观的查看服务内部已经加载的所有 Jar 文件,以助于排查 Jar 包冲突等问题'
};
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const Explain: React.FC<ExplainProps> = (props: any) => {
style={{ alignItems: 'inherit' }}
code={explainInfo}
language='java'
height='500px'
height='92vh'
/>
</Drawer>
</>
Expand Down
Loading

0 comments on commit fa3ca0d

Please sign in to comment.