Sha256: 1832625ea331f506cc9489f80ddddbdd24f87438328845d08b8960db087d1370

Contents?: true

Size: 1.69 KB

Versions: 30

Compression:

Stored size: 1.69 KB

Contents

# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.

require 'digest/sha1'

module AppOpticsAPM
  module Util
    ##
    # This module was used solely for the deprecated RUM ID calculation
    # but may be useful in the future.
    #
    module Base64URL
      module_function

      def encode(bin)
        c = [bin].pack('m0').gsub(/\=+\Z/, '').tr('+/', '-_').rstrip
        m = c.size % 4
        c += '=' * (4 - m) if m != 0
        c
      end

      def decode(bin)
        m = bin.size % 4
        bin += '=' * (4 - m) if m != 0
        bin.tr('-_', '+/').unpack('m0').first
      end
    end
  end

  ##
  # This module houses all of the loading functionality for the appoptics_apm em.

  # Note that this does not necessarily _have_ to include initialization routines
  # (although it can).
  #
  # Actual initialization is often separated out as it can be dependent on on the state
  # of the stack boot process.  e.g. code requiring that initializers, frameworks or
  # instrumented libraries are already loaded...
  #
  module Loading
    ##
    # Load the appoptics_apm tracing API
    #
    def self.require_api
      pattern = File.join(File.dirname(__FILE__), 'api', '*.rb')
      Dir.glob(pattern) do |f|
        require f
      end

      begin
        require 'appoptics_apm/api'
      rescue LoadError => e
        AppOpticsAPM.logger.fatal "[appoptics_apm/error] Couldn't load api: #{e.message}"
      end
    end
  end
end

AppOpticsAPM::Loading.require_api

# Auto-start the Reporter unless we are running Unicorn on Heroku
# In that case, we start the reporters after fork
unless AppOpticsAPM.heroku? && AppOpticsAPM.forking_webserver?
  AppOpticsAPM::Reporter.start if AppOpticsAPM.loaded
end

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
appoptics_apm-zearn-4.13.1 lib/appoptics_apm/loading.rb
appoptics_apm-4.13.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.12.2 lib/appoptics_apm/loading.rb
appoptics_apm-4.12.1 lib/appoptics_apm/loading.rb
appoptics_apm-4.12.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.11.2 lib/appoptics_apm/loading.rb
appoptics_apm-4.11.1 lib/appoptics_apm/loading.rb
appoptics_apm-4.11.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.10.1 lib/appoptics_apm/loading.rb
appoptics_apm-4.10.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.9.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.8.4 lib/appoptics_apm/loading.rb
appoptics_apm-4.8.3 lib/appoptics_apm/loading.rb
appoptics_apm-4.8.2 lib/appoptics_apm/loading.rb
appoptics_apm-4.8.1 lib/appoptics_apm/loading.rb
appoptics_apm-4.8.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.7.0 lib/appoptics_apm/loading.rb
appoptics_apm-4.6.0 lib/appoptics_apm/loading.rb
appoptics_apm_mnfst-4.5.2 lib/appoptics_apm/loading.rb
appoptics_apm-4.5.2 lib/appoptics_apm/loading.rb