https://github.com/agencypmg/metrics
A PHP library for collecting application metrics.
https://github.com/agencypmg/metrics
Last synced: 2 months ago
JSON representation
A PHP library for collecting application metrics.
- Host: GitHub
- URL: https://github.com/agencypmg/metrics
- Owner: AgencyPMG
- License: apache-2.0
- Created: 2017-10-11T15:59:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-26T20:53:50.000Z (over 3 years ago)
- Last Synced: 2025-02-25T15:47:42.893Z (3 months ago)
- Language: PHP
- Size: 16.6 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Metrics
**Warning: this is very unstable software right now**. PMG is adding features to
this as we need them.## Core Concepts
- A **Collector** collects metrics over the course of an application lifecycle
and stores them someplace locally (usually just in memory)
- A **Reporter** takes a *metric set* flushed out of a collector and sends it
to a real metrics backend (like [cloudwatch](https://github.com/AgencyPMG/metrics-cloudwatch)).
- A **Metric** is just some sort of measurement taken with an application. Comes
in several flavors.
- A **Gauge** is a static value taken at a point in time.## Usage Example
```php
use PMG\Metrics\Metrics;
use PMG\Metrics\Gauge;$collector = Metrics::collector();
// track `someName` with a count gauge with a value of 10
$collector->gauge('someName', Gauge::count(10));// Same as the above but tag `someName` with dimensions
$collector->gauge(
Metrics::name('someName')->dimension('example', '1'),
Gauge::count(10)
);/* @var Reporter $reporter **/
$reporter->reportOn($collector->flush());// $collector is now empty and ready to go
```