- Notifications
You must be signed in to change notification settings - Fork 7.6k
feat: jfr analyzer #3050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: jfr analyzer #3050
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a complete JFR (Java Flight Recorder) file analysis feature with both frontend and backend components. The implementation provides JFR file upload, parsing, and flame graph visualization capabilities using Spring Boot backend and React frontend.
Key changes include:
- Complete backend JFR analysis service with Spring Boot
- React-based frontend with flame graph visualization
- File upload/management system with comprehensive UI
- Integration between frontend and backend modules
Reviewed Changes
Copilot reviewed 154 out of 158 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Adds new frontend and backend modules to main build |
| labs/arthas-jfr-frontend/ | Complete React frontend application with TypeScript, flame graph components, and file management |
| labs/arthas-jfr-backend/ | Spring Boot backend service for JFR file analysis and REST APIs |
| Frontend components | Flame graph visualization, file upload/table, analysis views, and utility functions |
| Backend services | JFR analysis service, file management, and REST controllers |
Files not reviewed (1)
- labs/arthas-jfr-frontend/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -0,0 +1,28 @@ | |||
| { | |||
| "name": "arthas-fronted", | |||
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package name contains a typo. 'fronted' should be 'frontend' to match the directory name and project purpose.
| "name": "arthas-fronted", | |
| "name": "arthas-frontend", |
| // @ts-nocheck | ||
| // eslint-disable-next-line | ||
| /** | ||
| * 将JFR后端返回的line格式火焰图数据转换为树结构 | ||
| * @param {Array} data - 形如[[0,1,2], 100]的数组,表示栈帧路径和权重 | ||
| * @param {Object} symbolTable - {0: 'main', 1: 'foo', ...} | ||
| * @returns {Object} 递归树结构 { name, value, children } | ||
| */ | ||
| export function formatFlamegraph(data, symbolTable) { |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @ts-nocheck and eslint-disable-next-line at the top of files indicates unresolved type issues or code quality problems. These should be addressed rather than suppressed globally.
| // @ts-nocheck | |
| // eslint-disable-next-line | |
| /** | |
| * 将JFR后端返回的line格式火焰图数据转换为树结构 | |
| * @param {Array} data - 形如[[0,1,2], 100]的数组,表示栈帧路径和权重 | |
| * @param {Object} symbolTable - {0: 'main', 1: 'foo', ...} | |
| * @returns {Object} 递归树结构 { name, value, children } | |
| */ | |
| export function formatFlamegraph(data, symbolTable) { | |
| /** | |
| * 将JFR后端返回的line格式火焰图数据转换为树结构 | |
| * @param {Array} data - 形如[[0,1,2], 100]的数组,表示栈帧路径和权重 | |
| * @param {Object} symbolTable - {0: 'main', 1: 'foo', ...} | |
| * @returns {Object} 递归树结构 { name, value, children } | |
| */ | |
| // Type definitions | |
| export interface FlamegraphNode { | |
| name: string; | |
| value: number; | |
| children: FlamegraphNode[]; | |
| } | |
| export type StackFrame = number[]; | |
| export type StackData = [StackFrame, number][]; | |
| export type SymbolTable = { [key: number]: string }; | |
| export function formatFlamegraph( | |
| data: StackData, | |
| symbolTable: SymbolTable | |
| ): FlamegraphNode { |
| const tb = value; | ||
| if (tb > 0) result = tb + 'TB ' + result; | ||
| if (result.length === 0) { | ||
| if (bytes == 0) return '0B'; |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strict equality (===) instead of loose equality (==) for consistency and to avoid potential type coercion issues.
| if (bytes == 0) return '0B'; | |
| if (bytes === 0) return '0B'; |
| opacity: 0.7; | ||
| } | ||
| | ||
| .dark-mode .flame-empty { |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are extra spaces in the selector '.dark-mode .flame-empty'. This should be '.dark-mode .flame-empty' for consistency with other selectors.
| .dark-mode .flame-empty { | |
| .dark-mode .flame-empty { |
| // @ts-nocheck | ||
| // eslint-disable-next-line |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a critical component with @ts-nocheck disabled. Type safety should be properly implemented for flame graph rendering logic rather than bypassed.
| // @ts-nocheck | |
| // eslint-disable-next-line |
| }; | ||
| | ||
| | ||
| export default Home; No newline at end of file |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file imports 'Home' from './Home' but exports it as default, while also defining a 'HomeComponent'. This creates confusion - the export should match the actual component being used.
| export default Home; | |
| export default HomeComponent; |
| const api = axios.create({ | ||
| baseURL: 'http://localhost:8200', |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The baseURL is hardcoded to localhost. This should be configurable through environment variables for different deployment environments.
| const api = axios.create({ | |
| baseURL: 'http://localhost:8200', | |
| // Use VITE_API_BASE_URL from environment variables, fallback to localhost for development | |
| const api = axios.create({ | |
| baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:8200', |
| // @ts-nocheck | ||
| // eslint-disable-next-line |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File upload functionality should have proper TypeScript types enabled for better error catching and code reliability.
| // @ts-nocheck | ||
| // eslint-disable-next-line |
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file table component handles important data operations and should have TypeScript checking enabled for type safety.
labs/arthas-jfr-frontend/src/App.tsx Outdated
| @@ -0,0 +1,27 @@ | |||
| // @ts-nocheck | |||
Copilot AI Aug 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main App component should have TypeScript checking enabled as it's the root component that defines the application structure.
| // @ts-nocheck |
...s-jfr-backend/src/main/java/org/example/jfranalyzerbackend/service/impl/FileServiceImpl.java Fixed Show fixed Hide fixed
...ackend/src/main/java/org/example/jfranalyzerbackend/service/impl/JFRAnalysisServiceImpl.java Fixed Show fixed Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| 要写个 README,同时写上参考的其他项目地址 |
| 现在的标题“Feat/jfr analyzer”不规范,改成:"feat: jfr analyzer" |
dc757ea to 2f8aa0f Compare | @hengyunabc 我觉得基本可以合并进入 labs |

JFR 文件分析功能:前后端实现
本次 PR 实现了对
.jfr文件的分析能力,包括前后端服务的完整集成。模块说明
后端模块:
arthas-jfr-backend.jfr文件上传、解析、火焰图等数据接口前端模块:
arthas-jfr-frontend.jfr文件并展示火焰图参考项目
该Pr参考了以下优秀的开源项目:
相关 Issue
Closes #3014