Skip to content

Commit 0ab9d64

Browse files
committed
Merge branch 'develop'
* develop: (36 commits) specify the next release version fix documentation add changelog flag facades as internal fix minimum version of psalm remove wired memory as it seems to be macOS specific Revert "debug linux memory" debug linux memory declare thrown exceptions test against lowest dependencies test against php 8.1 change email use symfony/process 6 use CS 2 use latest innmind versions remove use of an exception CS remove unparseable elements instead of throwing an exception use own exception fix linux tests ...
2 parents 2502a92 + 4dc7e27 commit 0ab9d64

64 files changed

Lines changed: 825 additions & 1405 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macOS-latest]
11-
php-version: ['7.4', '8.0']
11+
php-version: ['8.0', '8.1']
12+
dependencies: ['lowest', 'highest']
1213
name: 'PHPUnit'
1314
steps:
1415
- name: Checkout
@@ -29,7 +30,11 @@ jobs:
2930
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3031
restore-keys: ${{ runner.os }}-composer-
3132
- name: Install Dependencies
32-
run: composer install
33+
if: ${{ matrix.dependencies == 'lowest' }}
34+
run: composer update --prefer-lowest --no-progress
35+
- name: Install Dependencies
36+
if: ${{ matrix.dependencies == 'highest' }}
37+
run: composer install --no-progress
3338
- name: PHPUnit
3439
run: vendor/bin/phpunit --coverage-clover=coverage.clover
3540
- uses: codecov/codecov-action@v1
@@ -39,7 +44,8 @@ jobs:
3944
runs-on: ubuntu-latest
4045
strategy:
4146
matrix:
42-
php-version: ['7.4', '8.0']
47+
php-version: ['8.0', '8.1']
48+
dependencies: ['lowest', 'highest']
4349
name: 'Psalm'
4450
steps:
4551
- name: Checkout
@@ -59,14 +65,18 @@ jobs:
5965
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
6066
restore-keys: ${{ runner.os }}-composer-
6167
- name: Install Dependencies
62-
run: composer install
68+
if: ${{ matrix.dependencies == 'lowest' }}
69+
run: composer update --prefer-lowest --no-progress
70+
- name: Install Dependencies
71+
if: ${{ matrix.dependencies == 'highest' }}
72+
run: composer install --no-progress
6373
- name: Psalm
6474
run: vendor/bin/psalm --shepherd
6575
cs:
6676
runs-on: ubuntu-latest
6777
strategy:
6878
matrix:
69-
php-version: ['7.4']
79+
php-version: ['8.0']
7080
name: 'CS'
7181
steps:
7282
- name: Checkout
@@ -88,4 +98,4 @@ jobs:
8898
- name: Install Dependencies
8999
run: composer install --no-progress
90100
- name: CS
91-
run: vendor/bin/php-cs-fixer fix --diff --dry-run --diff-format udiff
101+
run: vendor/bin/php-cs-fixer fix --diff --dry-run
File renamed without changes.

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Changelog
2+
3+
## 3.0.0 - 2022-01-23
4+
5+
### Added
6+
7+
- `Innmind\Server\Status\Server\Process\Pid::equals()`
8+
- `Innmind\Server\Status\Server\Process\Pid::is()`
9+
- `Innmind\Server\Status\Server\Disk\Volume\MountPoint::equals()`
10+
- `Innmind\Server\Status\Server\Disk\Volume\MountPoint::is()`
11+
12+
### Changed
13+
14+
- `Innmind\Server\Status\Server\Processes::all()` now returns `Innmind\Immutable\Set<Innmind\Server\Status\Server\Process>`
15+
- `Innmind\Server\Status\Server\Processes::get()` now returns `Innmind\Immutable\Maybe<Innmind\Server\Status\Server\Process>` instead of throwing an exception
16+
- `Innmind\Server\Status\Server\Process::start()` now returns `Innmind\Immutable\Maybe<Innmind\TimeContinuum\PointInTime>`
17+
- `Innmind\Server\Status\Server\Memory\Bytes::of()` now returns `Innmind\Immutable\Maybe<Innmind\Server\Status\Server\Memory\Bytes>` instead of throwing an exception
18+
- `Innmind\Server\Status\Server\Disk::volumes()` now return `Innmind\Immutable\Set<Innmind\Server\Status\Server\Disk\Volume>`
19+
- `Innmind\Server\Status\Server\Disk::get()` now return `Innmind\Immutable\Maybe<Innmind\Server\Status\Server\Disk\Volume>` instead of throwing an exception
20+
- `Innmind\Server\Status\Server::cpu()` now returns `Innmind\Immutable\Maybe<Innmind\Server\Status\Server\Cpu>` instead of throwing an exception
21+
- `Innmind\Server\Status\Server::memory()` now returns `Innmind\Immutable\Maybe<Innmind\Server\Status\Server\Memory>` instead of throwing an exception
22+
23+
### Removed
24+
25+
- `Innmind\Server\Status\Servers\Decorator\CacheMemory`
26+
- `Innmind\Server\Status\Servers\Decorator\CacheLoadAverage`
27+
- `Innmind\Server\Status\Servers\Decorator\CacheCpu`
28+
- `Innmind\Server\Status\ServerFactory::__invoke()`
29+
- `Innmind\Server\Status\Server\Memory\Bytes` public constants
30+
- `Innmind\Server\Status\Server\Memory::wired()`
31+
- Support for php 7

README.md

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,53 @@ use Innmind\TimeContinuum\Earth\Clock;
2626

2727
$server = ServerFactory::build(new Clock);
2828

29-
$server->cpu()->user(); //percentage of the cpu used by the user
30-
$server->cpu()->system(); //percentage of the cpu used by the system
31-
$server->cpu()->idle(); //percentage of the cpu not used
32-
$server->cput()->cores(); //number of cores available
33-
34-
$server->memory()->total(); //total memory of the server
35-
$server->memory()->wired(); //memory that cannot be taken out of ram
36-
$server->memory()->active(); //memory that is used by processes
37-
$server->memory()->free(); //memory that is not used
38-
$server->memory()->swap(); //memory that is used and located on disk
39-
$server->memory()->used(); //total - free
29+
$server->cpu()->match(
30+
function($cpu) {
31+
$cpu->user(); // percentage of the cpu used by the user
32+
$cpu->system(); // percentage of the cpu used by the system
33+
$cpu->idle(); // percentage of the cpu not used
34+
$cpu->cores(); // number of cores available
35+
},
36+
fn() => null, // unable to retrieve the cpu information
37+
);
38+
39+
$server->memory()->match(
40+
function($memory) {
41+
$memory->total(); // total memory of the server
42+
$memory->active(); // memory that is used by processes
43+
$memory->free(); // memory that is not used
44+
$memory->swap(); // memory that is used and located on disk
45+
$memory->used(); // total - free
46+
},
47+
fn() => null, // unable to retrieve the memory information
48+
);
4049

4150
$server->loadAverage()->lastMinute();
4251
$server->loadAverage()->lastFiveMinutes();
4352
$server->loadAverage()->lastFifteenMinutes();
4453

45-
$server->disk()->get(new MountPoint('/'))->size(); //total size of the volume
46-
$server->disk()->get(new MountPoint('/'))->available();
47-
$server->disk()->get(new MountPoint('/'))->used();
48-
$server->disk()->get(new MountPoint('/'))->usage(); //percentage of space being used
49-
50-
$server->processes()->get(new Pid(1))->user(); //root in this case
51-
$server->processes()->get(new Pid(1))->cpu(); //percentage
52-
$server->processes()->get(new Pid(1))->memory(); //percentage
53-
$server->processes()->get(new Pid(1))->start(); //point in time at which the process started
54-
$server->processes()->get(new Pid(1))->command();
55-
56-
$server->tmp(); //path to temp directory
54+
$server->disk()->get(new MountPoint('/'))->match(
55+
function($disk) {
56+
$disk->size(); // total size of the volume
57+
$disk->available();
58+
$disk->used();
59+
$disk->usage(); // percentage of space being used
60+
},
61+
fn() => null, // the mount point doesn't exist
62+
);
63+
64+
$server->processes()->get(new Pid(1))->match(
65+
function($process) {
66+
$process->user(); // root in this case
67+
$process->cpu(); // percentage
68+
$process->memory(); // percentage
69+
$process->start(); // point in time at which the process started
70+
$process->command();
71+
},
72+
fn() => null, // the process doesn't exist
73+
);
74+
75+
$server->tmp(); // path to temp directory
5776
```
5877

5978
You can easily log all the informations gathered via a simple decorator:

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
"authors": [
88
{
99
"name": "Baptiste Langlade",
10-
"email": "langlade.baptiste@gmail.com"
10+
"email": "baptiste.langlade@hey.com"
1111
}
1212
],
1313
"support": {
1414
"issues": "http://github.com/Innmind/ServerStatus/issues"
1515
},
1616
"require": {
17-
"php": "~7.4|~8.0",
18-
"innmind/immutable": "~3.0",
19-
"innmind/time-continuum": "~2.0",
20-
"symfony/process": "~4.0|~5.0",
21-
"innmind/url": "~3.0",
22-
"psr/log": "^1.1"
17+
"php": "~8.0",
18+
"innmind/immutable": "~4.0",
19+
"innmind/time-continuum": "~3.0",
20+
"symfony/process": "~6.0",
21+
"innmind/url": "~4.0",
22+
"psr/log": "~3.0"
2323
},
2424
"autoload": {
2525
"psr-4": {
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"phpunit/phpunit": "~9.0",
36-
"vimeo/psalm": "~4.1",
37-
"innmind/coding-standard": "^1.0"
36+
"vimeo/psalm": "~4.9",
37+
"innmind/coding-standard": "~2.0"
3838
}
3939
}

src/Clock/PointInTime/Delay.php

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

src/Exception/CpuUsageNotAccessible.php

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

src/Exception/DiskUsageNotAccessible.php

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

src/Exception/InformationNotAccessible.php

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

src/Exception/MemoryUsageNotAccessible.php

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

0 commit comments

Comments
 (0)