HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/vendor/sentry/sentry/src/Metrics/Metrics.php
<?php

declare(strict_types=1);

namespace Sentry\Metrics;

use Sentry\EventId;
use Sentry\Metrics\Types\CounterType;
use Sentry\Metrics\Types\DistributionType;
use Sentry\Metrics\Types\GaugeType;
use Sentry\Metrics\Types\SetType;

final class Metrics
{
    /**
     * @var self|null
     */
    private static $instance;

    /**
     * @var MetricsAggregator
     */
    private $aggregator;

    private function __construct()
    {
        $this->aggregator = new MetricsAggregator();
    }

    public static function getInstance(): self
    {
        if (self::$instance === null) {
            self::$instance = new self();
        }

        return self::$instance;
    }

    /**
     * @param int|float $value
     * @param string[]  $tags
     */
    public function increment(
        string $key,
        $value,
        ?MetricsUnit $unit = null,
        array $tags = [],
        ?int $timestamp = null,
        int $stackLevel = 0
    ): void {
        $this->aggregator->add(
            CounterType::TYPE,
            $key,
            $value,
            $unit,
            $tags,
            $timestamp,
            $stackLevel
        );
    }

    /**
     * @param int|float $value
     * @param string[]  $tags
     */
    public function distribution(
        string $key,
        $value,
        ?MetricsUnit $unit = null,
        array $tags = [],
        ?int $timestamp = null,
        int $stackLevel = 0
    ): void {
        $this->aggregator->add(
            DistributionType::TYPE,
            $key,
            $value,
            $unit,
            $tags,
            $timestamp,
            $stackLevel
        );
    }

    /**
     * @param int|float $value
     * @param string[]  $tags
     */
    public function gauge(
        string $key,
        $value,
        ?MetricsUnit $unit = null,
        array $tags = [],
        ?int $timestamp = null,
        int $stackLevel = 0
    ): void {
        $this->aggregator->add(
            GaugeType::TYPE,
            $key,
            $value,
            $unit,
            $tags,
            $timestamp,
            $stackLevel
        );
    }

    /**
     * @param int|string $value
     * @param string[]   $tags
     */
    public function set(
        string $key,
        $value,
        ?MetricsUnit $unit = null,
        array $tags = [],
        ?int $timestamp = null,
        int $stackLevel = 0
    ): void {
        $this->aggregator->add(
            SetType::TYPE,
            $key,
            $value,
            $unit,
            $tags,
            $timestamp,
            $stackLevel
        );
    }

    public function flush(): ?EventId
    {
        return $this->aggregator->flush();
    }
}