Skip to content

Treblle with Ruby on Rails


  • Ruby 2.0+
  • Ruby on Rails 6.1+


Add the gem to your Gemfile:

# Gemfile
gem "treblle", "~> 2.0"

Then add following line to config/application.rb, or if you want to include it to specific environment only, then e.g. config/environments/development.rb which registers Treblle middleware.


You can then configure the gem:

Treblle.configure do |config|
config.api_key = ENV.fetch('TREBLLE_API_KEY')
config.project_id = ENV.fetch('TREBLLE_PROJECT_ID')
config.enabled_environments = %w[staging development]
config.sensitive_attrs = %w[top_secret_custom_attribute password_digest]
config.restricted_endpoints = %w[/api/users /api/v2/*]
config.whitelisted_endpoints = %w[/api/]

You can use any of the configuration options below:

config.api_key(required) Valid API key obtained during registration on
config.project_id(required) Valid Project ID obtained after creating a new project on
config.enabled_environments(required) Enables monitoring on specified environments.
config.sensitive_attrs(optional) Mask additional attributes.
config.restricted_endpoints(optional) Routes that you don’t want to monitor.
config.whitelisted_endpoints(optional) Routes that you want to monitor, by default /api/.