Sha256: 45421b8858cf07f120b6b031e4731e3bea842fe1405e91c3e7ec2242e26d10e0

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 KB

Contents

module Instana
  module Helpers
    EUM_SNIPPET= (File.read(File.dirname(__FILE__) + '/eum/eum.js.erb')).freeze
    EUM_TEST_SNIPPET= (File.read(File.dirname(__FILE__) + '/eum/eum-test.js.erb')).freeze

    class << self

      # Returns a processed javascript snippet to be placed within the HEAD tag of an HTML page.
      #
      def eum_snippet(api_key, kvs = {})
        return nil if !::Instana.tracer.tracing?

        ::Instana.config[:eum_api_key] = api_key
        ::Instana.config[:eum_baggage] = kvs

        ERB.new(EUM_SNIPPET).result
      rescue => e
        Instana.logger.info "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
        Instana.logger.debug { e.backtrace.join("\r\n") }
        return nil
      end

      # Returns a processed javascript snippet to be placed within the HEAD tag of an HTML page.
      # This one is used for testing only
      #
      def eum_test_snippet(api_key, kvs = {})
        return nil if !::Instana.tracer.tracing?

        ::Instana.config[:eum_api_key] = api_key
        ::Instana.config[:eum_baggage] = kvs

        ERB.new(EUM_TEST_SNIPPET).result
      rescue => e
        Instana.logger.info "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}"
        Instana.logger.debug { e.backtrace.join("\r\n") }
        return nil
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
instana-1.10.6-java lib/instana/helpers.rb
instana-1.10.6 lib/instana/helpers.rb
instana-1.10.6.fastrabbit lib/instana/helpers.rb
instana-1.10.5-java lib/instana/helpers.rb
instana-1.10.5 lib/instana/helpers.rb
instana-1.10.4-java lib/instana/helpers.rb
instana-1.10.4 lib/instana/helpers.rb
instana-1.10.3-java lib/instana/helpers.rb
instana-1.10.3 lib/instana/helpers.rb
instana-1.10.2-java lib/instana/helpers.rb
instana-1.10.2 lib/instana/helpers.rb
instana-1.10.1-java lib/instana/helpers.rb
instana-1.10.1 lib/instana/helpers.rb
instana-1.10.0 lib/instana/helpers.rb
instana-1.10.0.slimfast lib/instana/helpers.rb