mtxserv/metric-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Add influxdb metrics in your sf2 app

Installs: 13 713

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.0.3 2016-01-22 15:00 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:55:01 UTC


README

Really simple bundle to add metrics with InfluxDB in your Symfony2 application.

Installation

composer require mtxserv/metric-bundle

Configuration

Add in config_prod.yml

metric:
    host: %app_metric_host%
    port: %app_metric_port% # UDP port
    enable_collector: true  # set true to collect data (request, execution time, memory, ..)

Usage

$this->get('metric')->add('app_queue', [
    'value'     => 1,
]);

Increment serie

$this->get('metric')->decrement('app_queue');

Decrement serie

$this->get('metric')->increment('app_queue');

Timing serie

$this->get('metric')->timing('app_queue', time());

Measure serie

$this->get('metric')->measure('app_queue', 10.0);

Add tags

An third argument is available on all methods to add tags.

Example:

$this->get('metric')->add('app_queue', [
    'value'     => 1,
], [
    'region' => 'eu',
]);

Data Collector

To enable data collector (send on kernel.terminate event), set to true the enable_collector flag.

metric:
    enable_collector: true # set true to collect data (request, execution time, memory, ..)