Download the PHP package ensi/laravel-prometheus without Composer

On this page you can find all versions of the php package ensi/laravel-prometheus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-prometheus

Prometheus client for laravel

Latest Version on Packagist Tests Total Downloads

Adapter for promphp/prometheus_client_php

Installation

You can install the package via composer:

Publish the config with:

Version Compatibility

Laravel Prometheus Laravel PHP
^1.0.0 ^9.x ^8.1
^1.0.4 ^9.x || ^10.x ^8.1
^1.0.9 ^9.x || ^10.x || ^11.x ^8.1

Basic Usage

Before you wind up the metric counters, you need to register them. The best thing to do is to use the boot() method from the application service provider.

Updating the counter value is just as easy

Configuration

The structure of the configuration file

Bag

You may want to have several sets of metrics, for example, one set with technical metrics, such as the number of http requests or unexpected exceptions, and a second set for business values, such as the number of orders or impressions of a particular page. To do this, the concept of bag is introduced. You can configure several bugs by specifying your own data warehouse for each, a separate endpoint for collecting metrics, etc.

Storage type

You can use all the storage (Adapters) from the promphp/prometheus_client_php package. In addition, you can specify the name of the redis connection from the file config/databases.php.

Storage configuration options.
Store metrics in the process memory.

Use apcupsd

or an alternative APCuNG adapter

A Redis adapter that will create a phpredis connection by itself

Laravel Redis connection from config/databases.php. The same Redis adapter will be created under the hood, but it will take the native phpredis connection object from laravel's Redismanager.

Advanced Usage

You can select another bag to create and update metrics in it using the bag($bagName) method.

Label Middlewares

You can add a label to all bagmetrics by specifying the so-called Label middleware in its configuration. Label middleware is triggered at the moment the metric is determined and at the moment its counter is updated, adding in the first case to the label name, and in the second case the value.

For example, we have a TenantLabelProvider

We register it in the bag configuration.

Then, as usual, we work with metrics.

As a result, the metric will have not two, but three labels

On demand metrics

Sometimes metrics are not linked to application events. Usually these are metrics of the gauge type, which it makes no sense to update on each incoming request, because prometheus will still take only the last set value. Such metrics can be calculated at the time of collection of metrics by prometheus. To do this, you need to create a so-called on demand metric. This is the class in which you register metrics and set values in them.

The update of such metrics occurs at the moment prometheus addresses the endpoint of obtaining metrics.

Contributing

Please see CONTRIBUTING for details.

Testing

  1. composer install
  2. composer test

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-prometheus with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-redis Version *
laravel/framework Version ^9.0 || ^10.0 || ^11.0
promphp/prometheus_client_php Version ^2.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ensi/laravel-prometheus contains the following files

Loading the files please wait ....