-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Telescope recording and pause functions (#678)
* Support telescope ability * Support recording * Optimizing the code * feat: Refactor telescope recording and caching logic * chore: Update Psr\Container\ContainerInterface::get() override in .phpstorm.meta.php * feat: Update EntriesController to use ApplicationInterface for clearing Telescope entries * feat: Update Psr\Container\ContainerInterface::get() override in .phpstorm.meta.php * chore: Update Psr\Container\ContainerInterface::get() override in .phpstorm.meta.php * feat: Update EntriesController to use ApplicationInterface for clearing Telescope entries * Update Telescope::getCache() to return PsrCacheInterface instead of CacheInterface * Added `Telescope::isRecording()` function * Moved `Telescope::isRecording()` condition to `TelescopeConfig isEnable()` * Optimized * Optimized * Update tests * Remove unused codes * Optimize Telescope::isRecording() condition * Optimize Telescope::isRecording() condition * Optimize Telescope::isRecording() condition * Optimize Telescope::isRecording() condition and update caching logic * Optimize Telescope::isRecording() condition and caching logic * Optimize Telescope::isRecording() condition and caching logic * Optimize Telescope::isRecording() condition and update caching logic * chore: Optimize Telescope::isRecording() condition and caching logic * Optimize Telescope::isRecording() condition and caching logic * chore: Optimize Telescope::isRecording() condition and caching logic * Refactor parse recording * Optimize Telescope::isRecording() condition and caching logic * chore: Disable Telescope filter for cache entries with 'telescope:' prefix * Optimized * chore: Optimize caching logic in Telescope::getCache() method * Optimize caching logic in CacheAspect.php * Optimize caching logic in TelescopeConfig.php * chore: Remove SetupTelescopeFilterListener and optimize caching logic in TelescopeConfig.php and CacheAspect.php * Optimize caching logic in CacheAspect.php * Optimize caching logic in CacheAspect.php * Optimize caching logic in CacheAspect.php * Optimize caching logic in CacheAspect.php * chore: Optimize caching logic in TelescopeConfig.php and CacheAspect.php * chore: Optimize caching logic in TelescopeConfig.php and CacheAspect.php * optimize code * optimize code * optimize code --------- Co-authored-by: 10951 <[email protected]> Co-authored-by: Deeka Wong <[email protected]>
- Loading branch information
1 parent
5d1db60
commit c831b42
Showing
16 changed files
with
227 additions
and
49 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
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of friendsofhyperf/components. | ||
* | ||
* @link https://github.com/friendsofhyperf/components | ||
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
|
||
namespace FriendsOfHyperf\Telescope\Contract; | ||
|
||
use Psr\SimpleCache\CacheInterface as PsrCacheInterface; | ||
|
||
interface CacheInterface extends PsrCacheInterface | ||
{ | ||
} |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of friendsofhyperf/components. | ||
* | ||
* @link https://github.com/friendsofhyperf/components | ||
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
|
||
namespace FriendsOfHyperf\Telescope\Controller; | ||
|
||
use Hyperf\Context\ApplicationContext; | ||
use Hyperf\Contract\ApplicationInterface; | ||
use Hyperf\HttpServer\Annotation\Controller; | ||
use Hyperf\HttpServer\Annotation\DeleteMapping; | ||
use Symfony\Component\Console\Input\ArrayInput; | ||
|
||
#[Controller(server: 'telescope')] | ||
class EntriesController | ||
{ | ||
/** | ||
* Delete all of the entries from storage. | ||
*/ | ||
#[DeleteMapping(path: '/telescope/telescope-api/entries')] | ||
public function destroy(): void | ||
{ | ||
$application = ApplicationContext::getContainer()->get(ApplicationInterface::class); | ||
$application->setAutoExit(false); | ||
$application->run( | ||
new ArrayInput(['command' => 'telescope:clear']) | ||
); | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of friendsofhyperf/components. | ||
* | ||
* @link https://github.com/friendsofhyperf/components | ||
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
|
||
namespace FriendsOfHyperf\Telescope\Controller; | ||
|
||
use FriendsOfHyperf\Telescope\TelescopeConfig; | ||
use Hyperf\Di\Annotation\Inject; | ||
use Hyperf\HttpServer\Annotation\Controller; | ||
use Hyperf\HttpServer\Annotation\PostMapping; | ||
|
||
#[Controller(server: 'telescope')] | ||
class RecordingController | ||
{ | ||
#[Inject()] | ||
protected TelescopeConfig $telescopeConfig; | ||
|
||
/** | ||
* Toggle recording. | ||
*/ | ||
#[PostMapping(path: '/telescope/telescope-api/toggle-recording')] | ||
public function toggle(): void | ||
{ | ||
$this->telescopeConfig->isRecording() ? $this->telescopeConfig->pauseRecording() : $this->telescopeConfig->continueRecording(); | ||
} | ||
} |
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
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
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
Oops, something went wrong.