Failed Conditions
Push — 34-add-getcurrentconnections-t... ( 162a0f...1caa2f )
by Bas
02:42
created

MonitorManager::getCurrentConnections()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArangoClient\Monitor;
6
7
use ArangoClient\ArangoClient;
8
use ArangoClient\Manager;
9
10
class MonitorManager extends Manager
11
{
12
    public function __construct(protected ArangoClient $arangoClient) {}
13
14
    public function getMetrics(): \stdClass
15
    {
16
        $uri = '/_admin/metrics/v2';
17
18
        return $this->arangoClient->request('get', $uri);
19
    }
20
21
    public function getCurrentConnections(): int
22
    {
23
        $metrics = $this->getMetrics();
24
25
        return $metrics->arangodb_http1_connections_total->value + $metrics->arangodb_http2_connections_total->value;
26
    }
27
}
28