Module: LightStep

Extended by:
SingleForwardable
Defined in:
lib/lightstep.rb,
lib/lightstep/span.rb,
lib/lightstep/tracer.rb,
lib/lightstep/version.rb,
lib/lightstep/reporter.rb,
lib/lightstep/span_context.rb,
lib/lightstep/global_tracer.rb,
lib/lightstep/transport/nil.rb,
lib/lightstep/transport/base.rb,
lib/lightstep/transport/callback.rb,
lib/lightstep/transport/http_json.rb

Overview

LightStep Tracer

Defined Under Namespace

Modules: Transport Classes: Error, GlobalTracer, Reporter, Span, SpanContext, Tracer

Constant Summary collapse

VERSION =
'0.11.2'.freeze

Class Method Summary collapse

Class Method Details

.guidObject

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



29
30
31
32
33
34
35
# File 'lib/lightstep.rb', line 29

def self.guid
  unless @_lastpid == Process.pid
    @_lastpid = Process.pid
    @_rng = Random.new
  end
  @_rng.bytes(8).unpack('H*')[0]
end

.instanceObject

Returns the singleton instance of the Tracer.



12
13
14
# File 'lib/lightstep.rb', line 12

def self.instance
  LightStep::GlobalTracer.instance
end

.loggerObject



37
38
39
# File 'lib/lightstep.rb', line 37

def self.logger
  @logger ||= defined?(::Rails) ? Rails.logger : Logger.new(STDOUT)
end

.logger=(logger) ⇒ Object



41
42
43
# File 'lib/lightstep.rb', line 41

def self.logger=(logger)
  @logger = logger
end

.micros(time) ⇒ Object

Convert a time to microseconds



23
24
25
# File 'lib/lightstep.rb', line 23

def self.micros(time)
  (time.to_f * 1E6).floor
end