From 5b30df3ec968eea973b8c6a96576e94fdc3fdfd2 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Sun, 21 Aug 2016 07:57:07 +0700 Subject: [PATCH] remove appsignal, print errors for Papertrail Appsignal continues to spam the log with Thread warnings, and we have no one to maintain the integration. This change means at least errors will be sent into papertrail, where they can be surfaced by Slack. --- Gemfile | 1 - Gemfile.lock | 5 ----- lib/bundler_api/agent_reporting.rb | 6 +----- lib/bundler_api/appsignal.rb | 11 ----------- lib/bundler_api/metriks.rb | 2 +- lib/bundler_api/web.rb | 6 ++---- 6 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 lib/bundler_api/appsignal.rb diff --git a/Gemfile b/Gemfile index 98db51c..5f1ee32 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,6 @@ git_source(:github) do |repo| "https://github.com/#{repo}.git" end -gem 'appsignal', '0.11.6.beta.0' gem 'librato-metrics' gem 'metriks-librato_metrics', github: 'indirect/metriks-librato_metrics' gem 'metriks-middleware' diff --git a/Gemfile.lock b/Gemfile.lock index 6757d4e..c8aa39e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,9 +15,6 @@ GEM remote: https://rubygems.org/ specs: aggregate (0.2.2) - appsignal (0.11.6.beta.0) - rack - thread_safe artifice (0.6) rack-test ast (2.2.0) @@ -100,7 +97,6 @@ GEM tilt (>= 1.3, < 3) slop (3.6.0) thor (0.19.1) - thread_safe (0.3.5) tilt (2.0.2) unicode-display_width (0.3.1) @@ -108,7 +104,6 @@ PLATFORMS ruby DEPENDENCIES - appsignal (= 0.11.6.beta.0) artifice compact_index dalli diff --git a/lib/bundler_api/agent_reporting.rb b/lib/bundler_api/agent_reporting.rb index 615d5eb..d9c29b9 100644 --- a/lib/bundler_api/agent_reporting.rb +++ b/lib/bundler_api/agent_reporting.rb @@ -56,11 +56,7 @@ def known_id?(id) BundlerApi.redis.setex(id, 120, true) false rescue => ex - # Sometimes we get these, and there's no point throwing out a perfectly - # good metric. We still, however, want to report it in Appsignal so that - # we know what's up. - Appsignal.add_exception(ex) if defined?(Appsignal) - + STDERR.puts "[Error][AgentReporting] `known_id?` raised #{e.class}: #{e.message}" false end end diff --git a/lib/bundler_api/appsignal.rb b/lib/bundler_api/appsignal.rb deleted file mode 100644 index bb8fd2c..0000000 --- a/lib/bundler_api/appsignal.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'appsignal' - -Appsignal.logger.info("Loading Sinatra (#{Sinatra::VERSION}) integration") - -root_path = File.expand_path(File.dirname(__FILE__)) -environment = ENV['DYNO'] ? 'production' : 'development' -config = Appsignal::Config.new(root_path, environment, name: 'bundler-api') - -Appsignal.config = config -Appsignal.start_logger($STDOUT) -Appsignal.start diff --git a/lib/bundler_api/metriks.rb b/lib/bundler_api/metriks.rb index f041785..ffa9ad2 100644 --- a/lib/bundler_api/metriks.rb +++ b/lib/bundler_api/metriks.rb @@ -35,7 +35,7 @@ def source_name(worker = nil) def error_handler -> (e) do - STDOUT.puts("[Metriks][Librato] #{e.class} raised during metric submission: #{e.message}") + STDOUT.puts("[Error][Librato] #{e.class} raised during metric submission: #{e.message}") if e.is_a?(::Metriks::LibratoMetricsReporter::RequestFailedError) STDOUT.puts(" Response body: #{e.res.body}") diff --git a/lib/bundler_api/web.rb b/lib/bundler_api/web.rb index 5b5728c..cf50800 100644 --- a/lib/bundler_api/web.rb +++ b/lib/bundler_api/web.rb @@ -6,7 +6,6 @@ require 'bundler_api/agent_reporting' require 'bundler_api/checksum' require 'bundler_api/gem_info' -require 'bundler_api/appsignal' require 'bundler_api/cache' require 'bundler_api/metriks' require 'bundler_api/runtime_instrumentation' @@ -22,8 +21,6 @@ class BundlerApi::Web < Sinatra::Base NEW_INDEX_ENABLED = ENV['NEW_INDEX_DISABLED'].nil? unless ENV['RACK_ENV'] == 'test' - use Appsignal::Rack::Listener, name: 'bundler-api' - use Appsignal::Rack::SinatraInstrumentation use Metriks::Middleware use BundlerApi::AgentReporting end @@ -277,7 +274,8 @@ def in_background begin yield rescue => e - Appsignal.send_exception(e) + STDOUT.puts "[Error][Web] #{e.class} raised during background task: #{e.message}") + STDERR.puts e.backtrace.join("\n ") end end end