Module: NewRelic::Agent::BrowserMonitoring
- Included in:
- Agent
- Defined in:
- lib/new_relic/agent/browser_monitoring.rb
Overview
This module contains support for Real User Monitoring - the javascript generation and configuration
Defined Under Namespace
Classes: DummyTransaction
Constant Summary collapse
- @@dummy_txn =
DummyTransaction.new
Class Method Summary collapse
- .browser_monitoring_transaction_name ⇒ Object
- .current_timings ⇒ Object
- .current_transaction ⇒ Object
- .obfuscate(config, text) ⇒ Object
Instance Method Summary collapse
-
#browser_timing_footer ⇒ Object
This method returns a string suitable for inclusion in a page - known as ‘manual instrumentation’ for Real User Monitoring.
-
#browser_timing_header ⇒ Object
This method returns a string suitable for inclusion in a page - known as ‘manual instrumentation’ for Real User Monitoring.
Class Method Details
.browser_monitoring_transaction_name ⇒ Object
88 89 90 |
# File 'lib/new_relic/agent/browser_monitoring.rb', line 88 def browser_monitoring_transaction_name current_timings.transaction_name || ::NewRelic::Agent::UNKNOWN_METRIC end |
.current_timings ⇒ Object
96 97 98 |
# File 'lib/new_relic/agent/browser_monitoring.rb', line 96 def current_timings NewRelic::Agent::TransactionState.get.timings end |
.current_transaction ⇒ Object
92 93 94 |
# File 'lib/new_relic/agent/browser_monitoring.rb', line 92 def current_transaction NewRelic::Agent::TransactionState.get.transaction || @@dummy_txn end |
.obfuscate(config, text) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/new_relic/agent/browser_monitoring.rb', line 73 def obfuscate(config, text) = "" if defined?(::Encoding::ASCII_8BIT) .force_encoding(::Encoding::ASCII_8BIT) end key_bytes = config.license_bytes index = 0 text.each_byte{|byte| .concat((byte ^ key_bytes[index % 13].to_i)) index+=1 } [].pack("m0").gsub("\n", '') end |
Instance Method Details
#browser_timing_footer ⇒ Object
This method returns a string suitable for inclusion in a page
-
known as ‘manual instrumentation’ for Real User
Monitoring. Can return either a script tag with associated javascript, or in the case of disabled Real User Monitoring, an empty string
This is the footer string - it should be placed as low in the page as is reasonably possible.
62 63 64 65 66 67 68 69 |
# File 'lib/new_relic/agent/browser_monitoring.rb', line 62 def if insert_js? NewRelic::Agent::Transaction.freeze_name (NewRelic::Agent.instance.beacon_configuration) else "" end end |
#browser_timing_header ⇒ Object
This method returns a string suitable for inclusion in a page
-
known as ‘manual instrumentation’ for Real User
Monitoring. Can return either a script tag with associated javascript, or in the case of disabled Real User Monitoring, an empty string
This is the header string - it should be placed as high in the page as is reasonably possible - that is, before any style or javascript inclusions, but after any header-related meta tags
50 51 52 |
# File 'lib/new_relic/agent/browser_monitoring.rb', line 50 def browser_timing_header insert_js? ? header_js_string : "" end |