lib/instana/util.rb in instana-1.7.1 vs lib/instana/util.rb in instana-1.7.2
- old
+ new
@@ -1,8 +1,10 @@
module Instana
module Util
class << self
+ ID_RANGE = -2**63..2**63-1
+
# An agnostic approach to method aliasing.
#
# @param klass [Object] The class or module that holds the method to be alias'd.
# @param method [Symbol] The name of the method to be aliased.
#
@@ -176,10 +178,10 @@
#
# @return [Integer] a random 64bit integer
#
def generate_id
# Max value is 9223372036854775807 (signed long in Java)
- rand(-2**63..2**63-1)
+ rand(ID_RANGE)
end
# Convert an ID to a value appropriate to pass in a header.
#
# @param id [Integer] the id to be converted