Sha256: 133fe7b160bf6166d9fe1bec08806b6fe9a40528697c21ef91e7b51a60bb7e44

Contents?: true

Size: 831 Bytes

Versions: 3

Compression:

Stored size: 831 Bytes

Contents

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

        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

3 entries across 3 versions & 1 rubygems

Version Path
honeybadger-1.14.0 lib/honeybadger/monitor/sender.rb
honeybadger-1.13.2 lib/honeybadger/monitor/sender.rb
honeybadger-1.13.1 lib/honeybadger/monitor/sender.rb