Ruby (beta)

Trackets now supports error tracking for Ruby applications using the Trackets Ruby Gem. The setup for Ruby on Rails is very simple, you just need to add the gem to your Gemfile.

gem "trackets"

Install the gem unsing Bundler.

$ bundle install

And configure using your project's API keys.

$ rails g trackets:install PUBLIC_KEY PRIVATE_KEY

The last step is to simply send a test exception to verify that everything has been setup properly.

$ rake trackets:test

JavaScript integration with the trackets-ruby gem

If you wish to enable JavaScript error tracking, you can do so using a helper which this gem provides.Simply include the following snippet in your app/views/layout/application.html.erb in the <head> tag directly above your application JavaScript.

<%= trackets_include_tag %>

<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>



The configuration for the gem can be found under config/initializers/trackets.rb.

Trackets.setup do |config|
# Public API key used by JavaScript for your project
config.public_api_key = "ebf6d706b29ca4e176012a3dc3b017a8"

# Private API key used for Ruby notifications
config.private_api_key = "77773de2325364bcc1d955e7aa3e7e1f"

# [Default: false] Send notification in a separate thread (Uses Sucker Punch gem)
config.async = true

Rack support

We also provide a way to track errors in Rack applications in general.

require 'rack'
require 'trackets'

Trackets.setup do |config|
config.private_api_key = "insert-valid-api-key"

app = do
run lambda { |env| raise "Testing Error" }

use Trackets::Middleware::RackExceptionHandler
run app


Trackets will also automatically capture errors in Sidekiq workers. There is no additional configuration you need to do to enable this, everything happens automatically.

Using Trackets in other than production environment

By default Trackets will only log errors in the `production` environment. If you wish to log errors in any other environment, such as `development` or staging, simply add the following snippets in the config/initializers/trackets.rb file.

config.enabled_env << :development

Environment variables

While Trackets logs environment variables with each error, we are aware that some environment variables might contain sensitive information. This is why we only log a specific list of whitelist variables. If you have your own environment variables which you'd like to have included in the list, simply add the following in the config/initializers/trackets.rb file.

config.whitelisted_env << "SOME_ENV_VARIABLE"

The added variable names will be added to the whitelist.

Rails parameters

As it was with the environment variables, it is also possible that there could be some sensitive information in the parameters sent from the user. Because it would be impossible to whitelist all the possible params that your application is using, we're using the same blacklist as Ruby on Rails does when logging. You can view the attributes that are blacklisted by default here. You can add custom parameters to the blacklist by adding the following snippet in the config/initializers/trackets.rb file.

config.blacklisted_params << "my_custom_api_key"

This will cause all of the added custom parameters to be replaced by a "[FILTERED]" string on Trackets.