A lightweight, self-hosted observability solution for Node.js applications. Monitor requests, track errors, and analyze performance metrics in real-time through an intuitive dashboard.
- π Real-time request monitoring
- β‘ Performance metrics and slow request tracking
- π Detailed request/response logging
- π¦ Snapshot functionality for state preservation
- π¨ Dark/Light mode support
- π± Responsive design for all devices
- Installation
- Quick Start
- Configuration
- API Reference
- Dashboard Features
- Snapshots
- Dependencies
- Guarantees
- License
-
Copy the
observabilityfolder to your project'sutilsdirectory:your-project/ βββ node_modules/ βββ utils/ β βββ observability/ # Copy this folder βββ app.js βββ package.json -
The observability module is now ready to be imported in your project.
const express = require('express');
const path = require('path');
const ObservabilityJS = require('./utils/observability/ObservabilityJS');
const app = express();
const PORT = 3000;
// Initialize observability
const obs = new ObservabilityJS({
appToObserve: app,
logFilePrefix: './logs/observability',
maxEntriesPerFile: 100,
ignorePaths: ['/health', '/metrics']
});
// Serve the dashboard
app.use('/observability', express.static(path.join(__dirname, 'utils/observability')));
app.use('/observability/api', require('./utils/observability/setup')(app));
// Your routes here
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.listen(PORT, () => {
console.log(`Server running at http://localhost:${PORT}`);
console.log(`Dashboard available at http://localhost:${PORT}/observability`);
});const ObservabilityJS = require('./utils/observability/ObservabilityJS');
const obs = new ObservabilityJS();
// Manual span creation
const span = obs.startSpan({
method: 'GET',
endpoint: '/api/data'
});
// Your code here...
// End the span when done
obs.endSpan(span, { statusCode: 200 });| Option | Type | Default | Description |
|---|---|---|---|
appToObserve |
Express App |
null |
Optional Express app to automatically monitor |
logFilePrefix |
String |
'./logs/observability' |
Path prefix for log files |
maxEntriesPerFile |
Number |
100 |
Maximum entries per log file before rotation |
ignorePaths |
Array<String> |
[] |
Paths to exclude from monitoring |
Start a new monitoring span.
const span = obs.startSpan({
method: 'GET',
endpoint: '/api/users',
metadata: { userId: 123 } // Optional additional data
});End a monitoring span.
obs.endSpan(span, {
statusCode: 200,
error: errorObject // Optional error object
});Log a custom event.
obs.log({
level: 'info', // 'info', 'warn', 'error'
message: 'User logged in',
metadata: { userId: 123 }
});GET /observability- Dashboard UIGET /observability/api/stats- Get current statisticsGET /observability/api/logs- Get paginated logsGET /observability/api/slow- Get slow requestsPOST /observability/api/snapshots- Create a new snapshotGET /observability/api/snapshots- List all snapshotsGET /observability/api/snapshots/:id- Get a specific snapshotGET /observability/api/snapshots/:id/export- Export a snapshotDELETE /observability/api/snapshots/:id- Delete a snapshot
View request metrics, success/failure rates, and response times in real-time.
Detailed logs of all monitored requests with filtering capabilities.
Identify slow endpoints and performance bottlenecks.
Create point-in-time snapshots of your application's state for later analysis.
- Click the "Create Snapshot" button in the dashboard
- Optionally provide a name
- The snapshot will include:
- Current statistics
- Recent logs
- Slow request data
- View: Click on a snapshot to view its details
- Download: Export snapshot data as JSON
- Delete: Remove old snapshots to save space
- Node.js 14+
- Express 4.x (optional, for automatic request monitoring)
- No external database required (uses file system for storage)
- Performance: Minimal impact on application performance
- Reliability: Built-in error handling and recovery
- Security: No external dependencies or data collection
- Privacy: All data stays within your infrastructure
- Persistence: Logs and snapshots are stored on the local filesystem
- Scalability: Best suited for small to medium applications
- Backup: No automatic backup of logs or snapshots
MIT
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
Anastasios Bolkas
- GitHub: @anastasios-b
- Portfolio: anastasios-bolkas.tech