Download the PHP package hans-thomas/laravel-prometheus-exporter without Composer
On this page you can find all versions of the php package hans-thomas/laravel-prometheus-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hans-thomas/laravel-prometheus-exporter
More information about hans-thomas/laravel-prometheus-exporter
Files in hans-thomas/laravel-prometheus-exporter
Package laravel-prometheus-exporter
Short Description A laravel service provider to export metrics for prometheus.
License MIT
Informations about the package laravel-prometheus-exporter
LaravelPrometheusExporter
A laravel and lumen service provider to export metrics for prometheus.
Supported laravel versions
Laravel 7.x
Main features
- Metrics with APC
- Metrics with Redis
- Metrics with InMemory
- Metrics with the push gateway
- Request per route middleware (total and duration metrics)
Installation
Composer
composer require hans-thomas/laravel-prometheus-exporter
Application
Once installed you can now publish your config file and set your correct configuration for using the package.
This will create a file .
Configuration
Key | Env | Value | Description | Default |
---|---|---|---|---|
adapter | PROMETHEUS_ADAPTER | STRING | apc, redis, inmemory or push | apc |
namespace | --- | STRING | default: app | app |
namespace_http | --- | STRING | namespace for "RequestPerRoute-Middleware metrics" | http |
redis.host | PROMETHEUS_REDIS_HOST, REDIS_HOST | STRING | redis host | 127.0.0.1 |
redis.port | PROMETHEUS_REDIS_PORT, REDIS_PORT | INTEGER | redis port | 6379 |
redis.password | PROMETHEUS_REDIS_PASSWORD, REDIS_PASSWORD | STRING | redis password | null |
redis.timeout | --- | FLOAT | redis timeout | 0.1 |
redis.read_timeout | --- | INTEGER | redis read timeout | 10 |
push_gateway.address | PROMETHEUS_PUSH_GATEWAY_ADDRESS | STRING | push gateway address | localhost:9091 |
buckets_per_route | --- | STRING | histogram buckets for "RequestPerRoute-Middleware" | --- |
buckets_per_route
Usage
Get metrics
Laravel
When you are using laravel you can use the default http endpoint:
hans/pe/metrics
Of course you can also register your own route. Here is an example:
Middleware
RequestPerRoute
A middleware to build metrics for "request_total" and "requests_latency_milliseconds" per route.
Alias
lpe.requestPerRoute
Metrics
- requests_total (inc)
- requests_latency_milliseconds (histogram)
Example
app_requests_latency_milliseconds_bucket{route="/test/route",method="GET",status_code="200",le="0.005"} 0 ... app_requests_latency_milliseconds_count{route="/test/route",method="GET",status_code="200"} 1 app_requests_latency_milliseconds_sum{route="/test/route",method="GET",status_code="200"} 6 app_requests_total{route="/test/route",method="GET",status_code="200"} 1
Roadmap
- histogram buckets per route (RequestPerRoute)
Reporting Issues
If you do find an issue, please feel free to report it with GitHub's bug tracker for this project.
Alternatively, fork the project and make a pull request. :)
Testing
- docker-compose up
- docker exec fpm ./vendor/phpunit/phpunit/phpunit
Contributing
Please see CONTRIBUTING for details.
Other
License
The code for LaravelPrometheusExporter is distributed under the terms of the MIT license (see LICENSE).
All versions of laravel-prometheus-exporter with dependencies
hans-thomas/prometheus_client_php Version ^1.0
illuminate/support Version ^7.0