Sha256: 64647c90599cfe1a6e75c71b26c1fb3c03fdc0ad39c03fc65fc5729b7aa53d7b

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

module HeimdallApm
  class Reporting
    def initialize(context)
      @context = context
    end

    def influx
      @client ||= InfluxDB::Client.new("#{Rails.env}_metrics", time_precision: 'ms', retry: 0)
    end

    def call
      span = @context.vault.retrieve_and_delete_previous_span
      if span && !span.points_collection.empty?
        influx.write_points(span.points_collection.to_a)
      else
        HeimdallApm.logger.debug "Nothing to report"
      end
    rescue => e
      HeimdallApm.logger.error "#{e.message} during reporting to InfluxDB"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heimdall_apm-0.1.2 lib/heimdall_apm/reporting.rb
heimdall_apm-0.1.1 lib/heimdall_apm/reporting.rb
heimdall_apm-0.1.0 lib/heimdall_apm/reporting.rb