Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ed4f45b
feat: 第一阶段 Rust 重构完成 - 基础项目结构和核心模块
fengmk2 Sep 21, 2025
68c7388
feat: implement Rust monitoring modules and NAPI bindings
fengmk2 Sep 21, 2025
f4a59c0
feat: implement CPU and memory monitoring modules with platform-speci…
fengmk2 Sep 21, 2025
0972c7e
feat(rust): 完成监控模块重构和编译错误修复
fengmk2 Sep 21, 2025
ceffb6d
feat: 修复监控模块API兼容性和基准测试实现
fengmk2 Sep 21, 2025
be14a2c
feat: 添加错误处理模块和平台特定优化
fengmk2 Sep 21, 2025
7ded7c6
fix: 修复基准测试链接器问题和函数调用错误
fengmk2 Sep 21, 2025
59d7cd6
fix: 修复监控模块测试和编译警告
fengmk2 Sep 21, 2025
a74f313
feat: 扩展性能基准测试覆盖所有监控模块
fengmk2 Sep 21, 2025
cf89f92
Fix benchmark compilation and linker issues
fengmk2 Sep 21, 2025
c6b356e
Add platform-specific SIMD optimizations for CPU monitoring
fengmk2 Sep 21, 2025
cf1454f
refactor: Fix monitoring modules error handling and type consistency
fengmk2 Sep 21, 2025
1f34554
feat: Complete major Rust refactoring milestones
fengmk2 Sep 21, 2025
ede93f1
feat: implement complete profiler module with CPU, Heap, and GC profi…
fengmk2 Sep 21, 2025
06b6e13
feat: implement profiler module with monitoring capabilities
fengmk2 Sep 22, 2025
3f0962c
feat: implement Rust profiler modules with NAPI bindings
fengmk2 Sep 22, 2025
ab1b302
feat: 完善HTTP监控模块,添加URL模式匹配和慢请求跟踪功能
fengmk2 Sep 22, 2025
5c9952c
Fix integration tests compilation errors and method signatures
fengmk2 Sep 22, 2025
ae6c575
FIXUP
fengmk2 Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
431 changes: 431 additions & 0 deletions .trae/documents/xprofiler-rust-refactor-plan.md

Large diffs are not rendered by default.

2,429 changes: 2,429 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions rust/xprofiler-rs/.cargo/config.toml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[build]
target-dir = "target"

[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-Wl,-undefined,dynamic_lookup"
]

[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-Wl,-undefined,dynamic_lookup"
]
15 changes: 15 additions & 0 deletions rust/xprofiler-rs/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors or IDEs
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
18 changes: 18 additions & 0 deletions rust/xprofiler-rs/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Auto detect text files and perform LF normalization
* text=auto


*.ts text eol=lf merge=union
*.tsx text eol=lf merge=union
*.rs text eol=lf merge=union
*.js text eol=lf merge=union
*.json text eol=lf merge=union
*.debug text eol=lf merge=union

# Generated codes
index.js linguist-detectable=false
index.d.ts linguist-detectable=false
xprofiler-rs.wasi-browser.js linguist-detectable=false
xprofiler-rs.wasi.cjs linguist-detectable=false
wasi-worker-browser.mjs linguist-detectable=false
wasi-worker.mjs linguist-detectable=false
20 changes: 20 additions & 0 deletions rust/xprofiler-rs/.github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "group:allNonMajor", ":preserveSemverRanges", ":disablePeerDependencies"],
"labels": ["dependencies"],
"packageRules": [
{
"matchPackageNames": ["@napi/cli", "napi", "napi-build", "napi-derive"],
"addLabels": ["napi-rs"],
"groupName": "napi-rs"
},
{
"matchPackagePatterns": ["^eslint", "^@typescript-eslint"],
"groupName": "linter"
}
],
"commitMessagePrefix": "chore: ",
"commitMessageAction": "bump up",
"commitMessageTopic": "{{depName}} version",
"ignoreDeps": []
}
193 changes: 193 additions & 0 deletions rust/xprofiler-rs/.github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta, nightly]
exclude:
# Reduce CI load by excluding some combinations
- os: windows-latest
rust: beta
- os: windows-latest
rust: nightly
- os: macos-latest
rust: beta

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy

- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-

- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-

- name: Check formatting
run: cargo fmt --all -- --check
if: matrix.rust == 'stable'

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
if: matrix.rust == 'stable'

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose

- name: Run tests with all features
run: cargo test --all-features --verbose

- name: Run integration tests
run: cargo test --test integration_tests --verbose

- name: Run error handling tests
run: cargo test --test error_handling_tests --verbose

- name: Run compatibility tests
run: cargo test --test compatibility --verbose

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true

security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-audit
run: cargo install cargo-audit

- name: Run security audit
run: cargo audit

docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Build documentation
run: cargo doc --all-features --no-deps

- name: Check documentation
run: cargo doc --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: "-D warnings"

benchmark:
name: Benchmark
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Run benchmarks
run: cargo bench --all-features

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo'
output-file-path: target/criterion/report/index.html
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
comment-on-alert: true
alert-threshold: '200%'
fail-on-alert: true

release:
name: Release
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [test, coverage, security, docs]
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Build release
run: cargo build --release

- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
if: env.CARGO_REGISTRY_TOKEN != ''
130 changes: 130 additions & 0 deletions rust/xprofiler-rs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@

# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# End of https://www.toptal.com/developers/gitignore/api/node


#Added by cargo

/target
Cargo.lock

*.node
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
/npm
1 change: 1 addition & 0 deletions rust/xprofiler-rs/.husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
Loading