PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.22
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.22
1.10.25 1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 All 169 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Metrics / TraceMetrics.php

TraceMetrics.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.22, at vendor_prefixed/sentry/sentry/src/Metrics/TraceMetrics.php

61 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sentry\Metrics;
5
6 use WCPOS\Vendor\Sentry\EventId;
7 use WCPOS\Vendor\Sentry\Metrics\Types\CounterMetric;
8 use WCPOS\Vendor\Sentry\Metrics\Types\DistributionMetric;
9 use WCPOS\Vendor\Sentry\Metrics\Types\GaugeMetric;
10 use WCPOS\Vendor\Sentry\SentrySdk;
11 use WCPOS\Vendor\Sentry\Unit;
12 class TraceMetrics
13 {
14 /**
15 * @var self|null
16 */
17 private static $instance;
18 public function __construct()
19 {
20 }
21 public static function getInstance() : self
22 {
23 if (self::$instance === null) {
24 self::$instance = new TraceMetrics();
25 }
26 return self::$instance;
27 }
28 /**
29 * @param int|float $value
30 * @param array<string, int|float|string|bool|null> $attributes
31 */
32 public function count(string $name, $value, array $attributes = [], ?Unit $unit = null) : void
33 {
34 $this->aggregator()->add(CounterMetric::TYPE, $name, $value, $attributes, $unit);
35 }
36 /**
37 * @param int|float $value
38 * @param array<string, int|float|string|bool|null> $attributes
39 */
40 public function distribution(string $name, $value, array $attributes = [], ?Unit $unit = null) : void
41 {
42 $this->aggregator()->add(DistributionMetric::TYPE, $name, $value, $attributes, $unit);
43 }
44 /**
45 * @param int|float $value
46 * @param array<string, int|float|string|bool|null> $attributes
47 */
48 public function gauge(string $name, $value, array $attributes = [], ?Unit $unit = null) : void
49 {
50 $this->aggregator()->add(GaugeMetric::TYPE, $name, $value, $attributes, $unit);
51 }
52 public function flush() : ?EventId
53 {
54 return $this->aggregator()->flush();
55 }
56 private function aggregator() : MetricsAggregator
57 {
58 return SentrySdk::getCurrentRuntimeContext()->getMetricsAggregator();
59 }
60 }
61