forked from grafana/pyroscope
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevelopment-workflow.mdc
More file actions
92 lines (68 loc) · 2.78 KB
/
Copy pathdevelopment-workflow.mdc
File metadata and controls
92 lines (68 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
description: Development workflow, commands, and commit guidelines for Pyroscope
globs:
alwaysApply: false
---
# Development Workflow
## Prerequisites
- Go 1.25 (see `go.mod`)
- Docker
- Node.js (recent LTS) + Yarn 4 (Berry) — only needed for frontend work in `ui/`
- All other tools auto-download to `.tmp/bin/`
## Build Commands
```bash
# Build backend
make go/bin
# Run Go tests
make go/test
# Frontend dev (run from ui/): Vite dev server on :5173, proxies API to :4040
cd ui && yarn install && yarn dev
# Production frontend build (Docker -> ui/dist; required before `make build`)
make frontend/build
# Docker image
make GOOS=linux GOARCH=amd64 docker-image/pyroscope/build
```
## Running Locally
```bash
# Run all components in monolithic mode with embedded Grafana
go run ./cmd/pyroscope --target all,embedded-grafana
# Pyroscope: http://localhost:4040
# Grafana: http://localhost:4041
```
## Code Generation
**CRITICAL**: After changing protobuf, configs, or flags:
```bash
make generate
```
Commit the generated files with your changes.
## Useful Make Targets
```bash
make help # Show all available targets
make lint # Run linters
make go/test # Run Go unit tests
make go/bin # Build binaries
make go/mod # Tidy go modules
make generate # Generate code (protobuf, mocks, etc.)
make docker-image/pyroscope/build # Build Docker image
```
## Commit Guidelines
1. **Atomic Commits**: Each commit should be a logical unit
2. **Commit Messages**: Focus on "why" not just "what"
3. **Generated Code**: Include generated files in the same commit as source changes
4. **Format**: Follow existing commit message style (see `git log --oneline -20`)
## When Working on Features
1. **Read Component Docs**: Check `docs/sources/reference-pyroscope-architecture/components/` for the component you're modifying
2. **Understand the Ring**: If working on write/read path, understand consistent hashing
3. **Multi-tenancy First**: Always consider multi-tenant implications
4. **Check for Similar Code**: Pyroscope is inspired by Cortex/Mimir - similar patterns apply
5. **Test Multi-tenancy**: Test with multiple tenants to catch isolation issues
6. **Profile Your Changes**: Use `go test -bench` and verify performance impact
7. **Update Documentation**: If changing user-facing behavior, update docs
## Documentation Locations
- **User Docs**: `docs/sources/` - Published to grafana.com
- **Contributing**: `docs/internal/contributing/README.md`
- **Component Docs**: `docs/sources/reference-pyroscope-architecture/components/`
## Getting Help
- **Contributing Guide**: `docs/internal/contributing/README.md`
- **Code Comments**: The codebase has extensive comments - read them
- **Git History**: Use `git blame` and `git log` to understand design decisions