Sha256: 34378a6309c8a3a3c7aa42121d378adc87a13a2c5818bf6602238ddd5b65c761

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

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 = send_request('/v1/metrics', data.to_json)

        if Net::HTTPSuccess === response
          log(:info, "Metrics Success: #{response.class}", response) if Honeybadger.configuration.debug
          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

      def send_traces(data)
        return unless Honeybadger.configuration.traces?
        return unless Honeybadger.configuration.features['traces']

        response = send_request('/v1/traces', data.to_json)

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

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
honeybadger-1.16.7 lib/honeybadger/monitor/sender.rb
honeybadger-1.16.6 lib/honeybadger/monitor/sender.rb
honeybadger-1.16.5 lib/honeybadger/monitor/sender.rb
honeybadger-1.16.4 lib/honeybadger/monitor/sender.rb
honeybadger-1.16.3 lib/honeybadger/monitor/sender.rb