1 of 12

Laravel Telescope

2 of 12

What problem does it solve?

  • Currently, there is a need for 3rd party packages to enhance debugging
    • Eg. DebugBar
  • Local/Staging environments usually require the use of many 3rd party tools for debugging
    • Eg. Mailtrap
  • However that is made more complicated for API projects
    • No DebugBar for you!
  • Huge wealth of information could be collected, but there is no one central place to get it

3 of 12

4 of 12

5 of 12

Installation

  • Several composer & artisan commands
  • You will likely need to customise
    • config/telescope.php
      • I also made query slow time customisable
    • TelescopeServiceProvider::gate() to specify how to allow access (for non local env)
      • <for api>
  • Uses DB by default
    • $schedule->command('telescope:prune')->daily();
    • Could use something like ElasticSearch
  • TelescopeServiceProvider’s gate function
    • Determines who can view on non-local environments
  • Updating
    • Republish Assets

6 of 12

Demo

7 of 12

Issues & Gotchas

  • Authorization with API
    • Kind of not applicable
  • Some parts of it are not documented
    • For example, tags / monitoring
  • Redis is blank
    • It relates to the Redis direct commands using facade

  • Logging things done in tinker
    • Need to run “return false;” before terminating tinker session
  • Does not log everything with large datasets
    • Use tinker to confirm

8 of 12

9 of 12

Useful Tips

  • You can filter certain entries in the Service provider
    • For example, Dingo API Request events
  • You can change between light and dark mode
    • In ServiceProvider
  • It pays to look at recent issues and PRs on github
  • Remember to keep your dump page open for dumps

10 of 12

Telescope for automated testing

  • Unfortunately no way to enable this
    • There is a hard “switch” in the telescope
    • bootstrap code for testing environment
  • I made a PR to make this configurable
  • Another user tried to implement it differently
  • There are other workarounds…
    • Like changing your test environment name!

11 of 12

Telescope for production

  • Not designed for efficiency
    • Heavy write load
    • Logging overhead
  • Security & Privacy
    • User data
    • (Hashed) Passwords, potentially other secrets
  • Potentially worthwhile for startups / soft launches
  • Would be great if you could queue it’s writes
    • However what about payload size?

12 of 12

Conclusion: Telescope is pretty useful