Download the PHP package caikeal/laravel-prometheus-exporter without Composer
On this page you can find all versions of the php package caikeal/laravel-prometheus-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download caikeal/laravel-prometheus-exporter
More information about caikeal/laravel-prometheus-exporter
Files in caikeal/laravel-prometheus-exporter
Package laravel-prometheus-exporter
Short Description A laravel and lumen 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
Supported lumen versions
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 triadev/laravel-prometheus-exporter
Application
The package is registered through the package discovery of laravel and Composer.
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.connection | PROMETHEUS_REDIS_CONNECTION | STRING | redis connection | default |
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:
triadev/pe/metrics
Of course you can also register your own route. Here is an example:
Lumen
When you are using lumen you must register the route on your own. 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.
Credits
- Christopher Lorke
- All Contributors
Other
Project related links
Author
- Christopher Lorke
License
The code for LaravelPrometheusExporter is distributed under the terms of the MIT license (see LICENSE).
All versions of laravel-prometheus-exporter with dependencies
caikeal/prometheus_client_php Version ^1.1
illuminate/support Version ^5.6|^6.0