Download the PHP package liveintent/laravel-prometheus-exporter without Composer
On this page you can find all versions of the php package liveintent/laravel-prometheus-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liveintent/laravel-prometheus-exporter
More information about liveintent/laravel-prometheus-exporter
Files in liveintent/laravel-prometheus-exporter
Package laravel-prometheus-exporter
Short Description Prometheus exporter for laravel metrics.
License MIT
Informations about the package laravel-prometheus-exporter
Laravel Prometheus Exporter
This is a Laravel package that automatically collects data and exposes a /metrics
endpoint in your application which can then be scraped by Prometheus.
For a full list of exported metrics, see exporters.
Installation
You can install the package via composer:
Once installed run the following command to generate the metrics
config file.
The package will auto-register itself.
Usage
The metrics
config file contains a list of enabled exporters. Each exporter will collect data and store it in your configured data store.
Storage
The storage drivers currently supperted are redis, apc, and in-memory. You may adjust this value by setting the env METRICS_STORAGE_DRIVER
.
The package uses the in-memory driver by default to help you get started, but you should change this as soon as you are ready as it's not useful for much beyond testing.
You will need the appropriate pecl
extension installed (apc or php-redis).
If you need to clear the storage, you may do so with:
Exporters
Request Duration Historam Exporter - http_request_duration_seconds_bucket
This will export histogram data for request duration.
Example
Labels
name | description | example |
---|---|---|
service | name of the service | my-amazing-api |
environment | the environment | qa , prod , etc |
response_code | the http response code | 200 , 400 , etc |
method | the http method | GET , POST , etc |
path | the uri of the request | / , /posts , etc |
Request Memory Usage Historam Exporter - http_request_memory_usage_bytes
This will export histogram data for request memory usage.
Example
Labels
name | description | example |
---|---|---|
service | name of the service | my-amazing-api |
environment | the environment | qa , prod , etc |
code | the http response code | 200 , 400 , etc |
method | the http method | GET , POST , etc |
path | the uri of the request | / , /posts , etc |
Job Processing Time Historam Exporter - job_process_time_seconds_bucket
This will export histogram data for job execution duration.
Example
Labels
name | description | example |
---|---|---|
service | name of the service | my-amazing-api |
environment | the environment | qa , prod , etc |
name | the classname of the job | App\\Jobs\\ProcessPayment |
status | the job status | procesed , failed |
Job Wait Time Historam Exporter - job_wait_time_seconds_bucket
This will export histogram data for the time a job had to wait on the queue.
Note: This exporter relies on Laravel Horizon.
Example
Labels
name | description | example |
---|---|---|
service | name of the service | my-amazing-api |
environment | the environment | qa , prod , etc |
name | the classname of the job | App\\Jobs\\ProcessPayment |
Query Duration Historam Exporter - db_query_time_seconds_bucket
This will export histogram data for query execution times.
Example
Labels
name | description | example |
---|---|---|
service | name of the service | my-amazing-api |
environment | the environment | qa , prod , etc |
sql | the sql query | SELECT * FROM `users` |
Writing New Exporters
You may also write your own exporter. You only need to implement two methods, register
and export
.
The following example increments a counter every time the /
route is visited.
Register your Exporter class by placing it in the list of exporters found in the metrics
config file.
All versions of laravel-prometheus-exporter with dependencies
illuminate/contracts Version ^8.0
nesbot/carbon Version ^2.46
promphp/prometheus_client_php Version ^2.2