Module: Instana::Helpers

Defined in:
lib/instana/helpers.rb

Constant Summary collapse

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 Method Summary collapse

Class Method Details

.eum_snippet(api_key, kvs = {}) ⇒ Object

Returns a processed javascript snippet to be placed within the HEAD tag of an HTML page.

DEPRECATED: This method will be removed in a future version.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/instana/helpers.rb', line 12

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

.eum_test_snippet(api_key, kvs = {}) ⇒ Object

Returns a processed javascript snippet to be placed within the HEAD tag of an HTML page. This one is used for testing only

DEPRECATED: This method will be removed in a future version.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/instana/helpers.rb', line 30

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