Skip to content

Instantly share code, notes, and snippets.

@danriti
Last active December 30, 2015 23:28
Show Gist options
  • Save danriti/7900426 to your computer and use it in GitHub Desktop.
Save danriti/7900426 to your computer and use it in GitHub Desktop.
Sinatra Example for TraceView Heroku Add-on
require 'sinatra'
get '/' do
"Hello, world"
end
require './app'
require 'oboe-heroku'
# 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
# You may want to replace the Oboe.logger with whichever logger you are using
# Oboe.logger = Sinatra.logger
run Sinatra::Application
source "https://rubygems.org"
ruby "2.0.0"
gem 'sinatra'
group :production, :staging do
gem 'oboe-heroku', '~> 0.9.10.0'
end
GEM
remote: https://rubygems.org/
remote: https://[email protected]/pglombardo/
specs:
json (1.8.1)
oboe (2.6.2.0)
json
oboe-heroku (0.9.10.0)
oboe (>= 2.6.2.0)
rack (1.5.2)
rack-protection (1.5.1)
rack
sinatra (1.4.4)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
PLATFORMS
ruby
DEPENDENCIES
oboe-heroku (= 0.9.10.0)
sinatra
web: bundle exec rackup config.ru -p $PORT
@caseprince
Copy link

Note: Oboe::Config[:tracing_mode] = 'through' seemed to prevent initial tracing

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