Metrics::summary()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Metrics register
4
 * User: moyo
5
 * Date: 2018/5/17
6
 * Time: 9:49 PM
7
 */
8
9
namespace Carno\Monitor;
10
11
use Carno\Monitor\Metrics\Counter;
12
use Carno\Monitor\Metrics\Gauge;
13
use Carno\Monitor\Metrics\Histogram;
14
use Carno\Monitor\Metrics\Summary;
15
16
class Metrics
17
{
18
    /**
19
     * @return Counter
20
     */
21
    public static function counter() : Counter
22
    {
23
        return (new Counter)->register();
24
    }
25
26
    /**
27
     * @param float $initial
28
     * @return Gauge
29
     */
30
    public static function gauge(float $initial = 0) : Gauge
31
    {
32
        return (new Gauge($initial))->register();
33
    }
34
35
    /**
36
     * @return Histogram
37
     */
38
    public static function histogram() : Histogram
39
    {
40
        return (new Histogram)->register();
41
    }
42
43
    /**
44
     * @param float ...$quantiles
45
     * @return Summary
46
     */
47
    public static function summary(float ...$quantiles) : Summary
48
    {
49
        return (new Summary)->quantiles(...$quantiles)->register();
50
    }
51
}
52