Download the PHP package zlodes/prometheus-client without Composer
On this page you can find all versions of the php package zlodes/prometheus-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download zlodes/prometheus-client
More information about zlodes/prometheus-client
Files in zlodes/prometheus-client
Download zlodes/prometheus-client
More information about zlodes/prometheus-client
Files in zlodes/prometheus-client
Vendor zlodes
Package prometheus-client
Short Description The Prometheus Metrics client for PHP
License MIT
Package prometheus-client
Short Description The Prometheus Metrics client for PHP
License MIT
Please rate this library. Is it a good library?
Informations about the package prometheus-client
PHP Prometheus Client
This package provides you an ability to collect and export Prometheus metrics from any modern PHP application.
Why?
- Until now, there was no working Prometheus client for modern PHP
- Framework-agnostic
- Almost zero dependencies
- Won't break your business logic even if something is wrong with Metrics Storage
- Ready to use with static analysis tools (PHPStan, Psalm)
Adapters
- For Laravel: zlodes/prometheus-client-laravel
Installation
Flow
TL;DR: Read Simple example.
1. Preparation
- Set up a storage to store metrics. There are four interfaces can be implemented:
- CounterStorage
- GaugeStorage
- HistogramStorage
- SummaryStorage
- Set up a ArrayRegistry is a default implementation.
- Register your metrics using the Registry from step 2.
2. Collecting
- Get a collector for your metric from a CollectorFactory
- Call metric update method (e.g.
increment
on CounterCollector)
3. Exporting
- Create a controller to export metrics. Your controller should use FetcherExporter is a default implementation.
- Set up a Prometheus to scrape metrics from your application using the controller from step 1.
Simple example
Output example:
Testing
Run tests
Creating your own Storage
Keys serialization
There is a Serializer interface (with JSON-based implementation) to simplify work with a key-value storage.
Example can be found in InMemoryStorage.
Storage Testing
There are four useful traits to simplify your storage testing:
- CounterStorageTesting
- GaugeStorageTesting
- HistogramStorageTesting
- SummaryStorageTesting
They provide you a set of tests to check your storage implementation to be compatible with the library.
Example:
All versions of prometheus-client with dependencies
PHP Build Version
Package Version
The package zlodes/prometheus-client contains the following files
Loading the files please wait ....