Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
push:
branches:
- master
- '*.x'
- "*.x"
pull_request:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
mysql:
Expand Down Expand Up @@ -68,12 +68,11 @@ jobs:

- name: Require cachewerk/relay
run: |
composer require cachewerk/relay --no-interaction --no-update
if: matrix.php != 8.5

composer require cachewerk/relay --no-interaction --no-update

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}

- name: Execute tests
run: vendor/bin/pest -vvv
Expand Down Expand Up @@ -131,12 +130,11 @@ jobs:

- name: Require cachewerk/relay
run: |
composer require cachewerk/relay --no-interaction --no-update
if: matrix.php != 8.5

composer require cachewerk/relay --no-interaction --no-update

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}

- name: Execute tests
run: vendor/bin/pest -vvv
Expand Down Expand Up @@ -192,12 +190,11 @@ jobs:

- name: Require cachewerk/relay
run: |
composer require cachewerk/relay --no-interaction --no-update
if: matrix.php != 8.5
composer require cachewerk/relay --no-interaction --no-update

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}

- name: Execute tests
run: vendor/bin/pest -vvv
Expand Down Expand Up @@ -244,12 +241,11 @@ jobs:

- name: Require cachewerk/relay
run: |
composer require cachewerk/relay --no-interaction --no-update
if: matrix.php != 8.5
composer require cachewerk/relay --no-interaction --no-update

- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}

- name: Execute tests
run: vendor/bin/pest -vvv
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "laravel/pulse",
"description": "Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.",
"keywords": ["laravel"],
"keywords": [
"laravel"
],
"homepage": "https://github.com/laravel/pulse",
"license": "MIT",
"support": {
Expand Down Expand Up @@ -40,7 +42,7 @@
"mockery/mockery": "^1.0",
"orchestra/testbench": "^8.36|^9.15|^10.8",
"pestphp/pest": "^2.0|^3.0|^4.0",
"pestphp/pest-plugin-laravel": "^2.2",
"pestphp/pest-plugin-laravel": "^2.2|^3.0|^4.0",
"phpstan/phpstan": "^1.12.21",
"predis/predis": "^1.0|^2.0"
},
Expand Down Expand Up @@ -96,4 +98,4 @@
"@php vendor/bin/pest"
]
}
}
}
24 changes: 12 additions & 12 deletions src/Recorders/Servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ protected function cpu(): int
}

return match (PHP_OS_FAMILY) {
'Darwin' => (int) `top -l 1 | grep -E "^CPU" | tail -1 | awk '{ print $3 + $5 }'`,
'Linux' => (int) `top -bn1 | grep -E '^(%Cpu|CPU)' | awk '{ print $2 + $4 }'`,
'Windows' => (int) trim(`wmic cpu get loadpercentage | more +1`),
'BSD' => (int) `top -b -d 2| grep 'CPU: ' | tail -1 | awk '{print$10}' | grep -Eo '[0-9]+\.[0-9]+' | awk '{ print 100 - $1 }'`,
'Darwin' => (int) shell_exec("top -l 1 | grep -E \"^CPU\" | tail -1 | awk '{ print $3 + $5 }'"),
'Linux' => (int) shell_exec("top -bn1 | grep -E '^(%Cpu|CPU)' | awk '{ print $2 + $4 }'"),
'Windows' => (int) trim((string) shell_exec('wmic cpu get loadpercentage | more +1')),
'BSD' => (int) shell_exec("top -b -d 2| grep 'CPU: ' | tail -1 | awk '{print$10}' | grep -Eo '[0-9]+\.[0-9]+' | awk '{ print 100 - $1 }'"),
default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),
};
}
Expand All @@ -127,18 +127,18 @@ protected function memory(): array
}

$memoryTotal = match (PHP_OS_FAMILY) {
'Darwin' => intval(`sysctl hw.memsize | grep -Eo '[0-9]+'` / 1024 / 1024),
'Linux' => intval(`cat /proc/meminfo | grep MemTotal | grep -E -o '[0-9]+'` / 1024),
'Windows' => intval(((int) trim(`wmic ComputerSystem get TotalPhysicalMemory | more +1`)) / 1024 / 1024),
'BSD' => intval(`sysctl hw.physmem | grep -Eo '[0-9]+'` / 1024 / 1024),
'Darwin' => intval(intval(shell_exec("sysctl hw.memsize | grep -Eo '[0-9]+'")) / 1024 / 1024),
'Linux' => intval(intval(shell_exec("cat /proc/meminfo | grep MemTotal | grep -E -o '[0-9]+'")) / 1024),
'Windows' => intval(((int) trim((string) shell_exec('wmic ComputerSystem get TotalPhysicalMemory | more +1'))) / 1024 / 1024),
'BSD' => intval(intval(shell_exec("sysctl hw.physmem | grep -Eo '[0-9]+'")) / 1024 / 1024),
default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),
};

$memoryUsed = match (PHP_OS_FAMILY) {
'Darwin' => $memoryTotal - intval(intval(`vm_stat | grep 'Pages free' | grep -Eo '[0-9]+'`) * intval(`pagesize`) / 1024 / 1024), // MB
'Linux' => $memoryTotal - intval(`cat /proc/meminfo | grep MemAvailable | grep -E -o '[0-9]+'` / 1024), // MB
'Windows' => $memoryTotal - intval(((int) trim(`wmic OS get FreePhysicalMemory | more +1`)) / 1024), // MB
'BSD' => intval(intval(`( sysctl vm.stats.vm.v_cache_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_inactive_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_active_count | grep -Eo '[0-9]+' ) | awk '{s+=$1} END {print s}'`) * intval(`pagesize`) / 1024 / 1024), // MB
'Darwin' => $memoryTotal - intval(intval(shell_exec("vm_stat | grep 'Pages free' | grep -Eo '[0-9]+'")) * intval(shell_exec('pagesize')) / 1024 / 1024), // MB
'Linux' => $memoryTotal - intval(shell_exec("cat /proc/meminfo | grep MemAvailable | grep -E -o '[0-9]+'")) / 1024, // MB
'Windows' => $memoryTotal - intval(((int) trim((string) shell_exec('wmic OS get FreePhysicalMemory | more +1'))) / 1024), // MB
'BSD' => intval(intval(shell_exec("( sysctl vm.stats.vm.v_cache_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_inactive_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_active_count | grep -Eo '[0-9]+' ) | awk '{s+=$1} END {print s}'")) * intval(shell_exec('pagesize')) / 1024 / 1024), // MB
default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),
};

Expand Down
1 change: 1 addition & 0 deletions src/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function load(Collection $keys): self
if ($provider instanceof EloquentUserProvider) {
$model = $provider->getModel();

// @phpstan-ignore staticMethod.notFound
$this->resolvedUsers = $model::findMany($keys);
} else {
$this->resolvedUsers = $keys->map(fn ($key) => $provider->retrieveById($key));
Expand Down