Skip to Content

Treblle Docs

The official Treblle SDK for JavaScript frameworks including Ruby. Seamlessly integrate Treblle to manage communication with your dashboard, send errors, and secure sensitive data.

Treblle with Ruby

Requirements

  • Ruby 2.0+
  • Ruby on Rails 6.1+

Installation

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.

config.middleware.use(Treblle)

You can then configure the gem:

# config/initializers/treblle.rb Treblle.configure do |config| config.api_key = ENV.fetch('TREBLLE_API_KEY') config.sdk_token = ENV.fetch('TREBLLE_SDK_TOKEN') 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/] end

You can use any of the configuration options below:

Option

Description

config.api_key

(Required) Valid API key obtained during registration on treblle.com

config.sdk_token

(Required) Valid SDK Token obtained after adding a new api on treblle.com

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/

Last updated on