This commit is contained in:
Nick Gauthier 2016-10-31 15:52:48 -04:00
Родитель c122f59a5c
Коммит 4c343203c9
3 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -22,6 +22,13 @@ module LightStep
def self.micros(time)
(time.to_f * 1E6).floor
end
# Returns a random guid. Note: this intentionally does not use SecureRandom,
# which is slower and cryptographically secure randomness is not required here.
def self.guid
@_rng ||= Random.new
@_rng.bytes(8).unpack('H*')[0]
end
end
require 'lightstep/tracer'

Просмотреть файл

@ -43,7 +43,7 @@ module LightStep
@baggage = Concurrent::Hash.new
@tracer = tracer
@guid = tracer.generate_guid
@guid = LightStep.guid
self.operation_name = operation_name
self.start_micros = start_micros
self.trace_guid = trace_guid

Просмотреть файл

@ -84,7 +84,7 @@ module LightStep
child_of_guid = child_of.guid
trace_guid = child_of.trace_guid
else
trace_guid = generate_guid
trace_guid = LightStep.guid
end
Span.new(
@ -186,13 +186,6 @@ module LightStep
@dropped_logs.increment if full
end
# Returns a random guid. Note: this intentionally does not use SecureRandom,
# which is slower and cryptographically secure randomness is not required here.
def generate_guid
@_rng ||= Random.new
@_rng.bytes(8).unpack('H*')[0]
end
protected
def access_token=(token)
@ -212,7 +205,7 @@ module LightStep
@dropped_spans = Concurrent::AtomicFixnum.new
start_time = LightStep.micros(Time.now)
@guid = generate_guid
@guid = LightStep.guid
@report_start_time = start_time
@last_flush_micros = start_time