Node.js profiling library that automatically uploads heap profiles to Polar Signals.
npm install @polarsignals/pprof
const { heapProfiler, monitorOutOfMemory } = require('@polarsignals/pprof');
// Start heap profiling
heapProfiler.start(512 * 1024, 64); // 512KB sampling, stack depth 64
// Monitor for out-of-memory events and auto-upload profiles
monitorOutOfMemory({
exportOptions: {
labels: {
'service': 'my-app',
'version': '1.0.0'
}
}
});
Set your Polar Signals API token:
export POLAR_SIGNALS_TOKEN=your_token_here
- Automatic heap profile collection
- Out-of-memory monitoring with automatic profile upload
- Background upload process to ensure profiles are saved even during crashes
- Configurable labels for profile metadata