Download the PHP package theihasan/nightwatch-prometheus without Composer
On this page you can find all versions of the php package theihasan/nightwatch-prometheus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download theihasan/nightwatch-prometheus
More information about theihasan/nightwatch-prometheus
Files in theihasan/nightwatch-prometheus
Package nightwatch-prometheus
Short Description Prometheus exporter package for Laravel Nightwatch metrics.
License MIT
Informations about the package nightwatch-prometheus
Nightwatch Promethus
theihasan/nightwatch-prometheus exposes Laravel Nightwatch records as Prometheus metrics.
It runs on top of laravel/nightwatch, but it does not require a Nightwatch subscription. Nightwatch is used as the in-app event collection layer, while this package replaces Nightwatch's default ingest path and exports metrics for Prometheus scraping.
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
laravel/nightwatch^1.28- Redis for shared metric storage in real applications
How It Works
- Laravel Nightwatch collects request, query, queue, exception, log, and related runtime records.
- This package replaces Nightwatch's ingest implementation.
- Records are converted into Prometheus-friendly counters and histograms.
- Metrics are stored in Redis by default.
- Prometheus scrapes the
/metricsendpoint.
Nightwatch Subscription
This package does not need a Nightwatch subscription.
You still install and enable laravel/nightwatch, but you do not need to send data to the Nightwatch hosted service. This package uses Nightwatch's local record generation only.
Installation
Install Nightwatch and this package:
Publish the package config:
Minimal Nightwatch Setup
Enable Nightwatch in your app and keep sampling at 1.0 for accurate counters.
Example .env values:
Notes:
- The token does not need to be a real Nightwatch subscription token for this package's exporter flow.
- Redis is recommended because metrics must be shared across requests, workers, and scheduled/queue processes.
Routes
By default:
- metrics endpoint:
/metrics - debug endpoint:
/nightwatch-promethus/debug
The metrics route is enabled by default.
The debug route is disabled by default in production unless explicitly enabled.
Configurable route settings live in config/nightwatch-promethus.php.
Available Metrics
Currently implemented:
nightwatch_http_requests_totalnightwatch_http_request_duration_secondsnightwatch_http_request_stage_duration_secondsnightwatch_http_request_peak_memory_bytesnightwatch_http_request_queries_totalnightwatch_exceptions_totalnightwatch_db_queries_totalnightwatch_db_query_duration_secondsnightwatch_outgoing_http_requests_totalnightwatch_outgoing_http_request_duration_secondsnightwatch_jobs_queued_totalnightwatch_job_attempts_totalnightwatch_job_attempt_duration_secondsnightwatch_scheduled_task_runs_totalnightwatch_command_executions_totalnightwatch_command_duration_secondsnightwatch_cache_events_totalnightwatch_logs_totalnightwatch_notifications_totalnightwatch_notification_duration_seconds
Log Metric Caution
nightwatch_logs_total is verified working through the dedicated Nightwatch log channel.
If you want normal application logs to be captured by Nightwatch in a typical Laravel stack setup, include the nightwatch channel in your log stack.
Example:
Then clear config:
Known Limitation
These two metrics are implemented in the package, but they may not appear in real worker flows until the upstream Nightwatch issue is fixed:
nightwatch_job_attempts_totalnightwatch_job_attempt_duration_seconds
Upstream issue:
laravel/nightwatch#406- https://github.com/laravel/nightwatch/issues/406
Current status:
nightwatch_jobs_queued_totalworksjob-attemptrecord emission appears to be blocked by Nightwatch worker behavior in realqueue:workprocessing
Example PromQL
Request rate:
Requests by route:
95th percentile request duration:
Query count by route:
Database query rate by connection:
95th percentile database query duration:
Outgoing HTTP request rate by host:
95th percentile outgoing HTTP request duration:
Unhandled exceptions:
Command execution rate:
Job attempts by result:
Scheduled task runs:
Cache hit rate:
Cache miss rate:
Cache hit ratio:
Notification throughput by channel:
95th percentile notification duration:
Prometheus Scrape Config Example
If your metrics route path is customized in config/nightwatch-promethus.php, update metrics_path to match.
All versions of nightwatch-prometheus with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
laravel/nightwatch Version ^1.28