Sha256: 8c765e0b20454b968201b82290512175fdb1900fddee794f99ec045d4c0fddd5

Contents?: true

Size: 455 Bytes

Versions: 4

Compression:

Stored size: 455 Bytes

Contents

require 'thread'

module Datadog
  # Utils contains low-level utilities, typically to provide pseudo-random trace IDs.
  module Utils
    # We use a custom random number generator because we want no interference
    # with the default one. Using the default prng, we could break code that
    # would rely on srand/rand sequences.
    @rnd = Random.new

    # Return a span id
    def self.next_id
      @rnd.rand(Datadog::Span::MAX_ID)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fair-ddtrace-0.8.2.a lib/ddtrace/utils.rb
ddtrace-0.8.2 lib/ddtrace/utils.rb
ddtrace-0.8.1 lib/ddtrace/utils.rb
ddtrace-0.8.0 lib/ddtrace/utils.rb