-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Côme Chilliet <[email protected]>
- Loading branch information
Showing
4 changed files
with
133 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\ServerInfo; | ||
|
||
use OCP\IDateTimeFormatter; | ||
|
||
/** | ||
* @package OCA\Survey_Client\Categories | ||
*/ | ||
class FpmStatistics { | ||
public function __construct( | ||
private IDateTimeFormatter $dateTimeFormatter, | ||
) { | ||
} | ||
|
||
/** | ||
* Returns FPM statistics, with these keys: | ||
* "pool" | ||
* "process-manager" | ||
* "start-time" | ||
* "start-since" | ||
* "accepted-conn" | ||
* "listen-queue" | ||
* "max-listen-queue" | ||
* "listen-queue-len" | ||
* "idle-processes" | ||
* "active-processes" | ||
* "total-processes" | ||
* "max-active-processes" | ||
* "max-children-reached" | ||
* "slow-requests" | ||
* | ||
*/ | ||
public function getFpmStatistics(): array|false { | ||
if (!function_exists('fpm_get_status')) { | ||
return false; | ||
} | ||
$status = fpm_get_status(); | ||
$status['start-time'] = $this->dateTimeFormatter->formatDateTime($status['start-time']); | ||
unset($status['procs']); | ||
return $status; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters