Download the PHP package littlemanco/magento-prometheus without Composer

On this page you can find all versions of the php package littlemanco/magento-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 magento-prometheus

Project Outline

Project Goals '''''''''''''

  1. Expose certain limited metrics about a store for use in diagnosing an issue
  2. Provide a model to extend the metrics exposed to write arbitrary additional metrics to the endpoint

This project is intended to make it easier to introspect one, or several running Magento stores.

Scope

All metrics should be collected on a per-instance basis, rather than for the health of a service overall. That should be calculated by querying the aggregate of all such collections.

Similar Work ''''''''''''

The author understand that there is little other work of this type.

Justification '''''''''''''

With more recent developments in infrastructure, such as Kubernetes, Docker, Prometheus et.al infrastructure is now clever enough to make changes to itself based on information supplied by the application. However, if the application does not supply that information, the infrastructure cannot make an informed decision.

Limitations '''''''''''

Summary '''''''

License ------------- Apache-2Code Style ------------ ZendLocale -------------- en-AU [lang]_

Compatibility '''''''''''''

Magento Compatibility

1.9 ----- Y1.8 ----- ?1.7 ----- ?1.6 ----- ?1.5 ----- ?1.4 ----- ?

Installation

Requirements ''''''''''''

Steps '''''

The recommended way of installing this extension is via Composer. If this is new to you, you can read more at the following URL:

https://github.com/Cotya/magento-composer-installer

This extension is available via Packagist. You can install it with composer by undertaking the following command:

$ composer require sitewards/magento-prometheus

Note: To use it, you will need to ensure that the composer autoloader is available to Magento. This package recommends the following extension to do this:

https://github.com/fontis/composer-autoloader

That's it! You're away.

Usage

This exposes a new endpoint at `/metrics` that exposes the metrics information about the store.

But this information is private! ''''''''''''''''''''''''''''''''

I agree. My suggestion would be block it in .htaccess; I don't think it's a good idea to stick it in admin, though. The endpoint should work almost no matter what.

I have a URL that collides with `/metrics` ''''''''''''''''''''''''''''''''''''''''''

That's no good! Create an issue, and I'll see about making it configurable.

Extending

You can add custom metrics to Prometheus from your own code. To do so, fire events using the Magento event API. Specify a suitable event name and, if necessary, add an additional data like an identification string.

Mage::dispatchEvent('namespace_extension_custom_event_name', ['name' => $this->sIdentificationString]);

Create an extension in your Magento project that will take care of the metrics being send to Prometheus. Define an observer listening to all the events you want to track. You can listen to native Magento events or define your own custom events:

// config.xml
<frontend>
    <events>
        <namespace_extension_event_name>
            <observers>
                <namespace_extension_event_name>
                    <class>Namespace_Extension_Model_Observer</class>
                    <method>pushMetric</method>
                </namespace_extension_event_name>
            </observers>
        </sitewards_importer_step_process>
    </events>
</frontend>

In the observer class create a push-metric call utilizing the handy metric factory.

public function checkpointCache(Varien_Event_Observer $oEvent) {
   Mage::getModel('littlemanco_prometheus/metricFactory')
        ->getCounter(
            '<metric_name>',
            [
                'metric_namespace' => '<vendor_extension>,'
                'metric_help' => '<Description of the metric>',
                'label_titles' => ['<label>']
            ]
        )
        ->increment(1, [$oEvent->getType()]);
}

In the example above, replace with a sensible name like that describes what is counted. Replace with a description that will help to understand the metric (e.g. 'The total number of times the cache has been flushed'). Change to contain a sensible label for sorting in the prometheus data visualization.

Ongoing Support

There will be none. Suggest that if this interests you, you fork and maintain it. Being brutally honest, my interest is fleeting, and unless there's professional sponsorship I won't carry this longer then my attention span holds out.

For me, this is a learning experience with Magento and Kubernetes.

Thanks

Contributing

Contributions are always welcome! Nothing is too small, and the best place to start is to open an issue.

References


All versions of magento-prometheus with dependencies

PHP Build Version
Package Version
Requires jimdo/prometheus_client_php Version v0.9.0
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 littlemanco/magento-prometheus contains the following files

Loading the files please wait ....