@platformatic/watt-admin 0.6.0-alpha.8 β 0.6.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -34
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,72 +1,200 @@
|
|
|
1
|
-
#
|
|
1
|
+
# π Watt Admin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Real-time monitoring and administration for your Platformatic applications**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Watt Admin is an open-source developer monitoring tool that provides instant visibility into your Node.js services. Monitor performance, analyze logs, and troubleshoot issuesβall from a single, intuitive dashboard.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## β¨ Features
|
|
10
|
+
|
|
11
|
+
### π **Performance Metrics**
|
|
12
|
+
- **Memory tracking**: RSS, heap usage, new/old space allocation with interactive charts
|
|
13
|
+
- **CPU monitoring**: Real-time CPU and event loop utilization
|
|
14
|
+
- **Latency analysis**: P90, P95, P99 percentiles at a glance
|
|
15
|
+
- **Request rates**: Monitor requests per second across all services
|
|
16
|
+
|
|
17
|
+
### π **Centralized Logging**
|
|
18
|
+
- View logs from all services in one place
|
|
19
|
+
- Filter by service or log level
|
|
20
|
+
- Toggle between formatted and raw JSON views
|
|
21
|
+
- Export logs for further analysis
|
|
22
|
+
|
|
23
|
+
### π― **Service Management**
|
|
24
|
+
- Monitor service status at a glance
|
|
25
|
+
- Drill down into individual service metrics
|
|
26
|
+
- Compare performance across services
|
|
27
|
+
- Restart services directly from the dashboard
|
|
28
|
+
|
|
29
|
+
### π₯ **Profiling & Recording** *(New!)*
|
|
30
|
+
- **CPU profiling**: Capture flame graphs to identify performance bottlenecks
|
|
31
|
+
- **Heap profiling**: Analyze memory allocation patterns
|
|
32
|
+
- **Offline analysis**: Generate self-contained HTML bundles for sharing and review
|
|
33
|
+
- **Recording mode**: Capture metrics and profiles over time for post-mortem analysis
|
|
34
|
+
|
|
35
|
+
## π Quick Start
|
|
36
|
+
|
|
37
|
+
### Using npx (Recommended)
|
|
38
|
+
|
|
39
|
+
Launch Watt Admin with a single command:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx wattpm admin
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The dashboard will automatically discover your running Platformatic runtimes and open at `http://localhost:4042`.
|
|
6
46
|
|
|
7
47
|
### Installation
|
|
8
48
|
|
|
9
|
-
|
|
49
|
+
Install globally for convenient access:
|
|
10
50
|
|
|
11
51
|
```bash
|
|
12
|
-
|
|
52
|
+
npm install -g @platformatic/watt-admin
|
|
13
53
|
```
|
|
14
54
|
|
|
15
|
-
|
|
55
|
+
Then run:
|
|
16
56
|
|
|
17
|
-
|
|
57
|
+
```bash
|
|
58
|
+
watt-admin
|
|
59
|
+
```
|
|
18
60
|
|
|
19
|
-
|
|
61
|
+
## π‘ Usage
|
|
62
|
+
|
|
63
|
+
### Basic Usage
|
|
64
|
+
|
|
65
|
+
When you run `watt-admin`, it automatically discovers all available Platformatic runtimes:
|
|
20
66
|
|
|
21
67
|
```bash
|
|
22
|
-
|
|
23
|
-
|
|
68
|
+
$ watt-admin
|
|
69
|
+
Select a runtime: (Use arrow keys)
|
|
70
|
+
β― my-app (PID: 12345) (Started at 3/10/2025, 10:00:00 AM)
|
|
71
|
+
api-service (PID: 54321) (Started at 3/10/2025, 9:30:00 AM)
|
|
24
72
|
```
|
|
25
73
|
|
|
26
|
-
|
|
74
|
+
If only one runtime is running, it will be selected automatically.
|
|
75
|
+
|
|
76
|
+
### Custom Port
|
|
27
77
|
|
|
28
|
-
|
|
78
|
+
Run Watt Admin on a different port:
|
|
29
79
|
|
|
80
|
+
```bash
|
|
81
|
+
watt-admin --port 4321
|
|
30
82
|
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
83
|
+
|
|
84
|
+
### Recording Mode
|
|
85
|
+
|
|
86
|
+
Capture metrics and profiling data for offline analysis:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Profile CPU usage
|
|
90
|
+
watt-admin --record --profile cpu
|
|
91
|
+
|
|
92
|
+
# Profile heap allocation
|
|
93
|
+
watt-admin --record --profile heap
|
|
35
94
|
```
|
|
36
95
|
|
|
37
|
-
|
|
96
|
+
When recording, press `Ctrl+C` to stop. Watt Admin will:
|
|
97
|
+
1. Collect all metrics and profiling data
|
|
98
|
+
2. Generate a self-contained HTML bundle
|
|
99
|
+
3. Automatically open the bundle in your browser
|
|
100
|
+
|
|
101
|
+
The generated HTML file contains everything you need for offline analysisβperfect for sharing with your team or reviewing later.
|
|
102
|
+
|
|
103
|
+
## ποΈ Development
|
|
104
|
+
|
|
105
|
+
### Prerequisites
|
|
38
106
|
|
|
39
|
-
|
|
107
|
+
- Node.js 18 or higher
|
|
108
|
+
- A running Platformatic runtime to monitor
|
|
40
109
|
|
|
110
|
+
### Setup
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git clone https://github.com/platformatic/watt-admin.git
|
|
114
|
+
cd watt-admin
|
|
115
|
+
npm install
|
|
116
|
+
cp .env.sample .env
|
|
41
117
|
```
|
|
42
|
-
|
|
118
|
+
|
|
119
|
+
### Development Mode
|
|
120
|
+
|
|
121
|
+
Auto-reload both backend and frontend on changes:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm run dev
|
|
43
125
|
```
|
|
44
126
|
|
|
45
127
|
### Build
|
|
46
128
|
|
|
47
|
-
```
|
|
129
|
+
```bash
|
|
48
130
|
npm run build
|
|
49
131
|
```
|
|
50
132
|
|
|
51
|
-
###
|
|
133
|
+
### Run Tests
|
|
52
134
|
|
|
53
|
-
```
|
|
54
|
-
|
|
135
|
+
```bash
|
|
136
|
+
# Run all tests
|
|
137
|
+
npm test
|
|
138
|
+
|
|
139
|
+
# Run specific test suites
|
|
140
|
+
npm run test:cli # CLI tests
|
|
141
|
+
npm run test:backend # Backend tests
|
|
142
|
+
npm run test:frontend # Frontend tests
|
|
143
|
+
npm run test:e2e # End-to-end tests
|
|
55
144
|
```
|
|
56
145
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
This will auto-reload both the backend and frontend when changes are made.
|
|
146
|
+
### Project Structure
|
|
60
147
|
|
|
61
148
|
```
|
|
62
|
-
|
|
149
|
+
watt-admin/
|
|
150
|
+
βββ cli.js # CLI entry point
|
|
151
|
+
βββ lib/ # Core CLI functionality
|
|
152
|
+
βββ web/
|
|
153
|
+
β βββ backend/ # Fastify API server
|
|
154
|
+
β βββ frontend/ # React dashboard
|
|
155
|
+
β βββ composer/ # Platformatic Gateway
|
|
156
|
+
βββ watt.json # Wattpm configuration
|
|
157
|
+
βββ test/ # Test suites
|
|
63
158
|
```
|
|
64
159
|
|
|
65
|
-
|
|
160
|
+
## π― Use Cases
|
|
161
|
+
|
|
162
|
+
### Development Workflow
|
|
163
|
+
Monitor your application while developing locally. Instantly see the impact of code changes on performance.
|
|
164
|
+
|
|
165
|
+
### Debugging Performance Issues
|
|
166
|
+
Use CPU and heap profiling to identify bottlenecks and memory leaks before they reach production.
|
|
167
|
+
|
|
168
|
+
### Team Collaboration
|
|
169
|
+
Generate offline HTML bundles to share performance data and profiling results with your team.
|
|
170
|
+
|
|
171
|
+
### Learning and Optimization
|
|
172
|
+
Understand how your services behave under load and optimize based on real data.
|
|
173
|
+
|
|
174
|
+
## π Related Tools
|
|
175
|
+
|
|
176
|
+
For production monitoring and observability, check out [Platformatic Console](https://platformatic.dev/console)βthe intelligent command center for Platformatic Cloud deployments.
|
|
177
|
+
|
|
178
|
+
## π Documentation
|
|
179
|
+
|
|
180
|
+
- [Platformatic Documentation](https://docs.platformatic.dev)
|
|
181
|
+
- [Watt Admin Blog Post](https://blog.platformatic.dev/introducing-watt-admin)
|
|
182
|
+
- [Platformatic Wattpm](https://docs.platformatic.dev/docs/guides/wattpm)
|
|
183
|
+
|
|
184
|
+
## π€ Contributing
|
|
185
|
+
|
|
186
|
+
Contributions are welcome! Please check out our [contributing guidelines](CONTRIBUTING.md) to get started.
|
|
187
|
+
|
|
188
|
+
## π License
|
|
189
|
+
|
|
190
|
+
Apache-2.0 License - see [LICENSE](LICENSE) for details.
|
|
191
|
+
|
|
192
|
+
## π Support
|
|
193
|
+
|
|
194
|
+
- [GitHub Issues](https://github.com/platformatic/watt-admin/issues)
|
|
195
|
+
- [Discord Community](https://discord.gg/platformatic)
|
|
196
|
+
- [Twitter](https://twitter.com/platformatic)
|
|
197
|
+
|
|
198
|
+
---
|
|
66
199
|
|
|
67
|
-
|
|
68
|
-
1. you should now see an info log like `Platformatic is now listening at http://127.0.0.1:{PORT}` (open the local URL)
|
|
69
|
-
2. click on link above to navigate the frontend app
|
|
70
|
-
3. you can call the backend by prefixing the local URL with `/api`
|
|
71
|
-
4. call the `/api/runtimes` endpoint (you should receive the PID)
|
|
72
|
-
5. call the `/api/runtimes/{pid}/metrics` endpoint
|
|
200
|
+
Built with β€οΈ by the [Platformatic](https://platformatic.dev) team
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@platformatic/watt-admin",
|
|
4
|
-
"version": "0.6.0-alpha.
|
|
4
|
+
"version": "0.6.0-alpha.9",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepublishOnly": "npm run clean && npm run build",
|
|
7
7
|
"dev": "wattpm dev",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"start": "wattpm start",
|
|
10
10
|
"typecheck": "cd web/backend && tsc && cd ../frontend && tsc",
|
|
11
11
|
"client:openapi": "cd web/backend && node --experimental-strip-types utils/client.openapi.ts",
|
|
12
|
-
"client:generate": "
|
|
12
|
+
"client:generate": "massimo ./web/backend/openapi.json --name backend --folder web/frontend/src/client --language ts --frontend --full --skip-config-update --props-optional",
|
|
13
13
|
"test": "npm run test:cli && npm run test:e2e && npm run test:backend && npm run test:frontend",
|
|
14
14
|
"test:cli": "node --test --experimental-test-module-mocks --test-timeout 60000 test/*.test.ts",
|
|
15
15
|
"test:backend": "node --test --experimental-test-module-mocks --test-timeout 60000 --test-concurrency 1 web/backend/**/*.test.ts",
|
|
16
16
|
"test:frontend": "cd web/frontend && vitest run",
|
|
17
|
-
"pretest:e2e": "
|
|
17
|
+
"pretest:e2e": "playwright install chromium",
|
|
18
18
|
"test:e2e": "cd web/frontend && playwright test",
|
|
19
19
|
"test:e2e:ui": "npm run test:e2e -- --ui",
|
|
20
20
|
"clean": "rm -rf ./web/*/dist ./playwright-report ./test-results",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@fastify/websocket": "^11.2.0",
|
|
26
26
|
"@fastify/type-provider-json-schema-to-ts": "^5.0.0",
|
|
27
|
-
"@inquirer/prompts": "^
|
|
27
|
+
"@inquirer/prompts": "^8.0.0",
|
|
28
28
|
"@platformatic/control": "^3.15.0",
|
|
29
29
|
"@platformatic/gateway": "^3.15.0",
|
|
30
30
|
"@platformatic/runtime": "^3.15.0",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"vitest": "^3.2.4"
|
|
73
73
|
},
|
|
74
74
|
"bin": {
|
|
75
|
-
"watt-admin": "
|
|
75
|
+
"watt-admin": "cli.js"
|
|
76
76
|
}
|
|
77
77
|
}
|