Completed
Push — master ( 9dca89...cdca22 )
by Frédéric G.
01:10
created

JobsRatePlugin::config()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @file
5
 * Munin plugin for Beanstalkd "jobs rate" monitoring
6
 *
7
 * @author: Frédéric G. MARAND <[email protected]>
8
 * @copyright (c) 2014-2018 Ouest Systèmes Informatiques (OSInet)
9
 * @license Apache License 2.0 or later
10
 */
11
12
namespace OSInet\Beanstalkd\Munin;
13
14 View Code Duplication
class JobsRatePlugin extends BasePlugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function config()
20
    {
21
        $ret = <<<'EOT'
22
graph_title Job Rate
23
graph_vlabel Jobs per ${graph_period}
24
graph_category Beanstalk
25
graph_args --lower-limit 0
26
graph_scale no
27
queue_jobs.label Jobs
28
queue_jobs.type DERIVE
29
queue_jobs.min 0
30
EOT;
31
32
        return $ret;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function data()
39
    {
40
        $stats = $this->server->stats();
41
        $ret = sprintf("queue_jobs.value %d\n", $stats['total-jobs']);
42
        return $ret;
43
    }
44
}
45