Download the PHP package pluggit/monitoring without Composer

On this page you can find all versions of the php package pluggit/monitoring. 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 monitoring

Pluggit Monitoring

Build Status Scrutinizer Code Quality Code Coverage

Monitoring is an application monitor and event service, which gives you the ability to monitor and health check from the code.

Installation

Require the library as usual:

Types of monitoring data

Metrics

Metric are statistic values taken at a given point, so it can be graphed and aggregated to be studied.

Supported Metrics

Events

Events are useful to give context information over the metrics, for example tag a new release, a server migration or a library update.

How to use the Monitoring libraries

Two new entities have been defined to model real world usage to code.

The metric entity

The metric entity contains all the information a metric must have.

The event entity

The event entity describes an occurred event at one specific moment.

Creating the entities

There are two factories created to facilitate the creation of the entities, both allow the creation of the entities and provide default data and tags for them in one step

NOTE: Both factories allow to add more default tags after they are instantiated using the method:

Send the metrics/events to back end storage

Once you have one of this entities you can send them to different back ends (i.ex: log files, email, DataDog, statsd server, etc.). The Senders are the classes that know of to send a Metric or an Event to a back end storage.

They have to comply with the Metric/SenderInterface interface to send metrics:

Or the Event/SenderInterface interface to send events

The monitor

To ease the creation and the sending of the metrics and events a new class Monitor has been created, for most common use cases this is the only class you will have to interact with from the code.

Configuration of the monitor

the monitor requires both the metric and the event factory as dependencies, it also requires a Monolog logger that will register the posible exceptions that are found. The monitor will prevent all exceptions from being raised, so the normal execution flow of the code using the monitor won't be broken by any exception in the monitoring libraries After the monitor is created, it has to be populated with the metric and events senders using this methods:

NOTE: If no senders are pushed the monitor, it will work normally but will not send the metric to any backend, so it is a nice way to disable the monitor temporary.

Accesing the factories

You can access the factories inside the monitor (for example to add more default tags) with those two accessors:

One-step methods

The monitor can create metrics and events and send them to all backend with one step methods:

Sending custom metrics or events with the monitor

The monitor class can also send custom metrics and events with the methods:

Typical setup

NOTE: Now there is a factory that can be used to ease the creation method, see the next section For using the monitor the typical steps are:

This code is a simplified demonstration of the setup process without the object dependencies.

Creation through the factory

NOTE The factory comes with some default values, you can see them in the MonitorFactory code

Available back end senders

Psr-3 logger

With the psr-3 compatible sender you can send events and metrics to PS-3 Logger Handlers. The typical case scenario will be log to files but you can setup very powerful handlers by plug in, for example, Monolog (let you log to databases, send mails or send the metrics and events to online platforms like Splunk. Of course, you can also build custom ones.)

composer.json``` file

Example of setup for the metric sender with native CURL transport

IMPORTANT NOTE: This sender will perform synchronous HTTP requests, so it's not recommended using it on user applications. (see Message back end sender to see how can be used asynchronous)

Message

These senders are not usual senders because they don't directly perform operation to metrics or events.

This back ends senders make use of the Message system libraries included on the CMP/base libraries to be able to send metrics and events to a messaging system, so they can be processed by other senders in an asynchronous way

Imagine we want to send an event to DataDog using the datadog event sender every time a user upgrades his account, if we do it directly with the native datadog sender we are going to block the user with a synchronous call to DataDog's HTTP API, so we can use this back end sender to make the request asynchronous.

Example of the Message event sender using RabbitMQ as messaging system

Now there should be another daemon task that will read the event messages and send them to other senders

NOTE ON ASYNCHRONOUS METRICS: The metrics don't have a timestamp, so if there is a delay while consuming the messages the metrics will be delayed. The worst case could be if the consumer crashes and then is restarted later, it start consuming queued message and generate a lot of metrics with wrong timestamps


All versions of monitoring with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
psr/log Version ^2.0 || ^3.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 pluggit/monitoring contains the following files

Loading the files please wait ....