Skip to content

npezza93/activeinsights

Repository files navigation

ActiveInsights

One of the fundamental tools needed when taking your Rails app to production is a way to track response times. Unfortunately, there aren't many free, easy, open source ways to track them for small or medium apps. Skylight, Honeybadger, Sentry, AppSignal, etc. are great, but they are are closed source and there should be an easy open source alternative where you control the data. With Rails 8's ethos of No PAAS, there should be a way for new apps to start out with a basic error reporter and not be forced to pay a third party for one.

ActiveInsights hooks into the ActiveSupport instrumention baked directly into Rails. ActiveInsights tracks RPM, RPM per controller, and p50/p95/p99 response times and charts all those by the minute. It also tracks jobs per minute, their duration, and latency.

screenshot 1 screenshot 2 screenshot 3 screenshot 4 screenshot 5

Installation

Add this line to your application's Gemfile:

gem "activeinsights"

And then execute:

$ bundle

Or install it yourself as:

$ gem install activeinsights

Run the installer and migrate:

bin/rails active_insights:install
bin/rails rails db:migrate

This will mount a route in your routes file to view the insights at /insights.

Config

You can supply a hash of connection options to connects_to set the connection options for the Request model.

config.active_insights.connects_to = { database: { writing: :requests, reading: :requests } }

You can supply an array of ignored endpoints

config.active_insights.ignored_endpoints = ["Rails::HealthController#show"]

If you are using Sprockets, add the ActiveInsights css file to manifest.js:

//= link active_insights/application.css

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rails test to run the unit tests.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, execute bin/publish (major|minor|patch) which will update the version number in version.rb, create a git tag for the version, push git commits and tags, and push the .gem file to GitHub.

Contributing

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

About

Track response times and RPM inside your Rails app

Resources

License

Stars

Watchers

Forks