Unverified Commit fa3ca0d2 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Feature] Implementation to obtain the list of jar files loaded by the class loader (#3087)

parent a738fe91
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
......@@ -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
......@@ -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
......
# 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
\ No newline at end of file
name: Issue Title Standard Check
on:
issues:
types: [opened, edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/issues-helper@v2.2.0
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/issues-helper@v2.2.0
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) 进行修改
\ No newline at end of file
......@@ -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/github-project-automation-plus@v0.8.1
# with:
# project: Dinky Roadmap
# column: Doing
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# action: 'add-project-column'
\ No newline at end of file
- name: Add project
if: "github.event_name == 'pull_request_target'"
uses: alex-page/github-project-automation-plus@v0.8.1
with:
project: Dinky Roadmap
column: RoadMap
repo-token: ${{ secrets.GITHUB_TOKEN }}
action: add
......@@ -43,7 +43,7 @@ import lombok.RequiredArgsConstructor;
@Api(tags = "System Controller")
@RequestMapping("/api/system")
@RequiredArgsConstructor
public class SystemInfoController {
public class SystemController {
private final SystemService systemService;
......@@ -83,4 +83,10 @@ public class SystemInfoController {
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());
}
}
......@@ -45,4 +45,6 @@ public interface SystemService {
* @return {@link String}
*/
String readFile(String path);
List<String> queryAllClassLoaderJarFiles();
}
......@@ -26,10 +26,15 @@ import org.dinky.utils.DirUtil;
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
*
......@@ -48,4 +53,21 @@ public class SystemServiceImpl implements SystemService {
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;
}
}
......@@ -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
......
......@@ -275,6 +275,12 @@ export default [
name: 'alertrulelist',
icon: 'ReconciliationOutlined',
component: './SettingCenter/AlertRule'
},
{
path: '/settings/classloaderjars',
name: 'classloaderjars',
icon: 'CodepenOutlined',
component: './SettingCenter/ClassLoaderJars'
}
]
},
......
......@@ -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',
......
......@@ -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.'
};
......@@ -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': '告警策略',
......
......@@ -1171,5 +1171,8 @@ export default {
'lineage.collapseUpstream': '收起上游(暂未实现)',
'lineage.showMap': '显示小地图',
'lineage.hideMap': '隐藏小地图',
'lineage.refresh': '刷新血缘'
'lineage.refresh': '刷新血缘',
'sys.classLoaderJars.tips':
'下述内容展示了 Dinky 服务内部的系统类加载器加载的 jar 包列表,可以通过此种方式直观的查看服务内部已经加载的所有 Jar 文件,以助于排查 Jar 包冲突等问题'
};
......@@ -228,7 +228,7 @@ const Explain: React.FC<ExplainProps> = (props: any) => {
style={{ alignItems: 'inherit' }}
code={explainInfo}
language='java'
height='500px'
height='92vh'
/>
</Drawer>
</>
......
/*
*
* 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.
*
*/
import CodeShow from '@/components/CustomEditor/CodeShow';
import { queryClassLoaderJars } from '@/pages/SettingCenter/ClassLoaderJars/service';
import { l } from '@/utils/intl';
import { Alert, Space } from 'antd';
import { useEffect, useState } from 'react';
export default () => {
const [data, setData] = useState<string>('');
useEffect(() => {
queryClassLoaderJars().then((res) => {
if (res && res.length > 0) setData(res.join('\n'));
});
}, []);
return (
<Space size={'large'} direction={'vertical'}>
<Alert message={l('sys.classLoaderJars.tips')} type='info' showIcon />
<CodeShow showFloatButton enableMiniMap height={'88vh'} code={data} language={'java'} />
</Space>
);
};
/*
*
* 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.
*
*/
import { queryDataByParams } from '@/services/BusinessCrud';
export const queryClassLoaderJars = async () => {
return (await queryDataByParams<string[]>('/api/system/queryAllClassLoaderJarFiles')) ?? [];
};
......@@ -1927,6 +1927,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);
COMMIT;
......
......@@ -3751,6 +3751,7 @@ insert into public.dinky_sys_menu values (153, 150, '查询', '/registration/dat
insert into public.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 public.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 public.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 public.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);
select setval('dinky_sys_menu_id_seq', (select max(id) from "public"."dinky_sys_menu"));
......
......@@ -216,6 +216,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);
-- ----------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment