Skip to content

Commit

Permalink
feat: #207 ingest only eth network interfaces metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-shulha committed Oct 5, 2024
1 parent 2724255 commit 95e834a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api-nodes/Http/Controllers/MetricsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Log\Logger;
use Illuminate\Support\Str;

class MetricsController
{
Expand Down Expand Up @@ -46,7 +47,10 @@ class MetricsController
public function __invoke(Request $request, Logger $log, Node $node)
{
// TODO: cache this with the new Laravel cache system (stale-while-revalidate from the recent release)
$interfaces = collect($node->data->host->networks)->pluck('if_name')->unique()->toArray();
$interfaces = collect($node->data->host->networks)->pluck('if_name')->filter(function ($interface) {
// Collect only the interfaces that start with 'eth' for now
return Str::startsWith($interface, 'eth');
})->unique()->toArray();

$services = $node->team->services->mapWithKeys(function ($service) {
$processes = collect($service->latestDeployment->data->processes);
Expand Down

0 comments on commit 95e834a

Please sign in to comment.