From 192af7b1b77743176f161ff016a0930a4ccb675a Mon Sep 17 00:00:00 2001 From: Henrik Hodne Date: Tue, 29 Jul 2014 11:21:15 +0200 Subject: [PATCH] Remove Skylight --- Gemfile | 2 - Gemfile.lock | 9 ---- lib/travis/api/app/base.rb | 8 --- lib/travis/api/app/skylight/dalli_probe.rb | 24 --------- lib/travis/api/app/skylight/redis_probe.rb | 31 ------------ lib/travis/api/app/skylight/service_probe.rb | 51 -------------------- travis-api.gemspec | 3 -- 7 files changed, 128 deletions(-) delete mode 100644 lib/travis/api/app/skylight/dalli_probe.rb delete mode 100644 lib/travis/api/app/skylight/redis_probe.rb delete mode 100644 lib/travis/api/app/skylight/service_probe.rb diff --git a/Gemfile b/Gemfile index 232eea34..49579f5c 100644 --- a/Gemfile +++ b/Gemfile @@ -24,8 +24,6 @@ gem 'pry' gem 'metriks', '0.9.9.6' gem 'metriks-librato_metrics', github: 'eric/metriks-librato_metrics' -gem 'skylight', github: 'henrikhodne/skylight-ruby', branch: 'master-sinatra' - group :test do gem 'rspec', '~> 2.13' gem 'factory_girl', '~> 2.4.0' diff --git a/Gemfile.lock b/Gemfile.lock index 886fa1c9..e0713bbd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,14 +14,6 @@ GIT hashie (>= 1.1.0) uuidtools -GIT - remote: git://github.com/henrikhodne/skylight-ruby.git - revision: 76f66ce091dd8fd40d9a2c429e4afacb41cb1491 - branch: master-sinatra - specs: - skylight (0.3.12) - activesupport (>= 3.0.0) - GIT remote: git://github.com/rack/rack-contrib.git revision: 5c12ace4ba2b9e4802e4d948a8ee0114da18760b @@ -347,7 +339,6 @@ DEPENDENCIES sentry-raven! sinatra sinatra-contrib - skylight! travis-api! travis-core! travis-sidekiqs! diff --git a/lib/travis/api/app/base.rb b/lib/travis/api/app/base.rb index 93ecab1a..d5f07bee 100644 --- a/lib/travis/api/app/base.rb +++ b/lib/travis/api/app/base.rb @@ -7,14 +7,6 @@ class Travis::Api::App class Base < Sinatra::Base register Extensions::SmartConstants - if ENV['SKYLIGHT_APPLICATION'] - require 'skylight' - require 'travis/api/app/skylight/dalli_probe' - require 'travis/api/app/skylight/redis_probe' - require 'travis/api/app/skylight/service_probe' - register ::Skylight::Sinatra - end - error NotImplementedError do content_type :txt status 501 diff --git a/lib/travis/api/app/skylight/dalli_probe.rb b/lib/travis/api/app/skylight/dalli_probe.rb deleted file mode 100644 index 8a63cc95..00000000 --- a/lib/travis/api/app/skylight/dalli_probe.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'skylight' -require 'travis/api/app' - -class Travis::Api::App - module Skylight - class DalliProbe - def install - %w[get get_multi set add incr decr delete replace append prepend].each do |method_name| - next unless Dalli::Client.method_defined?(method_name.to_sym) - Dalli::Client.class_eval <<-EOD - alias #{method_name}_without_sk #{method_name} - def #{method_name}(*args, &block) - ::Skylight.instrument(category: "api.memcache.#{method_name}", title: "Memcache #{method_name}") do - #{method_name}_without_sk(*args, &block) - end - end - EOD - end - end - end - - ::Skylight::Probes.register("Dalli::Client", "dalli", DalliProbe.new) - end -end diff --git a/lib/travis/api/app/skylight/redis_probe.rb b/lib/travis/api/app/skylight/redis_probe.rb deleted file mode 100644 index 491e6886..00000000 --- a/lib/travis/api/app/skylight/redis_probe.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'skylight' -require 'travis/api/app' - -class Travis::Api::App - module Skylight - class RedisProbe - def install - ::Redis::Client.class_eval do - alias call_without_sk call - - def call(command_parts, &block) - command = command_parts[0].upcase - - opts = { - category: "api.redis.#{command.downcase}", - title: "Redis #{command}", - annotations: { - command: command.to_s - } - } - - ::Skylight.instrument(opts) do - call_without_sk(command_parts, &block) - end - end - end - end - end - ::Skylight::Probes.register("Redis", "redis", RedisProbe.new) - end -end diff --git a/lib/travis/api/app/skylight/service_probe.rb b/lib/travis/api/app/skylight/service_probe.rb deleted file mode 100644 index b71dc661..00000000 --- a/lib/travis/api/app/skylight/service_probe.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'skylight' -require 'travis/api/app' - -class Travis::Api::App - module Skylight - class ServiceProbe - class ServiceProxy < Delegator - def initialize(key, service) - super(service) - @key = key - @service = service - end - - def __getobj__ - @service - end - - def __setobj__(obj) - @service = obj - end - - def run(*args) - opts = { - category: "api.service.#{@key}", - title: "Service #{@key}", - annotations: { - service: @key.to_s - } - } - - ::Skylight.instrument(opts) do - @service.run(*args) - end - end - end - - def install - Travis::Services::Helpers.class_eval do - alias service_without_sk service - - def service(key, *args) - s = service_without_sk(key, *args) - ServiceProxy.new(key, s) - end - end - end - end - - ::Skylight::Probes.register("Travis::Services::Helpers", "travis/services/helpers", ServiceProbe.new) - end -end diff --git a/travis-api.gemspec b/travis-api.gemspec index 013099df..7719fff7 100644 --- a/travis-api.gemspec +++ b/travis-api.gemspec @@ -119,9 +119,6 @@ Gem::Specification.new do |s| "lib/travis/api/app/responders/plain.rb", "lib/travis/api/app/responders/service.rb", "lib/travis/api/app/responders/xml.rb", - "lib/travis/api/app/skylight/dalli_probe.rb", - "lib/travis/api/app/skylight/redis_probe.rb", - "lib/travis/api/app/skylight/service_probe.rb", "lib/travis/api/serializer.rb", "lib/travis/api/v2.rb", "lib/travis/api/v2/http.rb",