Skip to content

Commit 1caa2f5

Browse files
Feature: Added getCurrentConnections to MonitorManager.php
1 parent 162a0fd commit 1caa2f5

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Monitor/MonitorManager.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ public function getMetrics(): \stdClass
1717

1818
return $this->arangoClient->request('get', $uri);
1919
}
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+
}
2027
}

tests/MonitorManagerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,10 @@
7474
$result = $prometheus->parseText($rawMetrics);
7575
expect($result->arangodb_aql_local_query_memory_limit_reached_total->timestamp)->toEqual(2211753600);
7676
});
77+
78+
test('getCurrentConnections', function () {
79+
$result = $this->arangoClient->monitor()->getCurrentConnections();
80+
81+
expect($result)->toBeInt();
82+
expect($result)->toBeGreaterThan(0);
83+
});

0 commit comments

Comments
 (0)