frzb/metrics-power

MetricsPower 组件允许您的应用程序进行指标化

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

This package is auto-updated.

Last update: 2024-09-10 09:25:41 UTC


README

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

Metrics Power 组件 允许您的应用程序进行指标化

安装

建议使用 Composer 进行安装

composer require frzb/metrics-power

它需要 PHP 版本 8.1 或更高。

使用 #[Metrical]

#[Metrical] 将自动为您消息创建和收集指标

示例

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

资源

Alt