Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5ddafca

Browse files
Feature/monitor manager (#30)
Added monitor manager Added getMetrics function to retrieve Prometheus metrics from the database Performance: Sped up JSON decoding for responses smaller than 1MB (configurable)
1 parent 7376175 commit 5ddafca

31 files changed

+2087
-62
lines changed

‎.github/workflows/coverage.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ jobs:
3838

3939
- name: Test coverage
4040
run: |
41-
vendor/bin/phpunit --coverage-clover clover.xml --whitelist src
41+
composer test:coverage
4242
echo "Upload results to Scrutinizer-ci"
4343
vendor/bin/ocular code-coverage:upload --format=php-clover clover.xml

‎.github/workflows/fix-code-style.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Fix style
3939
if: ${{ always() }}
4040
run: |
41-
"${GITHUB_WORKSPACE}/vendor/bin/pint"
41+
composer style
4242
4343
- name: Commit changes
4444
uses: stefanzweifel/git-auto-commit-action@v5

‎.github/workflows/quality-assurance.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ jobs:
3636
- name: Run all QA tests
3737
if: ${{ always() }}
3838
run: |
39-
chmod +x "${GITHUB_WORKSPACE}/bin/qa.sh"
40-
"${GITHUB_WORKSPACE}/bin/qa.sh"
39+
composer analyse

‎.github/workflows/run-tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: true
1313
matrix:
1414
os: [ubuntu-latest]
15-
arangodb: ["3.10", 3.11]
15+
arangodb: ["3.10", 3.11, 3.12]
1616
php: [8.1, 8.2, 8.3]
1717
stability: [prefer-stable]
1818

‎.gitignore‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
.env
2+
.env.backup
13
.idea
24
.php_cs
35
.php_cs.cache
46
.phpunit.result.cache
57
.vscode
6-
.env
7-
.env.backup
8+
clover.xml
89
composer.lock
10+
ray.php
911
/build
1012
/coverage
1113
/vendor

‎README.md‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ The admin manager manages administrative functions and information retrieval for
7070
$client->admin()->version();
7171
```
7272

73+
### Monitor manager
74+
The monitor manager manages monitoring functions the server/cluster.
75+
```
76+
$client->monitor()->getMetrics();
77+
```
78+
7379
### Schema manager
7480
The schema manager manages all schema related operations.
7581
```
@@ -86,15 +92,16 @@ $client->transactions()->begin(['write' => ['users', 'teams']]);
8692
1) [ArangoDB PHP client](docs/arangodb-client.md)
8793
2) [AQL query statements](docs/statements.md)
8894
3) [Admin manager](docs/admin-manager.md)
89-
4) Schema manager
95+
4) [Monitor manager](docs/monitor-manager.md)
96+
5Schema manager
9097
1) [Database schema](docs/schema-databases.md)
9198
2) [User schema](docs/schema-users.md)
9299
3) [Collection schema](docs/schema-collections.md)
93100
4) [Index schema](docs/schema-indexes.md)
94101
5) [Graph schema](docs/schema-graphs.md)
95102
6) [View schema](docs/schema-views.md)
96103
7) [Analyzer schema](docs/schema-analyzers.md)
97-
5)[Transaction manager](docs/transaction-manager.md)
104+
6[Transaction manager](docs/transaction-manager.md)
98105

99106
## Related packages
100107
* [AQL query builder](https://github.com/LaravelFreelancerNL/fluentaql)

‎bin/qa.sh‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎composer.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"ext-json": "*",
2222
"guzzlehttp/guzzle": "^7.3",
2323
"halaxa/json-machine": "^1.0",
24-
"spatie/data-transfer-object": "^3.9"
24+
"spatie/data-transfer-object": "^3.9",
25+
"spatie/ray": "^1.41"
2526
},
2627
"require-dev": {
2728
"laravel/pint": "^1.2.1",
@@ -45,7 +46,7 @@
4546
"scripts": {
4647
"analyse": "vendor/bin/phpstan analyse",
4748
"test": "vendor/bin/phpunit",
48-
"test-coverage": "vendor/bin/phpunit --coverage",
49+
"test:coverage": "vendor/bin/phpunit --coverage-clover clover.xml --whitelist src",
4950
"style": "vendor/bin/pint"
5051
},
5152
"config": {

‎docs/arangodb-client.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Upon creation, you can alter the default configuration of the client. The follow
1313
* username = null
1414
* password = null
1515
* database = '_system'
16+
* responseSizeDecoderSwitch = 1 * 1024 * 1024
1617

1718
```
1819
$config = [
@@ -25,6 +26,15 @@ $config = [
2526
$arangoClient = new ArangoClient($config);
2627
```
2728

29+
### Speed vs response size
30+
JSON response decoding is normally done by the default json_decode method. This method
31+
is optimized for speed and can take a large amount of memory; up to ~ 20x of the JSON size.
32+
33+
Therefor we use halaxa/json-machine to stream decode for responses larger than 1MB.
34+
You can alter this cutoff by setting the `responseSizeDecoderSwitch` to a different size in **Bytes**.
35+
36+
This removed any memory issues at the cost of speed.
37+
2838
### Support Guzzle configuration
2939
In addition to the above mentioned options you can use the following Guzzle 7 specific options:
3040
* [version](https://docs.guzzlephp.org/en/stable/request-options.html#version)

‎docs/monitor-manager.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Monitor manager
2+
3+
Manages monitoring functions for the server/cluster.
4+
5+
## Functions
6+
The monitor manager supports the following functions:
7+
8+
### getMetrics(): Metrics
9+
Get Prometheus metrics of the server
10+
11+
```
12+
$arangoClient->monitor()->getMetrics();
13+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /