Sha256: 22dbb157f47fa0aacc983efb829e5d99228a95335bf67f2133e589d95a978057

Contents?: true

Size: 1003 Bytes

Versions: 4

Compression:

Stored size: 1003 Bytes

Contents

module NewRelic
  module Agent
    module Instrumentation
      class BrowserMonitoringTimings

        def initialize(queue_time_in_seconds, transaction)
          if transaction.nil?
            @start_time_in_seconds = 0.0
          else
            @transaction_name = transaction.transaction_name
            @start_time_in_seconds = transaction.start_time
          end

          @queue_time_in_seconds = queue_time_in_seconds
        end

        attr_reader :transaction_name

        def start_time_in_millis
          convert_to_milliseconds(@start_time_in_seconds)
        end

        def queue_time_in_millis
          convert_to_milliseconds(@queue_time_in_seconds)
        end

        def app_time_in_millis
          convert_to_milliseconds(Time.now - @start_time_in_seconds)
        end

        private

        def convert_to_milliseconds(value)
          value = (value.to_f * 1000.0).round
          return 0.0 if value < 0
          value
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
newrelic_rpm-3.5.5.39.beta lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb
wd_newrelic_rpm-3.5.5 lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb
newrelic_rpm-3.5.5.38 lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb
newrelic_rpm-3.5.5.540.dev lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb