Download the PHP package run-as-root/magento2-prometheus-exporter without Composer

On this page you can find all versions of the php package run-as-root/magento2-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 magento2-prometheus-exporter

Magento 2 Prometheus Exporter

Branch stable codecov pipeline status

This Magento 2 Module exposes a new route under /metrics with Magento 2 specific metrics in the format of prometheus. The different metrics are grouped into modules and can be enabled/disabled via the Magento Backend.

Installation

Install the Module via composer by running:

Module Configuration

The modules system configuration is located under Stores -> Configuration -> Prometheus -> Metric Configuration. You can enable or disable specific metrics by using the multiselect.

Prometheus Configuration

After installing the Magento Module, your Prometheus needs to get pointed to your Magento Metrics endpoint. To do so, add the following lines to your prometheus.yml under scrape_configs:

Authorization

Your metrics endpoint should not be available to everyone, so the use of authorization is recommended. The module provides support for authorization tokens via Magento Backend.

For Basic or Bearer authorization, the scrape job should be extended like this:

Module functionality

The module registers a cron job that runs every minute. The cronjob is responsible for aggregating the metric data. The aggregated data is stored in the table run_as_root_prometheus_metrics. The added controller collects the data stored in the table and renders the correct response for prometheus.

Metrics

The following metrics will be collected:

Metric Labels TYPE Help
magento_orders_count_total status, store_code gauge Total count of Magento Orders.
magento_orders_amount_total status, store_code gauge Total amount of all Magento Orders.
magento_order_items_count_total status, store_code gauge Total count of orderitems.
magento_cms_block_count_total store_code gauge Total count of available cms blocks.
magento_cms_page_count_total store_code gauge Total count of available cms pages.
magento_customer_count_total store_code gauge Total count of available customers.
magento_cronjob_broken_count_total gauge Broken CronJobs occur when when status is pending but execution_time is set.
magento_cronjob_count_total status, job_code gauge Total count of available CronJob Count.
magento_indexer_backlog_count_total title gauge Total count of backlog item in indexer (the data from indexer:status command).
magento_shipments_count_total source, store_code counter Count of Shipments created by store and source.
magento_catalog_category_count_total status, menu_status, store_code gauge Count of Categories by store, status and menu status.
magento_store_count_total status gauge Total count of Stores by status.
magento_website_count_total gauge Total count of websites.
magento_products_by_type_count_total project_type gauge Total count of products by type.

Add your own Metric

To add a new metric, you need to implement the \RunAsRoot\PrometheusExporter\Api\MetricAggregatorInterface. The metric aggregator object is responsible for collecting the necessary information for the specific metric from magento and then add a new metric record. New records can be easily added via \RunAsRoot\PrometheusExporter\Service\UpdateMetricService.

In addition to the implementation of the MetricAggregatorInterface, you have to add your specific Aggregator to the MetricAggregatorPool defined in the di.xml. For example:

Contribution

If you have something to contribute, weither it's a feature, a feature request, an issue or something else, feel free to. There are no contribution guidelines.


All versions of magento2-prometheus-exporter with dependencies

PHP Build Version
Package Version
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 run-as-root/magento2-prometheus-exporter contains the following files

Loading the files please wait ....