frzb/metrics-power

The MetricsPower component allows make your application able to metric

v1.1.5 2024-04-05 14:11 UTC

This package is auto-updated.

Last update: 2024-04-05 14:12:49 UTC


README

Workflow Build Status Coverage Status Quality Gate Status Scrutinizer Code Quality Build Status Code Intelligence Status

The Metrics Power Component allows make your application able to metric

Installation

The recommended way to install is through Composer:

composer require frzb/metrics-power

It requires PHP version 8.1 and higher.

Usage of #[Metrical]

#[Metrical] will automatically create and collect metrics for your messages

Example

<?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,
    ) {}
}

Resources

Alt