dashcam 1.4.13-beta.2 → 1.4.13-beta.3
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/bin/dashcam.js +0 -2
- package/lib/recorder.js +2 -2
- package/package.json +1 -1
- package/691cc08dc2fc02f59ae66f08 (1).mp4 +0 -0
- package/LINUX_PERF_FIX.md +0 -184
- package/LOG_TRACKING_GUIDE.md +0 -225
- package/NPM_PUBLISH_FIX.md +0 -104
- package/PERFORMANCE_TRACKING.md +0 -139
- package/SINGLE_FRAME_VIDEO_FIX.md +0 -129
- package/examples/execute-script.js +0 -150
- package/examples/simple-test.js +0 -37
- package/recording.log +0 -814
- package/sea-bundle.mjs +0 -34595
- package/test-page.html +0 -15
- package/test-perf-linux.js +0 -208
- package/test-perf-tracker.js +0 -52
- package/test-performance-tracking.js +0 -108
- package/test-short-recording.js +0 -287
- package/test-top-processes.js +0 -23
- package/test.log +0 -1
- package/test_run.log +0 -48
package/bin/dashcam.js
CHANGED
package/lib/recorder.js
CHANGED
|
@@ -469,10 +469,10 @@ export async function startRecording({
|
|
|
469
469
|
});
|
|
470
470
|
|
|
471
471
|
if (currentRecording.all) {
|
|
472
|
-
currentRecording.all.setEncoding('utf8');
|
|
473
472
|
currentRecording.all.on('data', (data) => {
|
|
474
473
|
// Parse FFmpeg output for useful information
|
|
475
|
-
|
|
474
|
+
// Handle potentially invalid UTF-8 sequences by replacing them
|
|
475
|
+
const output = data.toString('utf8').replace(/\uFFFD/g, '').trim();
|
|
476
476
|
logger.info(`FFmpeg output: ${output}`);
|
|
477
477
|
|
|
478
478
|
// Check for actual permission issues (not fallback messages)
|
package/package.json
CHANGED
|
Binary file
|
package/LINUX_PERF_FIX.md
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
# Linux Performance Tracking Fixes
|
|
2
|
-
|
|
3
|
-
## Problem
|
|
4
|
-
Performance data from dashcam-cli-minimal was not working on Ubuntu Linux.
|
|
5
|
-
|
|
6
|
-
## Root Causes Identified
|
|
7
|
-
|
|
8
|
-
### 1. **ps command compatibility**
|
|
9
|
-
- Some Linux distributions (especially minimal/container images) use BusyBox `ps` which doesn't support the `--sort` option
|
|
10
|
-
- The code was failing when trying to use `ps --sort=-pcpu`
|
|
11
|
-
|
|
12
|
-
### 2. **Missing error handling**
|
|
13
|
-
- Insufficient logging made it hard to diagnose where the performance tracking was failing
|
|
14
|
-
- No fallback mechanisms when certain system calls failed
|
|
15
|
-
|
|
16
|
-
### 3. **Network metrics parsing**
|
|
17
|
-
- The macOS netstat parsing had an off-by-one error in the parts length check
|
|
18
|
-
- Could cause network metrics to fail silently
|
|
19
|
-
|
|
20
|
-
### 4. **Import optimization**
|
|
21
|
-
- The Linux network code was using `await import('fs')` dynamically when `fs` was already imported at the top
|
|
22
|
-
|
|
23
|
-
## Fixes Applied
|
|
24
|
-
|
|
25
|
-
### topProcesses.js
|
|
26
|
-
1. **Added fallback for ps --sort**:
|
|
27
|
-
```javascript
|
|
28
|
-
try {
|
|
29
|
-
// Try with --sort first
|
|
30
|
-
const result = await execFileAsync('ps', ['-eo', 'pid,pcpu,pmem,comm', '--sort=-pcpu'], ...);
|
|
31
|
-
} catch (sortError) {
|
|
32
|
-
// Fallback to unsorted and sort in JavaScript
|
|
33
|
-
const result = await execFileAsync('ps', ['-eo', 'pid,pcpu,pmem,comm'], ...);
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
2. **Improved parsing with filtering**:
|
|
38
|
-
- Now filters out invalid entries (pid <= 0)
|
|
39
|
-
- Handles missing/undefined CPU and memory values
|
|
40
|
-
- Always sorts by CPU in JavaScript as a backup
|
|
41
|
-
|
|
42
|
-
3. **Added timeouts**:
|
|
43
|
-
- All process listings now have 5-10 second timeouts to prevent hanging
|
|
44
|
-
|
|
45
|
-
### performanceTracker.js
|
|
46
|
-
1. **Fixed network metrics**:
|
|
47
|
-
- Corrected macOS netstat parsing (parts.length >= 10 instead of >= 7)
|
|
48
|
-
- Removed redundant `await import('fs')` on Linux
|
|
49
|
-
- Already using `fs` from the top-level import
|
|
50
|
-
|
|
51
|
-
2. **Enhanced error handling**:
|
|
52
|
-
- All metric collection methods now have comprehensive try/catch blocks
|
|
53
|
-
- Graceful degradation - if one metric fails, others continue
|
|
54
|
-
- Better logging with platform and error context
|
|
55
|
-
|
|
56
|
-
3. **Improved logging**:
|
|
57
|
-
- Added debug logs for successful operations
|
|
58
|
-
- More detailed error messages including platform info
|
|
59
|
-
- Stack traces for debugging
|
|
60
|
-
|
|
61
|
-
## Testing
|
|
62
|
-
|
|
63
|
-
### Quick Test (10 seconds)
|
|
64
|
-
```bash
|
|
65
|
-
cd dashcam-cli-minimal
|
|
66
|
-
node test-perf-linux.js
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
This will:
|
|
70
|
-
- Test `pidusage` library
|
|
71
|
-
- Test `getTopProcesses` function
|
|
72
|
-
- Test network metrics reading
|
|
73
|
-
- Test system metrics
|
|
74
|
-
- Run full performance tracker for 10 seconds
|
|
75
|
-
- Show detailed results and identify any failures
|
|
76
|
-
|
|
77
|
-
### Full Recording Test
|
|
78
|
-
```bash
|
|
79
|
-
# Start a recording with performance tracking
|
|
80
|
-
dashcam start
|
|
81
|
-
|
|
82
|
-
# Do some work for 10-15 seconds
|
|
83
|
-
# ...
|
|
84
|
-
|
|
85
|
-
# Stop recording
|
|
86
|
-
dashcam stop
|
|
87
|
-
|
|
88
|
-
# Check the output for performance data
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Expected Output
|
|
92
|
-
The test should show:
|
|
93
|
-
```
|
|
94
|
-
✓ pidusage: PASS
|
|
95
|
-
✓ topProcesses: PASS
|
|
96
|
-
✓ networkMetrics: PASS
|
|
97
|
-
✓ systemMetrics: PASS
|
|
98
|
-
✓ performanceTracker: PASS
|
|
99
|
-
|
|
100
|
-
Overall: ✓ ALL TESTS PASSED
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Platform-Specific Notes
|
|
104
|
-
|
|
105
|
-
### Ubuntu/Debian
|
|
106
|
-
- Should work on all versions
|
|
107
|
-
- Uses `/proc/net/dev` for network stats
|
|
108
|
-
- Falls back if `ps --sort` not available
|
|
109
|
-
|
|
110
|
-
### Alpine Linux / Docker
|
|
111
|
-
- BusyBox `ps` detected automatically
|
|
112
|
-
- Sorts processes in JavaScript instead
|
|
113
|
-
- May have limited network stats in containers
|
|
114
|
-
|
|
115
|
-
### CentOS/RHEL
|
|
116
|
-
- Full GNU ps support
|
|
117
|
-
- Should use `--sort` option
|
|
118
|
-
- Full network stats available
|
|
119
|
-
|
|
120
|
-
## Troubleshooting
|
|
121
|
-
|
|
122
|
-
### If performance data is still empty:
|
|
123
|
-
|
|
124
|
-
1. **Check pidusage works**:
|
|
125
|
-
```bash
|
|
126
|
-
node -e "import('pidusage').then(m => m.default(process.pid).then(console.log))"
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
2. **Check ps command**:
|
|
130
|
-
```bash
|
|
131
|
-
ps -eo pid,pcpu,pmem,comm --sort=-pcpu | head -5
|
|
132
|
-
# If this fails, try:
|
|
133
|
-
ps -eo pid,pcpu,pmem,comm | head -5
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
3. **Check /proc/net/dev exists**:
|
|
137
|
-
```bash
|
|
138
|
-
cat /proc/net/dev
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
4. **Run with verbose logging**:
|
|
142
|
-
```bash
|
|
143
|
-
dashcam start --verbose
|
|
144
|
-
# ... do work ...
|
|
145
|
-
dashcam stop --verbose
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
5. **Check the performance file directly**:
|
|
149
|
-
```bash
|
|
150
|
-
# Look for performance.jsonl in the output directory
|
|
151
|
-
cat ~/.dashcam/recordings/*/performance.jsonl | head -1 | jq
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## What Gets Tracked
|
|
155
|
-
|
|
156
|
-
Even with the fixes, the following is tracked every 5 seconds:
|
|
157
|
-
|
|
158
|
-
- ✅ Process CPU usage (dashcam process)
|
|
159
|
-
- ✅ Process memory usage (dashcam process)
|
|
160
|
-
- ✅ System-wide memory usage
|
|
161
|
-
- ✅ System CPU core count
|
|
162
|
-
- ✅ Top 10 processes by CPU
|
|
163
|
-
- ✅ Network I/O (where available)
|
|
164
|
-
|
|
165
|
-
## API Upload
|
|
166
|
-
|
|
167
|
-
The performance data is uploaded to the API with the recording:
|
|
168
|
-
|
|
169
|
-
```javascript
|
|
170
|
-
{
|
|
171
|
-
performance: {
|
|
172
|
-
samples: [...], // Array of samples taken during recording
|
|
173
|
-
summary: { // Aggregated statistics
|
|
174
|
-
avgProcessCPU: 12.3,
|
|
175
|
-
maxProcessCPU: 18.7,
|
|
176
|
-
avgProcessMemoryMB: 128.0,
|
|
177
|
-
maxProcessMemoryMB: 192.0,
|
|
178
|
-
// ...
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
This data is then displayed in the web UI under the "Performance" tab.
|
package/LOG_TRACKING_GUIDE.md
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
# Dashcam CLI - Log Tracking Guide
|
|
2
|
-
|
|
3
|
-
The Dashcam CLI can track both **file-based logs** (from CLI applications) and **web browser logs** (from browser extensions). This guide explains how to use the log tracking features.
|
|
4
|
-
|
|
5
|
-
## File Log Tracking (CLI Applications)
|
|
6
|
-
|
|
7
|
-
### Adding Log Files to Track
|
|
8
|
-
|
|
9
|
-
Track log files during recordings:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# Add a single log file
|
|
13
|
-
dashcam logs --add /var/log/myapp.log
|
|
14
|
-
|
|
15
|
-
# Add multiple log files
|
|
16
|
-
dashcam logs --add /tmp/debug.log
|
|
17
|
-
dashcam logs --add ~/.npm/_logs/npm.log
|
|
18
|
-
dashcam logs --add /var/log/nginx/access.log
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Removing Log Files
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Remove a log file from tracking
|
|
25
|
-
dashcam logs --remove /var/log/myapp.log
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Viewing Tracked Files
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# List all currently tracked log files
|
|
32
|
-
dashcam logs --list
|
|
33
|
-
|
|
34
|
-
# Show detailed tracking status
|
|
35
|
-
dashcam logs --status
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Web Browser Log Tracking
|
|
39
|
-
|
|
40
|
-
### Setting Up Web App Tracking
|
|
41
|
-
|
|
42
|
-
Web log tracking requires configuring patterns for URLs you want to monitor:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Create a config file for web apps (web-logs.json)
|
|
46
|
-
cat > web-logs.json << 'EOF'
|
|
47
|
-
[
|
|
48
|
-
{
|
|
49
|
-
"id": "my-web-app",
|
|
50
|
-
"type": "web",
|
|
51
|
-
"name": "My Web Application",
|
|
52
|
-
"enabled": true,
|
|
53
|
-
"patterns": [
|
|
54
|
-
"*localhost:3000*",
|
|
55
|
-
"*myapp.com*",
|
|
56
|
-
"*staging.myapp.com*"
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"id": "github",
|
|
61
|
-
"type": "web",
|
|
62
|
-
"name": "GitHub",
|
|
63
|
-
"enabled": true,
|
|
64
|
-
"patterns": [
|
|
65
|
-
"*github.com*"
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
EOF
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Updating Web Log Configuration
|
|
73
|
-
|
|
74
|
-
```javascript
|
|
75
|
-
// In your Node.js script or through the API
|
|
76
|
-
import { logsTrackerManager } from './lib/logs/index.js';
|
|
77
|
-
|
|
78
|
-
const webConfig = [
|
|
79
|
-
{
|
|
80
|
-
id: 'my-app',
|
|
81
|
-
type: 'web',
|
|
82
|
-
name: 'My Application',
|
|
83
|
-
enabled: true,
|
|
84
|
-
patterns: ['*localhost:3000*', '*myapp.com*']
|
|
85
|
-
}
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
logsTrackerManager.updateLogsConfig(webConfig);
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Recording with Log Tracking
|
|
92
|
-
|
|
93
|
-
### Start a Recording with Logs
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# Start recording (logs are automatically included if configured)
|
|
97
|
-
dashcam record --duration 30
|
|
98
|
-
|
|
99
|
-
# The recording will include:
|
|
100
|
-
# - All tracked log files (--add files above)
|
|
101
|
-
# - Web browser events (if browser extension is installed)
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Browser Extension Setup
|
|
105
|
-
|
|
106
|
-
1. **Install the Dashcam browser extension** (Chrome/Firefox)
|
|
107
|
-
2. **The CLI automatically starts a WebSocket server** on ports: 10368, 16240, 21855, 24301, or 25928
|
|
108
|
-
3. **Extension connects automatically** when CLI is running
|
|
109
|
-
4. **Web events are captured** based on your URL patterns
|
|
110
|
-
|
|
111
|
-
## Log Event Types
|
|
112
|
-
|
|
113
|
-
### File Logs
|
|
114
|
-
- **Line events**: Each new line written to tracked files
|
|
115
|
-
- **Timestamps**: Precise timing for synchronization with video
|
|
116
|
-
- **Error detection**: Automatic highlighting of error lines
|
|
117
|
-
|
|
118
|
-
### Web Logs
|
|
119
|
-
- **Console logs**: `console.log()`, `console.error()`, etc.
|
|
120
|
-
- **Network requests**: HTTP requests and responses
|
|
121
|
-
- **Navigation events**: Page loads and URL changes
|
|
122
|
-
- **Tab management**: Tab switches and window focus
|
|
123
|
-
|
|
124
|
-
## Example Workflow
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
# 1. Add log files to track
|
|
128
|
-
dashcam logs --add /var/log/myapp.log
|
|
129
|
-
dashcam logs --add /tmp/debug.log
|
|
130
|
-
|
|
131
|
-
# 2. Check status
|
|
132
|
-
dashcam logs --status
|
|
133
|
-
# Output:
|
|
134
|
-
# Log tracking status:
|
|
135
|
-
# Active recording instances: 0
|
|
136
|
-
# Configured CLI log files: 2
|
|
137
|
-
# Total recent events: 15
|
|
138
|
-
# File tracker details:
|
|
139
|
-
# /var/log/myapp.log: 8 events (last minute)
|
|
140
|
-
# /tmp/debug.log: 7 events (last minute)
|
|
141
|
-
|
|
142
|
-
# 3. Start recording
|
|
143
|
-
dashcam record --duration 60
|
|
144
|
-
|
|
145
|
-
# 4. During recording:
|
|
146
|
-
# - CLI monitors all tracked log files in real-time
|
|
147
|
-
# - Browser extension sends web events via WebSocket
|
|
148
|
-
# - All events are timestamped and synchronized
|
|
149
|
-
|
|
150
|
-
# 5. After recording:
|
|
151
|
-
# - Logs are automatically trimmed to match video duration
|
|
152
|
-
# - Events are saved in JSONL format alongside video
|
|
153
|
-
# - Logs can be replayed in sync with video
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Advanced Configuration
|
|
157
|
-
|
|
158
|
-
### Custom WebSocket Port
|
|
159
|
-
|
|
160
|
-
```javascript
|
|
161
|
-
// If you need to use specific ports
|
|
162
|
-
import { server } from './lib/websocket/server.js';
|
|
163
|
-
await server.start(); // Uses predefined port list
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Pattern Matching for Web Apps
|
|
167
|
-
|
|
168
|
-
Patterns support wildcards:
|
|
169
|
-
- `*example.com*` - Matches any URL containing "example.com"
|
|
170
|
-
- `*localhost:3000*` - Matches local development server
|
|
171
|
-
- `*github.com/myuser/*` - Matches specific GitHub paths
|
|
172
|
-
|
|
173
|
-
### Log File Requirements
|
|
174
|
-
|
|
175
|
-
- **Files must exist** before adding to tracking
|
|
176
|
-
- **Files must be readable** by the CLI process
|
|
177
|
-
- **Real-time writes** are monitored (uses `tail` library)
|
|
178
|
-
- **Log rotation** is automatically handled
|
|
179
|
-
|
|
180
|
-
## Troubleshooting
|
|
181
|
-
|
|
182
|
-
### Common Issues
|
|
183
|
-
|
|
184
|
-
1. **"Log file does not exist"**
|
|
185
|
-
```bash
|
|
186
|
-
# Ensure file exists first
|
|
187
|
-
touch /var/log/myapp.log
|
|
188
|
-
dashcam logs --add /var/log/myapp.log
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
2. **"WebSocket connection failed"**
|
|
192
|
-
- Check that browser extension is installed
|
|
193
|
-
- Verify no firewall blocking local ports
|
|
194
|
-
- Ensure CLI is running when opening browser
|
|
195
|
-
|
|
196
|
-
3. **"No events captured"**
|
|
197
|
-
```bash
|
|
198
|
-
# Check if files are being written to
|
|
199
|
-
tail -f /var/log/myapp.log
|
|
200
|
-
|
|
201
|
-
# Verify tracking status
|
|
202
|
-
dashcam logs --status
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Getting Help
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
# Show all log tracking options
|
|
209
|
-
dashcam logs --help
|
|
210
|
-
|
|
211
|
-
# Show general CLI help
|
|
212
|
-
dashcam --help
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## Integration with Recordings
|
|
216
|
-
|
|
217
|
-
When you create a recording, all configured logs are:
|
|
218
|
-
|
|
219
|
-
1. **Automatically included** in the recording
|
|
220
|
-
2. **Synchronized** with video timestamps
|
|
221
|
-
3. **Trimmed** to match video start/end times
|
|
222
|
-
4. **Saved** in JSON Lines format for replay
|
|
223
|
-
5. **Uploaded** along with video files
|
|
224
|
-
|
|
225
|
-
The result is a complete recording with both visual and log context, making debugging and analysis much more effective.
|
package/NPM_PUBLISH_FIX.md
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# NPM Publish & Version Sync Issues
|
|
2
|
-
|
|
3
|
-
## Problem
|
|
4
|
-
|
|
5
|
-
The npm publish workflow was failing with:
|
|
6
|
-
```
|
|
7
|
-
npm error 404 'dashcam@1.0.1-beta.17' is not in this registry.
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
## Root Cause
|
|
11
|
-
|
|
12
|
-
**Version drift** between local git tags, package.json, and npm registry:
|
|
13
|
-
|
|
14
|
-
- **NPM registry**: `1.0.1-beta.13` (latest successfully published)
|
|
15
|
-
- **Local package.json**: `1.0.1-beta.16` (from failed publish attempts)
|
|
16
|
-
- **Git tags**: Only up to `v1.0.1-beta.9`
|
|
17
|
-
|
|
18
|
-
This happened because the workflow:
|
|
19
|
-
1. Bumped version in package.json
|
|
20
|
-
2. Created git tag
|
|
21
|
-
3. Tried to publish
|
|
22
|
-
4. **Publish failed** (possibly due to test failures or video encoding issues)
|
|
23
|
-
5. Git changes were not reverted, leaving version incremented
|
|
24
|
-
|
|
25
|
-
## Fixes Applied
|
|
26
|
-
|
|
27
|
-
### 1. Updated Publish Workflow
|
|
28
|
-
|
|
29
|
-
**Before**: Version bump → Push → Publish (wrong order!)
|
|
30
|
-
|
|
31
|
-
**After**:
|
|
32
|
-
1. Sync with npm registry version
|
|
33
|
-
2. Bump version
|
|
34
|
-
3. **Publish first** ✅
|
|
35
|
-
4. Push only if publish succeeded ✅
|
|
36
|
-
|
|
37
|
-
```yaml
|
|
38
|
-
- name: Bump version
|
|
39
|
-
run: |
|
|
40
|
-
# Get current version from npm
|
|
41
|
-
CURRENT_NPM_VERSION=$(npm view dashcam dist-tags.beta)
|
|
42
|
-
|
|
43
|
-
# Sync before bumping
|
|
44
|
-
npm version $CURRENT_NPM_VERSION --no-git-tag-version --allow-same-version
|
|
45
|
-
|
|
46
|
-
# Bump to next
|
|
47
|
-
npm version prerelease --preid=beta
|
|
48
|
-
|
|
49
|
-
- name: Publish to npm
|
|
50
|
-
run: npm publish --access public --tag beta
|
|
51
|
-
|
|
52
|
-
- name: Push changes # Only runs if publish succeeded
|
|
53
|
-
run: git push --follow-tags
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### 2. Created Version Sync Script
|
|
57
|
-
|
|
58
|
-
`scripts/sync-version.sh` - Helps detect and fix version drift:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
./scripts/sync-version.sh
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
This will:
|
|
65
|
-
- Compare local version with npm registry
|
|
66
|
-
- Offer to sync package.json
|
|
67
|
-
- Show unpublished git tags that need cleanup
|
|
68
|
-
|
|
69
|
-
### 3. Synced package.json
|
|
70
|
-
|
|
71
|
-
Reset from `1.0.1-beta.16` → `1.0.1-beta.13` (current npm version)
|
|
72
|
-
|
|
73
|
-
## Video Issue Connection
|
|
74
|
-
|
|
75
|
-
The failed publishes were likely caused by **test failures due to the video encoding bugs** we fixed:
|
|
76
|
-
|
|
77
|
-
- Frame rate conflicts
|
|
78
|
-
- Buffer size issues
|
|
79
|
-
- Frame dropping
|
|
80
|
-
- Incomplete container metadata
|
|
81
|
-
|
|
82
|
-
All of these are now fixed in the recorder.js, so future CI runs should succeed.
|
|
83
|
-
|
|
84
|
-
## Next Steps
|
|
85
|
-
|
|
86
|
-
1. ✅ Package.json is synced
|
|
87
|
-
2. ✅ Workflow is fixed
|
|
88
|
-
3. ⚠️ Need to clean up unpublished git tags manually (optional):
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# List tags
|
|
92
|
-
git tag | grep beta
|
|
93
|
-
|
|
94
|
-
# Delete local tags for unpublished versions (14-16)
|
|
95
|
-
git tag -d v1.0.1-beta.14 v1.0.1-beta.15 v1.0.1-beta.16
|
|
96
|
-
|
|
97
|
-
# If they exist on remote, delete them
|
|
98
|
-
git push origin :refs/tags/v1.0.1-beta.14
|
|
99
|
-
git push origin :refs/tags/v1.0.1-beta.15
|
|
100
|
-
git push origin :refs/tags/v1.0.1-beta.16
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
4. Push the fixes to trigger a new publish
|
|
104
|
-
5. Next version will be `1.0.1-beta.14` ✅
|
package/PERFORMANCE_TRACKING.md
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# Performance Tracking
|
|
2
|
-
|
|
3
|
-
The Dashcam CLI now includes comprehensive performance tracking during recordings. This feature monitors CPU and memory usage throughout the recording session and includes the data in the log files.
|
|
4
|
-
|
|
5
|
-
## What's Tracked
|
|
6
|
-
|
|
7
|
-
### 1. Dashcam Process Metrics
|
|
8
|
-
- **CPU Usage**: Percentage of CPU used by the Dashcam process
|
|
9
|
-
- **Memory Usage**: Memory consumed by the Dashcam process in bytes and MB
|
|
10
|
-
- **Process Info**: PID, parent PID, CPU time, elapsed time
|
|
11
|
-
|
|
12
|
-
### 2. System-Wide Metrics
|
|
13
|
-
- **Total Memory**: System total and free memory
|
|
14
|
-
- **Memory Usage Percentage**: Overall system memory utilization
|
|
15
|
-
- **CPU Count**: Number of CPU cores available
|
|
16
|
-
|
|
17
|
-
### 3. Top Processes
|
|
18
|
-
- **Top 10 by CPU**: The most CPU-intensive processes running on the system
|
|
19
|
-
- **Top 10 by Memory**: The most memory-intensive processes running on the system
|
|
20
|
-
- **Process Details**: For each top process, tracks:
|
|
21
|
-
- Process name
|
|
22
|
-
- PID
|
|
23
|
-
- CPU usage percentage
|
|
24
|
-
- Memory usage in bytes
|
|
25
|
-
- Parent process ID
|
|
26
|
-
- CPU time and elapsed time
|
|
27
|
-
|
|
28
|
-
## Sampling Frequency
|
|
29
|
-
|
|
30
|
-
Performance metrics are sampled every **1 second** (1000ms) during the recording session.
|
|
31
|
-
|
|
32
|
-
## Output Format
|
|
33
|
-
|
|
34
|
-
Performance data is included in the recording result with the following structure:
|
|
35
|
-
|
|
36
|
-
```javascript
|
|
37
|
-
{
|
|
38
|
-
performance: {
|
|
39
|
-
samples: [
|
|
40
|
-
{
|
|
41
|
-
timestamp: 1700000000000,
|
|
42
|
-
elapsedMs: 1000,
|
|
43
|
-
system: {
|
|
44
|
-
totalMemory: 17179869184,
|
|
45
|
-
freeMemory: 8589934592,
|
|
46
|
-
usedMemory: 8589934592,
|
|
47
|
-
memoryUsagePercent: 50.0,
|
|
48
|
-
cpuCount: 8
|
|
49
|
-
},
|
|
50
|
-
process: {
|
|
51
|
-
cpu: 15.5,
|
|
52
|
-
memory: 134217728,
|
|
53
|
-
pid: 12345,
|
|
54
|
-
ppid: 1,
|
|
55
|
-
ctime: 5000,
|
|
56
|
-
elapsed: 10000
|
|
57
|
-
},
|
|
58
|
-
topProcesses: [
|
|
59
|
-
{
|
|
60
|
-
pid: 54321,
|
|
61
|
-
name: "ffmpeg",
|
|
62
|
-
cpu: 85.2,
|
|
63
|
-
memory: 268435456,
|
|
64
|
-
ppid: 12345,
|
|
65
|
-
ctime: 8500,
|
|
66
|
-
elapsed: 10000
|
|
67
|
-
},
|
|
68
|
-
// ... up to 10 processes
|
|
69
|
-
],
|
|
70
|
-
totalProcesses: 342
|
|
71
|
-
}
|
|
72
|
-
// ... one sample per second
|
|
73
|
-
],
|
|
74
|
-
summary: {
|
|
75
|
-
durationMs: 10000,
|
|
76
|
-
sampleCount: 10,
|
|
77
|
-
monitorInterval: 1000,
|
|
78
|
-
avgProcessCPU: 12.3,
|
|
79
|
-
maxProcessCPU: 18.7,
|
|
80
|
-
avgProcessMemoryBytes: 134217728,
|
|
81
|
-
avgProcessMemoryMB: 128.0,
|
|
82
|
-
maxProcessMemoryBytes: 201326592,
|
|
83
|
-
maxProcessMemoryMB: 192.0,
|
|
84
|
-
avgSystemMemoryUsagePercent: 52.5,
|
|
85
|
-
maxSystemMemoryUsagePercent: 55.3,
|
|
86
|
-
totalSystemMemoryBytes: 17179869184,
|
|
87
|
-
totalSystemMemoryGB: 16.0
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Summary Statistics
|
|
94
|
-
|
|
95
|
-
The performance tracker calculates summary statistics including:
|
|
96
|
-
- **Average and Max Process CPU**: How much CPU the Dashcam process used
|
|
97
|
-
- **Average and Max Process Memory**: Memory consumed by the Dashcam process
|
|
98
|
-
- **Average and Max System Memory Usage**: Overall system memory pressure
|
|
99
|
-
- **Total Duration**: How long the tracking ran
|
|
100
|
-
- **Sample Count**: Number of samples collected
|
|
101
|
-
|
|
102
|
-
## Logging
|
|
103
|
-
|
|
104
|
-
Performance data is logged to the standard Dashcam log files:
|
|
105
|
-
- `~/.dashcam/logs/combined.log` - All log levels including performance samples
|
|
106
|
-
- `~/.dashcam/logs/debug.log` - Debug-level information
|
|
107
|
-
- Console output when running with `--verbose` flag
|
|
108
|
-
|
|
109
|
-
## Testing
|
|
110
|
-
|
|
111
|
-
Run the performance tracking test:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
node test-performance-tracking.js
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
This will:
|
|
118
|
-
1. Start a 10-second recording
|
|
119
|
-
2. Collect performance samples every second
|
|
120
|
-
3. Display detailed performance statistics
|
|
121
|
-
4. Show the top 10 processes at the end of the recording
|
|
122
|
-
|
|
123
|
-
## Use Cases
|
|
124
|
-
|
|
125
|
-
Performance tracking helps with:
|
|
126
|
-
- **Debugging Performance Issues**: Identify when recordings are resource-intensive
|
|
127
|
-
- **Optimization**: Track the impact of code changes on resource usage
|
|
128
|
-
- **System Monitoring**: Understand what other processes are running during recordings
|
|
129
|
-
- **Troubleshooting**: Correlate performance issues with specific applications or system states
|
|
130
|
-
- **Capacity Planning**: Understand resource requirements for different recording scenarios
|
|
131
|
-
|
|
132
|
-
## Implementation Details
|
|
133
|
-
|
|
134
|
-
The performance tracker uses:
|
|
135
|
-
- `pidusage` - For detailed per-process CPU and memory statistics
|
|
136
|
-
- `ps-list` - For listing all system processes
|
|
137
|
-
- `os` module - For system-wide memory and CPU information
|
|
138
|
-
|
|
139
|
-
The tracker runs in parallel with the recording and has minimal overhead (~1% CPU on average).
|