Download the PHP package gorerider/laravel-prometheus-exporter without Composer

On this page you can find all versions of the php package gorerider/laravel-prometheus-exporter. 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-exporter

laravel-prometheus-exporter

Originally, this is a fork of traum-ferienwohnungen/laravel-prometheus-exporter with updated dependencies. Main goal of this work is to make the lib compatible with Laravel 7 and Lumen 7 running on PHP 7.4.

However, with the need to support guzzlehttp/guzzle 7, dependency was replaced with PromPHP/prometheus_client_php.

Description

A prometheus exporter for the Laravel and the Lumen web framework.

It tracks latency and request counts by request method, route path and response code.

Installation

composer require gorerider/laravel-prometheus-exporter

Adapters

Then choose from three storage adapters: Memory (default), APCu and Redis can also be used.

APCu

Ensure apcu-bc is installed and enabled. If you're using the official PHP docker hub non-alpine image, have a look in the Dockerfile on how to install.

Redis

Ensure php redis is installed and enabled. If you're using the official PHP docker hub non-alpine image, have a look in the Dockerfile on how to install.

By default, it looks for a redis server at localhost:6379. The server can be configured in config/prometheus_exporter.php.

Laravel

If you're requiring this package in Laravel, middleware and route will be configured for you automatically.

Enable the Service Provider

In config/app.php (if not already there):

Lumen

Register the ServiceProvider

In bootstrap/app.php

Add an endpoint for the metrics

In bootstrap/app.php

Configuration

Metrics are exposed on /metrics endpoint, e.g. http://my-service.com/metrics

The configuration can be found in config/prometheus_exporter.php.

All values can be configured via .env or environment variables.

name description env
adapter Storage adapter to use: 'memory', 'apc' or 'redis' default: 'memory' PROMETHEUS_EXPORTER_ADAPTER
active_collectibles Additional metric collectibles n.a.
buckets HTTP requests latency histogram buckets n.a.
namespace Name (prefix) to use in prometheus metrics. default: value in APP_NAME env var PROMETHEUS_EXPORTER_NAMESPACE
redis Array of redis parameters see prometheus_exporter.php for details
opcache_metrics_namespace Name (prefix) to use for OPCache metrics. default: opcache PROMETHEUS_EXPORTER_OPCACHE_METRICS_NAMESPACE
fpm_metrics_namespace Name (prefix) to use for PHP-FPM metrics. default: fpm PROMETHEUS_EXPORTER_FPM_METRICS_NAMESPACE

Collectibles

If you want to disable any collectibles, you'll need to remove entries from the prometheus_exporter.php config.

Laravel

Run

Finally, remove collectibles in app/config/prometheus_exporter.php

Lumen

Copy src/config/prometheus_exporter.php in this repo and add to your Lumen project in the config directory.

Finally, remove collectibles in app/config/prometheus_exporter.php

Example /metrics

Note that all HTTP requests are instrumented including the /metrics endpoint itself.


All versions of laravel-prometheus-exporter with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
illuminate/support Version ^7.22
promphp/prometheus_client_php Version ^2.7
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 gorerider/laravel-prometheus-exporter contains the following files

Loading the files please wait ....