Skip to content

Instantly share code, notes, and snippets.

@pglombardo
Last active December 22, 2015 16:38
Show Gist options
  • Save pglombardo/6500323 to your computer and use it in GitHub Desktop.
Save pglombardo/6500323 to your computer and use it in GitHub Desktop.
Instrumenting a Sinatra (or Padrino) Application with TraceView

You can instrument your Sinatra or Padrino app by adding the oboe gem to your Gemfile, running bundle install and adding the following code to your config.ru. Make sure to set :tracing_mode and :sample_rate accordingly.

require 'oboe'

# When traces should be initiated for incoming requests. Valid options are
# “always,” “through” (when the request is initiated with a tracing header 
# from upstream) and “never”. You must set this directive to “always” in 
# order to initiate tracing.
Oboe::Config[:tracing_mode] = 'through'

# You can remove the following line in production to allow for
# auto sampling or managing the sample rate through the TraceView portal.
# Oboe::Config[:sample_rate] = 1000000

Oboe::Ruby.initialize
use Oboe::Rack

In a future release of Traceview, much of this will be automated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment