Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 2.11 KB

README.md

File metadata and controls

57 lines (45 loc) · 2.11 KB

Metrics Power Component

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