π FuncTrace Analyzer
δΈζη |
English Version
π Project Overview
FuncTrace Analyzer is a professional Go function tracing analysis tool that helps developers deeply understand function call relationships and performance bottlenecks through visualization technologies. The system uses the Kratos microservices framework for the backend and Vue.js for the frontend, providing a complete solution from data collection to 3D visualization.
π Core Features
- Intelligent Function Tracing - Real-time goroutine execution path capture
- Multi-dimensional Analysis - Time dimension, call depth, resource consumption analysis
- Interactive Visualization - Dynamic zoomable Mermaid flowcharts + parameter heatmaps
- Smart Diagnostics - Performance bottleneck prediction based on historical data
- Cross-platform Support - Lightweight SQLite storage solution
π― Design Goals
- Low-overhead Monitoring - Under 5% performance overhead
- Zero-Intrusive Integration - No code modification required
- Millisecond Response - Fast query for 10M+ call chains
π οΈ Technology Stack
| Domain |
Technologies |
| Backend |
Kratos (Microservices) |
| Frontend |
Vue3 + Composition API |
| Visualization |
Mermaid.js + ECharts |
| Storage |
SQLite + WAL Mode + Ent |
| Search |
fuse.js fuzzy search |
| Deployment |
Docker + Kubernetes-ready |
π Project Structure
βββ api # API definitions (protobuf)
βββ cmd # Main applications
βββ configs # Configuration files
βββ internal # Private application code
β βββ biz # Business logic
β βββ data # Data processing and storage (Ent)
β βββ server # Server implementations
β βββ service # Service implementations
βββ third_party # Third party dependencies
βββ README.md # This file
π§© Feature Modules
1. Smart Trace Viewer
- Description: Search and display goroutines related to specific functions
- Component:
TraceViewer.vue
- Details:
- Dynamic filtering with input and dropdown
- API integration for GID retrieval
- Fuzzy search using
fuse.js
2. 3D Call Graph Visualization
- Description: Detailed trace analysis for specific GIDs
- Component:
TraceDetails.vue
- Details:
- Parameter inspection capabilities
- Interactive timeline navigation
3. Parameter Heatmap Analysis
- Description: Visualize function call relationships
- Component:
MermaidViewer.vue
- Details:
- Mermaid.js rendering
- Zoom/drag support
4. Database Operations
- Description: SQLite data storage/query using Ent
- Details:
- Type-safe database operations
- CRUD operations for trace data
5. CORS Support
- Description: Cross-origin resource sharing
- Details: CORS middleware configuration
π Quick Start
Prerequisites
- Go 1.19+
- Node.js 16+
- SQLite3 3.36+
Backend Setup
# Clone repository
git clone https://github.com/toheart/goanalysis.git
# start server
go run . server
# Instrumentation
go run . rewrite -d <path-to>
π‘ API Reference
| Endpoint |
Method |
Description |
/api/gids |
GET |
Get all GIDs |
/api/functions |
GET |
List all functions |
/api/gids/function |
POST |
Find GIDs by function |
/api/traces/{gid} |
GET |
Get trace by GID |
/api/params/{id} |
GET |
Get parameters by ID |
/api/traces/{gid}/mermaid |
GET |
Get Mermaid diagram data |
π€ Contributing
We follow Gitflow workflow:
- Create feature branch:
git checkout -b feature/your-feature
- Commit atomic changes (follow Conventional Commits)
- Write unit tests (β₯80% coverage)
- Update documentation
- Create PR to
develop branch
π§ Kratos Features Utilized
- Service Discovery: Built-in service registry and discovery
- Error Handling: Structured error handling and recovery
- Logging & Tracing: Comprehensive logging and distributed tracing
- Project Structure: Following Kratos recommended conventions
GitHub Actions Pipeline and Docker Images
This project has configured a GitHub Actions pipeline for automatically building and publishing Docker images and packages.
Automatic Build Process
When code is pushed to the main branch or a new tag (in the format of v*, such as v1.0.0) is created, the build process is automatically triggered:
- Checkout code
- Set up Go environment
- Retrieve version information
- Sync frontend code (from the latest release version of https://github.com/toheart/goanalysis-web)
- Build application
- Package Linux and Windows versions
- Build and push Docker image (only when pushing to a branch or tag)
- Create GitHub Release (only when creating a tag)
Frontend Version Synchronization
The system will automatically fetch the latest release version from the https://github.com/toheart/goanalysis-web repository for building:
- Retrieve the latest release version information via GitHub API
- Download the corresponding release package or source code
- If the release package contains a compiled dist directory, use it directly
- If only the source code is available, it will be compiled automatically
- The Release notes will include the frontend version information used
π Version History
| Version |
Date |
Milestone |
| v1.0.0 |
2025-03-09 |
Official release |
| v0.9.0 |
2025-02-25 |
Distributed tracing support |
| v0.8.0 |
2025-02-18 |
Parameter heatmap analysis |
FuncTrace Analyzer - Powered by Kratos+Vue Tech Stack
π Last Updated: 2025-03-09 CST