Eyeloupe is the elegant Rails debug assistant. It helps you to debug your Rails application by providing a simple and elegant interface to view your incoming/outgoing requests and exceptions, powered by AI.
Add this line to your application's Gemfile:
And then execute:
Install Eyeloupe migrations into your project:
$ rails eyeloupe:install:migrations
And run the migrations:
$ rails db:migrate
To access Eyeloupe dashboard you need to add the following route to your
mount Eyeloupe::Engine => "/eyeloupe"
This is an example of the configuration you can add to your
Eyeloupe.configure do |config| config.excluded_paths = %w[assets favicon.ico service-worker.js manifest.json] config.capture = Rails.env.development? config.openai_access_key = "your-openai-access-key" config.openai_model = "gpt-4" config.database = 'eyeloupe' end
excluded_pathsis an array of paths you want to exclude from Eyeloupe capture. Eyeloupe adds these excluded paths to the default ones:
%w[mini-profiler eyeloupe active_storage]
captureis a boolean to enable/disable Eyeloupe capture. By default, it's set to
openai_access_keyis the access key to use the OpenAI API. You can get one here.
openai_modelis the model to use for the OpenAI API. You can find the list of available models here.
databaseis an optional database config Eyeloupe will use (Database).
By default, Eyeloupe uses the same database as your application. If you want to use a different database to keep your production environment clean, you can add a new database config in your
development: primary: <<: *default database: db/development.sqlite3 eyeloupe: <<: *default database: db/eyeloupe.sqlite3 migrations_paths: <%= Gem.loaded_specs['eyeloupe'].full_gem_path + '/db/migrate' %> schema_dump: false
Using this you can skip the
eyeloupe:install:migrations step, but do not forget to run
rails db:migrate RAILS_ENV=eyeloupe to setup the database.
To be able to handle exceptions, be sure to disable the default Rails exception handling in your environment config file (e.g.
config.consider_all_requests_local = false
Eyeloupe is exclusively developed for the Rails framework.
You can use it in your development environment to debug your application but it's not recommended to use it in production.
By activating auto-fresh, every 3 seconds the page will be refreshed to show you the latest data.
Delete all data
You can delete all the data stored by Eyeloupe by clicking on the trash button.
When you define an OpenAI access key in the configuration, you could see a new section in the exception details page. This section is powered by the OpenAI API and it's able to give you a solution to solve your exception. It sends the entire content of the file containing the exception to have the best answer to your problem.
When your upgrade Eyeloupe to the latest version, be sure to run the following commands:
$ rails eyeloupe:install:migrations $ rails db:migrate
Why the request time is not the same on rack-mini-profiler ?
Eyeloupe is not a performance-oriented tool, the request time is the same you can view in the Rails log. If you want more details about your load time, you can use rack-mini-profiler along with Eyeloupe.
Is this the Laravel Telescope for Rails ?
Yes, Eyeloupe is inspired by Laravel Telescope. A lot of people coming from Laravel are missing Telescope or looking for something similar, so Eyeloupe is here to fill this gap.
- Exceptions - Track all the exceptions thrown by your application
- AI assistant - Use OpenAI API to help you to solve your exceptions
- Custom links to the menu - To access all of your debug tool in one place (Sidekiq web, Mailhog, etc.)
- Refactoring / clean code - To make the code more readable and maintainable
Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/amazing_feature)
- Commit your Changes (
git commit -m 'Add some amazing feature')
- Push to the Branch (
git push origin feature/amazing_feature)
- Open a Pull Request
The gem is available as open source under the terms of the MIT License.
Project Link: https://github.com/alxlion/eyeloupe