Module: LightStep

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

Overview

LightStep Tracer

Defined Under Namespace

Modules: Propagation, Transport Classes: Error, GlobalTracer, Reporter, Scope, ScopeManager, Span, SpanContext, Tracer

Constant Summary collapse

VERSION =
'0.17.0'

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.



31
32
33
34
35
36
37
# File 'lib/lightstep.rb', line 31

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



39
40
41
# File 'lib/lightstep.rb', line 39

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

.logger=(logger) ⇒ Object



43
44
45
# File 'lib/lightstep.rb', line 43

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

.micros(time) ⇒ Object

Convert a time to microseconds



25
26
27
# File 'lib/lightstep.rb', line 25

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