Completed
Pull Request — master (#27)
by Frederic
11:56 queued 01:19
created

DogStatsDMetricService::timing()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Burrow\Metric;
4
5
use Beberlei\Metrics\Collector\DogStatsD as Collector;
6
7
class DogStatsDMetricService implements MetricService
8
{
9
    /** @var Collector */
10
    private $collector;
11
12
    /** @var array */
13
    private $tags;
14
15
    /**
16
     * MetricService constructor.
17
     *
18
     * @param Collector $collector
19
     * @param array     $tags
20
     */
21
    public function __construct(Collector $collector, array $tags = [])
22
    {
23
        $this->collector = $collector;
24
        $this->tags = $tags;
25
    }
26
27
    /**
28
     * @param $key
29
     */
30
    public function increment($key)
31
    {
32
        $this->collector->increment($key, $this->tags);
33
        $this->collector->flush();
34
    }
35
36
    /**
37
     * @param $key
38
     * @param float $timeInMs
39
     */
40
    public function timing($key, $timeInMs)
41
    {
42
        $this->collector->timing($key, $timeInMs, $this->tags);
43
        $this->collector->flush();
44
    }
45
}
46