Download the PHP package rylxes/laravel-observability without Composer
On this page you can find all versions of the php package rylxes/laravel-observability. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rylxes/laravel-observability
More information about rylxes/laravel-observability
Files in rylxes/laravel-observability
Package laravel-observability
Short Description Production-grade observability and APM plugin for Laravel applications with OpenTelemetry, Prometheus, and AI-powered anomaly detection
License MIT
Homepage https://github.com/rylxes/laravel-observability
Informations about the package laravel-observability
Laravel Observability Plugin
Full Documentation โ Complete usage guide, configuration reference, and API docs.
๐ Production-Grade Observability & APM for Laravel Applications
A lightweight, database-agnostic alternative to full APM tools, optimized specifically for Laravel apps. Features request tracing, performance profiling, slow query detection, OpenTelemetry/Prometheus integration, AI-based anomaly detection, and smart alerting.
โจ Features
Core Capabilities
- ๐ Request Tracing - Capture HTTP requests with route, controller, duration, memory usage, headers
- ๐๏ธ Database Query Monitoring - Track all queries, detect N+1 problems, identify slow queries
- โก Performance Profiling - Per-route metrics, P50/P95/P99 latency, bottleneck identification
- ๐ Slow Query Detector - Automatic detection with stack traces and optimization recommendations
- ๐ค AI Anomaly Detection - Statistical analysis (Z-score) to detect unusual patterns
- ๐ OpenTelemetry Export - OTLP protocol support for distributed tracing
- ๐ Prometheus Metrics -
/metricsendpoint for Prometheus scraping - ๐ Smart Alerting - Slack/Telegram notifications with throttling and deduplication
- ๐จ Built-In Dashboard UI + API - Authenticated web dashboard at
/admin/observabilityplus API endpoints for custom implementations - ๐๏ธ Database Agnostic - Works with MySQL, PostgreSQL, SQLite, SQL Server
๐ฆ Installation
1. Install via Composer
2. Run Installation Command
This will:
- Publish configuration file to
config/observability.php - Run migrations (creates observability tables)
- Display middleware setup instructions
3. Register Middleware
Add to app/Http/Kernel.php (Laravel 10) or bootstrap/app.php (Laravel 11):
Laravel 10:
Laravel 11:
4. Configure Environment
Add to .env:
๐ Usage
Using the Facade
Artisan Commands
Analyze Performance:
Prune Old Data:
Web Dashboard (Authenticated)
By default, the package includes a web dashboard at:
It uses your app's configured auth guards (observability.dashboard.guards), so it works with your existing login/session setup while still exposing the API for internal tools.
API Endpoints
All endpoints are prefixed with /api/observability:
| Endpoint | Description |
|---|---|
GET /metrics |
Prometheus metrics (text format) |
GET /dashboard |
Performance dashboard data (JSON, supports ?days=1..30) |
GET /traces |
Recent request traces |
GET /traces/{traceId} |
Single trace detail |
GET /alerts |
Recent alerts |
POST /alerts/{id}/resolve |
Resolve an alert |
GET /health |
Health check |
Example:
โ๏ธ Configuration
Database Connection
By default, uses your app's default database connection. To use a separate database:
Then configure the connection in config/database.php.
Request Tracing
Slow Query Detection
Anomaly Detection (AI)
Notifications
Data Retention
Dashboard UI
๐ Integrations
Prometheus
Enable in .env:
Configure Prometheus to scrape:
OpenTelemetry
Grafana Dashboard
Import the included Grafana dashboard template:
๐ค AI Anomaly Detection
The plugin uses statistical analysis (Z-score method) to detect anomalies:
- Baseline Calculation: Analyzes last 7 days (configurable)
- Statistical Analysis: Calculates mean and standard deviation
- Anomaly Detection: Flags values > 3ฯ from baseline
- Auto-Alerting: Creates alerts for critical anomalies
Monitored Metrics:
- Response time
- Memory usage
- Error rate
- Query execution time
Example:
๐ Performance Insights
Dashboard Data Structure
๐ Security Considerations
- Sensitive Data: Disable
capture_payloadandcapture_headersin production - Authentication: All API endpoints require authentication by default
- Data Sanitization: Passwords, tokens automatically redacted
- Rate Limiting: Consider adding rate limits to metrics endpoints
๐งช Testing
Run tests:
Local Development Loop (Deploy Once)
This lets you test package changes locally through /admin/observability, then ship one release after validation.
With coverage:
๐ Database Schema
The plugin creates 4 tables (with configurable prefix):
| Table | Purpose |
|---|---|
observability_traces |
HTTP request traces |
observability_queries |
Database query logs |
observability_metrics |
Aggregated performance metrics |
observability_alerts |
Generated alerts |
All tables use your app's database connection (MySQL, PostgreSQL, SQLite, SQL Server).
๐ค Contributing
Contributions welcome! Please see CONTRIBUTING.md for details.
๐ License
MIT License. See LICENSE file.
๐ Credits
Built with โค๏ธ for the Laravel community by Sherriff Agboola.
- OpenTelemetry PHP: https://github.com/open-telemetry/opentelemetry-php
- Prometheus PHP: https://github.com/PromPHP/prometheus_client_php
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
โญ If you find this useful, please star the repository!
All versions of laravel-observability with dependencies
guzzlehttp/guzzle Version ^7.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
open-telemetry/opentelemetry Version ^1.0
php-http/httplug Version ^2.4
promphp/prometheus_client_php Version ^2.7