telemetry: include more detailed server egg and nest usage

This commit is contained in:
Matthew Penner 2022-12-01 12:09:27 -07:00
parent 6272bb6710
commit 250c557e23
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View file

@ -116,9 +116,11 @@ class TelemetryCollectionService
'backup' => [
'type' => config('backups.default'),
],
'cache' => [
'type' => config('cache.default'),
],
'database' => [
'type' => config('database.default'),
'version' => DB::getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION),
@ -139,7 +141,10 @@ class TelemetryCollectionService
'eggs' => [
'count' => Egg::count(),
'ids' => Egg::pluck('uuid')->toArray(),
'server_usage' => Egg::all()
->flatMap(fn (Egg $egg) => [$egg->uuid => $egg->servers->count()])
->filter(fn (int $count) => $count > 0)
->toArray(),
],
'locations' => [
@ -152,6 +157,10 @@ class TelemetryCollectionService
'nests' => [
'count' => Nest::count(),
'server_usage' => Nest::all()
->flatMap(fn (Nest $nest) => [$nest->uuid => $nest->eggs->sum(fn (Egg $egg) => $egg->servers->count())])
->filter(fn (int $count) => $count > 0)
->toArray(),
],
'nodes' => [

View file

@ -187,6 +187,6 @@ return [
*/
'telemetry' => [
'enabled' => env('PTERODACTYL_TELEMETRY_ENABLED', false),
'enabled' => env('PTERODACTYL_TELEMETRY_ENABLED', true),
],
];