The Metrics Power Component
allows make your application able to metric
The recommended way to install is through Composer:
composer require frzb/metrics-power
It requires PHP version 8.1 and higher.
#[Metrical]
will automatically create and collect metrics for your messages
<?php
use FRZB\Component\MetricsPower\Attribute\Metrical;
use FRZB\Component\MetricsPower\Attribute\PrometheusOptions;
#[Metrical(
new PrometheusOptions(
'some_topic',
'CreateUserMessage',
'Total of user messages',
['label'],
['total']
),
)]
final class CreateUserMessage {
public function __construct(
public readonly string $id,
public readonly string $name,
) {}
}