observio
v2.0.2
Published
A developer-focused monitoring package for Express apps with real-time performance insights, slow API tracking, and clean dashboard UI.
Downloads
4
Maintainers
Readme
Apex Monitoring v2.0
A developer-focused monitoring package for Express.js applications with real-time performance insights, slow API tracking, and a clean dashboard UI.
Features
🚀 Developer-Focused Metrics
- Top 5 Slowest APIs with max response times
- Error Rate Tracking with real-time updates
- Average Response Time monitoring
- CPU & Memory Usage with trend indicators
- Request Rate visualization
- Status Code Distribution
📊 Real-Time Dashboard
- Clean, modern UI optimized for backend developers
- Dark/Light theme support
- Responsive design for all screen sizes
- Live data updates every 2 seconds
- Interactive charts powered by ApexCharts
🔧 Easy Integration
- Zero-configuration setup
- Minimal performance overhead
- Prometheus metrics export
- Customizable monitoring path
Installation
npm install observaQuick Start
const express = require("express");
const apexMonitoring = require("observa");
const app = express();
// Your Express routes
app.get("/", (req, res) => {
res.json({ message: "Hello World!" });
});
// Initialize monitoring
const monitor = apexMonitoring(app, {
path: "/monitor", // Dashboard path (default: '/monitor')
silent: false, // Disable console logs (default: false)
updateInterval: 2000, // Update interval in ms (default: 2000)
maxSlowApis: 10, // Number of slow APIs to track (default: 10)
});
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
console.log("Monitor dashboard: http://localhost:3000/monitor");
});Configuration Options
| Option | Type | Default | Description |
| ---------------- | ------- | ---------- | -------------------------------------------- |
| path | string | /monitor | Base route path for the monitoring dashboard |
| silent | boolean | false | Disable console logs |
| updateInterval | number | 2000 | Metrics update interval in milliseconds |
| maxSlowApis | number | 10 | Maximum number of slow APIs to track |
API Reference
Monitor Instance Methods
const monitor = apexMonitoring(app, options);
// Get current metrics
const metrics = monitor.getMetrics();
// Get slow APIs data
const slowApis = monitor.getSlowApis();
// Update system metrics manually
monitor.updateSystemMetrics();
// Reset all metrics
monitor.resetMetrics();API Endpoints
- Dashboard:
GET /monitor- Main monitoring dashboard - Metrics API:
GET /monitor/api/stats- JSON API for metrics data - Prometheus:
GET /monitor/metrics- Prometheus metrics export
Dashboard Features
Key Metrics Cards
- CPU Usage: Real-time CPU utilization with trend indicators
- Memory Usage: RSS memory consumption with change tracking
- Error Rate: Percentage of failed requests (4xx/5xx)
- Avg Response Time: Average response time across all endpoints
Slow APIs Section
- Top 5 Slowest APIs ranked by average response time
- Method badges (GET, POST, PUT, DELETE, PATCH)
- Max response time for each endpoint
- Request count and error rate per API
Performance Charts
- System Resources: CPU and Memory usage over time
- Request Rate: Requests per second visualization
- Status Codes: Distribution of HTTP status codes
System Information
- Uptime: Server uptime in human-readable format
- Total Requests: Cumulative request count
- Active Connections: Current active connections
- Node.js Version: Runtime version information
- Platform: Operating system details
- CPU Cores: Number of CPU cores
Example Usage
const express = require("express");
const apexMonitoring = require("observa");
const app = express();
// Add some test routes
app.get("/api/users", (req, res) => {
setTimeout(() => {
res.json({ users: ["John", "Jane"] });
}, Math.random() * 100);
});
app.get("/api/slow", (req, res) => {
setTimeout(() => {
res.json({ message: "Slow endpoint" });
}, Math.random() * 2000 + 500);
});
app.get("/api/error", (req, res) => {
res.status(500).json({ error: "Server error" });
});
// Initialize monitoring
const monitor = apexMonitoring(app, {
path: "/monitor",
maxSlowApis: 5,
});
app.listen(3000);Performance Impact
- Minimal overhead: < 1ms per request
- Memory efficient: Configurable data retention
- Non-blocking: All operations are asynchronous
- Production ready: Tested with high-traffic applications
Browser Support
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License - see LICENSE file for details.
Changelog
v2.0.0
- Complete UI redesign focused on backend developers
- Added top 5 slowest APIs tracking with max response times
- Enhanced metrics: error rate, average response time
- Improved performance with better data structures
- Added dark/light theme support
- Responsive design for mobile devices
- Better chart visualizations with ApexCharts
v1.0.0
- Initial release with basic monitoring features
- CPU, memory, and request tracking
- Basic dashboard UI
