module SplunkTracing

Splunk Tracer

Constants

VERSION

Public Class Methods

guid() click to toggle source

Returns a random guid. Note: this intentionally does not use SecureRandom, which is slower and cryptographically secure randomness is not required here.

# File lib/splunktracing.rb, line 30
def self.guid
  unless @_lastpid == Process.pid
    @_lastpid = Process.pid
    @_rng = Random.new
  end
  @_rng.bytes(8).unpack('H*')[0]
end
instance() click to toggle source

Returns the singleton instance of the Tracer.

# File lib/splunktracing.rb, line 12
def self.instance
  SplunkTracing::GlobalTracer.instance
end
logger() click to toggle source
# File lib/splunktracing.rb, line 38
def self.logger
  @logger ||= defined?(::Rails) ? Rails.logger : Logger.new(STDOUT)
end
logger=(logger) click to toggle source
# File lib/splunktracing.rb, line 42
def self.logger=(logger)
  @logger = logger
end
micros(time) click to toggle source

Convert a time to microseconds

# File lib/splunktracing.rb, line 24
def self.micros(time)
  (time.to_f * 1E6).floor
end