lib/one_apm/support/helper.rb in oneapm_rpm-1.3.7 vs lib/one_apm/support/helper.rb in oneapm_rpm-1.4.0
- old
+ new
@@ -43,7 +43,23 @@
end
def milliseconds_to_seconds(milliseconds)
milliseconds / 1000.0
end
+
+ HEX_DIGITS = (0..15).map{|i| i.to_s(16)}
+ GUID_LENGTH = 16
+
+ # generate a random 16 length uuid
+ def generate_guid
+ guid = ''
+ GUID_LENGTH.times do |a|
+ guid << HEX_DIGITS[rand(16)]
+ end
+ guid
+ end
+
+ def obfuscator
+ @obfuscator ||= OneApm::Agent::Obfuscator.new(OneApm::Manager.config[:encoding_key])
+ end
end
end