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

pipeline status

A comprehensive Magento 2 module that exposes essential Magento metrics in Prometheus format, enabling powerful monitoring and observability for your e-commerce platform.

🚀 Features

📋 Table of Contents

📦 Installation

Requirements

Install via Composer

Verify Installation

After installation, your metrics endpoint will be available at:

⚙️ Configuration

Admin Configuration

Navigate to Stores → Configuration → Prometheus → Metric Configuration to:

Cron Configuration

The module automatically registers a cron job that runs every minute to aggregate metrics. The job uses a dedicated cron group: run_as_root_prometheus_metrics_aggregator.

🎯 Prometheus Setup

Basic Configuration

Add the following scrape configuration to your prometheus.yml:

With Authentication

For production environments, secure your metrics endpoint:

Advanced Configuration with Labels

📊 Available Metrics

Order Metrics

Metric Type Labels Description
magento_orders_count_total gauge status, store_code Total count of orders by status and store
magento_orders_amount_total gauge status, store_code Total revenue by order status and store
magento_order_items_count_total gauge status, store_code Total count of order items

Product & Catalog Metrics

Metric Type Labels Description
magento_products_by_type_count_total gauge product_type Count of products by type (simple, configurable, etc.)
magento_catalog_category_count_total gauge status, menu_status, store_code Count of categories by status

EAV & Attribute Metrics

Metric Type Labels Description
magento_eav_attribute_count_total gauge - Total count of EAV attributes
magento_eav_attribute_options_above_recommended_level_total gauge - Count of attributes with more than 100 options (performance risk)

Customer Metrics

Metric Type Labels Description
magento_customer_count_total gauge store_code Total count of registered customers

Content Metrics

Metric Type Labels Description
magento_cms_block_count_total gauge store_code Count of CMS blocks
magento_cms_page_count_total gauge store_code Count of CMS pages

System Health Metrics

Metric Type Labels Description
magento_cronjob_count_total gauge status, job_code Count of cron jobs by status
magento_cronjob_broken_count_total gauge - Count of broken cron jobs
magento_indexer_backlog_count_total gauge title Count of items in indexer backlog

Infrastructure Metrics

Metric Type Labels Description
magento_store_count_total gauge status Count of stores by status
magento_website_count_total gauge - Total count of websites
magento_shipments_count_total counter source, store_code Count of shipments created

🔐 Security

Authentication Setup

  1. Generate Bearer Token: Navigate to Magento Admin → System → Integrations
  2. Create New Integration: Set up API access with appropriate permissions
  3. Configure Token: Use the generated access token in your Prometheus configuration

Best Practices

IP Whitelisting

Consider restricting access to your Prometheus server IPs:

🔧 Custom Metrics

Creating a Custom Metric Aggregator

  1. Implement the Interface:

  2. Register in DI Configuration (etc/di.xml):

Example: Product Rating Aggregator

💻 CLI Commands

Collect Metrics Manually

View Current Metrics

Clear Metrics Data

🏗️ Architecture

Data Flow

  1. Cron Execution: Every minute, the run_as_root_prometheus_metrics_aggregator cron group executes
  2. Metric Aggregation: Each enabled aggregator collects and processes data
  3. Data Storage: Aggregated metrics are stored in run_as_root_prometheus_metrics table
  4. Endpoint Response: /metrics controller serves data in Prometheus format

Key Components

Database Schema

The module creates a dedicated table run_as_root_prometheus_metrics with the following structure:

🔍 Troubleshooting

Common Issues

Metrics Not Updating

Permission Denied on /metrics

High Memory Usage

Debug Mode

Enable debug logging by adding to app/etc/env.php:

Performance Monitoring

Monitor the impact of metric collection:

🤝 Contributing

We welcome contributions! Here's how you can help:

Development Setup

  1. Fork the repository
  2. Clone your fork: git clone https://gitlab.com/your-username/magento2-prometheus-exporter.git
  3. Install dependencies: composer install
  4. Create a feature branch: git checkout -b feature/your-feature-name

Code Standards

Pull Request Process

  1. Ensure all tests pass: vendor/bin/phpunit
  2. Update the CHANGELOG.md
  3. Submit a pull request with a clear description
  4. Respond to code review feedback

Reporting Issues

Please include:

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Support


Made with ❤️ by run_as_root


All versions of magento2-prometheus-exporter with dependencies

PHP Build Version
Package Version
Requires magento/framework Version *
magento/module-payment Version *
magento/module-eav Version *
magento/module-cron Version *
magento/module-cms Version *
magento/module-shipping Version *
magento/module-catalog Version *
magento/module-sales Version *
laminas/laminas-http Version ^2.15.0
magento/module-config Version *
magento/module-backend Version *
guzzlehttp/guzzle Version ^7.4.5
symfony/console Version ^5.4.46|^6.0
psr/log Version ^1.1|^2.0|^3.0
monolog/monolog Version ^2.9.0|^3.0
magento/module-store Version *
magento/module-indexer Version *
magento/zend-db 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 ....