Sha256: 204d8df016e0fcc585877eb79830077a7400883b579c4ad8b18efaf927dbcaaa

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 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 = client.post do |p|
          p.url "/v1/metrics"
          p.body = data.to_json
        end

        if response.success?
          true
        else
          Honeybadger.configuration.features['metrics'] = false if response.status == 403
          log(:error, "Metrics Failure", 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

5 entries across 5 versions & 1 rubygems

Version Path
honeybadger-1.9.5 lib/honeybadger/monitor/sender.rb
honeybadger-1.9.4 lib/honeybadger/monitor/sender.rb
honeybadger-1.9.3 lib/honeybadger/monitor/sender.rb
honeybadger-1.9.2 lib/honeybadger/monitor/sender.rb
honeybadger-1.9.1 lib/honeybadger/monitor/sender.rb