Skip to content

Commit

Permalink
telescope ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Apr 15, 2024
1 parent 0b337be commit 111519d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/reverb.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
],
'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15),
],

],
Expand Down
15 changes: 15 additions & 0 deletions src/Servers/Reverb/Console/Commands/StartServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function handle(): void
$this->ensureStaleConnectionsAreCleaned($loop);
$this->ensureRestartCommandIsRespected($server, $loop, $host, $port);
$this->ensurePulseEventsAreCollected($loop, $config['pulse_ingest_interval']);
$this->ensureTelescopeEntriesAreCollected($loop, $config['telescope_ingest_interval'] ?? 15);

$this->components->info('Starting '.($server->isSecure() ? 'secure ' : '')."server on {$host}:{$port}".(($hostname && $hostname !== $host) ? " ({$hostname})" : ''));

Expand Down Expand Up @@ -145,6 +146,20 @@ protected function ensurePulseEventsAreCollected(LoopInterface $loop, int $inter
});
}

/**
* Schedule Telescope to store entries if enabled.
*/
protected function ensureTelescopeEntriesAreCollected(LoopInterface $loop, int $interval): void
{
if (! class_exists(\Laravel\Telescope\Telescope::class)) {
return;
}

$loop->addPeriodicTimer($interval, function () {
\Laravel\Telescope\Telescope::store($this->laravel->make(\Laravel\Telescope\Contracts\EntriesRepository::class));

Check failure on line 159 in src/Servers/Reverb/Console/Commands/StartServer.php

View workflow job for this annotation

GitHub Actions / tests / Static Analysis

Call to static method store() on an unknown class Laravel\Telescope\Telescope.

Check failure on line 159 in src/Servers/Reverb/Console/Commands/StartServer.php

View workflow job for this annotation

GitHub Actions / tests / Static Analysis

Class Laravel\Telescope\Contracts\EntriesRepository not found.
});
}

/**
* Get the list of signals handled by the command.
*/
Expand Down

0 comments on commit 111519d

Please sign in to comment.