module StackifyRubyAPM::Util

@api private

rubocop:disable all

Public Class Methods

host_os() click to toggle source
# File lib/stackify_apm/util.rb, line 11
def self.host_os
  host_os = RbConfig::CONFIG['host_os']
  case host_os
  when /cygwin|mswin|mingw|bccwin|wince|emx/i
    'WINDOWS'
  when /linux|arch/i
    'LINUX'
  when /sunos|solaris/i
    'SOLARIS'
  when /bsd/i
    'BSD'
  when /darwin/i
    'MAC OS X'
  else
    "UNKNOWN #{host_os}"
  end
end
micros(target = Time.now.utc) click to toggle source
# File lib/stackify_apm/util.rb, line 7
def self.micros(target = Time.now.utc)
  target.to_i * 1_000_000 + target.usec
end
pushToAryIndex(ary, idx, val) click to toggle source

Push the element to existing array of object with incremented index(key/value pair) We get the prepared statement values ['J.K. Rowling', 'Harry Potter', …] and restructure it. Example structured: [{'1': 'J.K. Rowling'},{'2': 'Harry Potter'}, …, {n: 'other data'}]

# File lib/stackify_apm/util.rb, line 32
def self.pushToAryIndex(ary, idx, val)
  obj = {}
  i = idx + 1
  obj[i] = val.to_s
  ary.push(obj)
end