Sha256: 85c47e767bf044b6777cc29be1990648e674784611e27b436dd809a94bcb4699

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

module Honeybadger
  module Monitor
    class Sender < Honeybadger::Sender
      def send_metrics(data)
        return unless Honeybadger.configuration.metrics?

        if !Honeybadger.configuration.features['metrics']
          log(:info, "The optional metrics feature is not enabled for your account.  Try restarting your app or contacting support@honeybadger.io if your subscription includes this feature.")
          Honeybadger.configuration.metrics = false
          return nil
        end

        response = rescue_http_errors do
          http_connection.post('/v1/metrics', data.to_json, http_headers)
        end

        if Net::HTTPSuccess === response
          true
        else
          Honeybadger.configuration.features['metrics'] = false if Net::HTTPForbidden === response
          log(:error, "Metrics Failure: #{response.class}", response, data)
          false
        end
      rescue => e
        log(:error, "[Honeybadger::Monitor::Sender#send_metrics] Error: #{e.class} - #{e.message}\nBacktrace:\n#{e.backtrace.join("\n\t")}")
        true
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
honeybadger-1.13.0 lib/honeybadger/monitor/sender.rb
honeybadger-1.12.0.beta3 lib/honeybadger/monitor/sender.rb
honeybadger-1.12.0.beta2 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.2 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.1 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.0 lib/honeybadger/monitor/sender.rb
honeybadger-1.10.3 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.0.beta4 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.0.beta3 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.0.beta2 lib/honeybadger/monitor/sender.rb
honeybadger-1.10.2 lib/honeybadger/monitor/sender.rb
honeybadger-1.11.0.beta1 lib/honeybadger/monitor/sender.rb
honeybadger-1.10.1 lib/honeybadger/monitor/sender.rb
honeybadger-1.10.0 lib/honeybadger/monitor/sender.rb