Skip to content

Commit 37f2102

Browse files
committed
Add Skylight stuff
1 parent c1db396 commit 37f2102

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ gem 'bunny', '~> 0.8.0'
2020
gem 'dalli'
2121
gem 'pry'
2222
gem 'metriks', '0.9.9.5'
23+
gem 'skylight'
2324

2425
group :test do
2526
gem 'rspec', '~> 2.13'

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ GEM
251251
rack-test
252252
sinatra (~> 1.4.0)
253253
tilt (~> 1.3)
254+
skylight (0.3.10)
255+
activesupport (>= 3.0.0)
254256
slop (3.4.7)
255257
sprockets (2.2.2)
256258
hike (~> 1.2)
@@ -299,6 +301,7 @@ DEPENDENCIES
299301
sentry-raven!
300302
sinatra
301303
sinatra-contrib
304+
skylight
302305
travis-api!
303306
travis-core!
304307
travis-sidekiqs!

config.ru

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,18 @@ class RackTimer
3030
end
3131
end
3232

33+
if ENV['SKYLIGHT_APPLICATION']
34+
require 'skylight'
35+
require 'logger'
36+
config = Skylight::Config.load(nil, ENV['RACK_ENV'], ENV)
37+
config['root'] = File.expand_path('..', __FILE__)
38+
config['agent.sockfile_path'] = File.expand_path('../tmp', __FILE__)
39+
config.logger = Logger.new(STDOUT)
40+
config.validate!
41+
Skylight.start!(config)
42+
43+
use Skylight::Middleware
44+
end
45+
3346
use RackTimer
3447
run Travis::Api::App.new

lib/travis/api/app/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def call(env)
4444
disable :protection, :logging, :setup
4545
enable :raise_errors
4646
# disable :dump_errors
47-
register :subclass_tracker, :expose_pattern
47+
register :subclass_tracker, :expose_pattern, :skylight
4848
helpers :respond_with, :mime_types
4949
end
5050

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'travis/api/app'
2+
require 'skylight'
3+
4+
class Travis::Api::App
5+
module Extensions
6+
module Skylight
7+
def route(verb, path, *)
8+
condition do
9+
trace = ::Skylight::Instrumenter.instance.current_trace
10+
endpoint = settings.name.to_s.split("::", 5).last.gsub(/::/, "/").downcase
11+
trace.endpoint = "#{verb} /#{endpoint}#{path}"
12+
end
13+
14+
super
15+
end
16+
end
17+
end
18+
end

tmp/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)