newrelic_rpm 2.13.4.eum3 → 2.13.4.rum4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

@@ -382,17 +382,38 @@ module NewRelic
382
382
  # PRE-RELEASE
383
383
  # Returns a Javascript string which should be injected into the very top of the response body
384
384
  # == options
385
- # * <tt>:protocol => 'http' or 'https'
385
+ # * <tt>:protocol => if nil then autodetect the protocol for loading the javascript file from newrelic. If set, use specified protocol.
386
+ # Legal values "http" and "https"
386
387
  #
387
- def browser_instrumentation_header(options={})
388
- agent.browser_instrumentation_header(options)
388
+ def browser_timing_header(protocol=nil)
389
+ agent.browser_timing_header(protocol)
390
+ end
391
+
392
+
393
+ # PRE-RELEASE
394
+ # Returns a Javascript string which should be injected into the very top of the response body. Use this
395
+ # if you bundle our eum.js file manually
396
+ #
397
+ def browser_timing_short_header
398
+ agent.browser_timing_short_header
389
399
  end
390
400
 
391
401
  # PRE-RELEASE
392
402
  # Returns a Javascript string which should be injected into the very bottom of the response body
393
403
  #
404
+ def browser_timing_footer
405
+ agent.browser_timing_footer
406
+ end
407
+
408
+ # FOR BACKWARD COMPATIBILITY (REMOVE BEFORE GA)
409
+ def browser_instrumentation_header(options={})
410
+ agent.browser_timing_header
411
+ end
412
+
413
+ # FOR BACKWARD COMPATIBILITY (REMOVE BEFORE GA)
394
414
  def browser_instrumentation_footer(options={})
395
- agent.browser_instrumentation_footer(options={})
415
+ agent.browser_timing_footer
396
416
  end
417
+
397
418
  end
398
419
  end
@@ -1,27 +1,32 @@
1
+ require 'base64'
2
+
1
3
  module NewRelic
2
4
  module Agent
3
5
  module BrowserMonitoring
4
- def browser_instrumentation_header(options={})
6
+
7
+ def browser_timing_short_header
8
+ return "" if NewRelic::Agent.instance.browser_monitoring_key.nil?
9
+
10
+ "<script>var NREUMQ=[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()])</script>"
11
+ end
12
+
13
+ def browser_timing_header(protocol=nil)
5
14
 
6
15
  return "" if NewRelic::Agent.instance.browser_monitoring_key.nil?
7
16
 
8
17
  episodes_file = "//" + NewRelic::Agent.instance.episodes_file
9
18
 
10
- <<-eos
11
- <script>
12
- var EPISODES=EPISODES||{};
13
- EPISODES.q=[];
14
- EPISODES.q.push(["mark","firstbyte",new Date().getTime()]);
15
- (function() {
16
- var e=document.createElement("script");e.type="text/javascript";e.async=true;
17
- e.src=document.location.protocol+"#{episodes_file}";
18
- var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s);
19
- })();
20
- </script>
21
- eos
19
+ if protocol
20
+ protocol = "\"#{protocol}:"
21
+ else
22
+ protocol = "((\"http:\"===d.location.protocol)?\"http:\":\"https:\")+\""
23
+ end
24
+
25
+ load_js = "(function(){var d=document;var e=d.createElement(\"script\");e.type=\"text/javascript\";e.async=true;e.src=#{protocol}#{episodes_file}\";var s=d.getElementsByTagName(\"script\")[0];s.parentNode.insertBefore(e,s);})()"
26
+ "<script>var NREUMQ=[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);#{load_js}</script>"
22
27
  end
23
28
 
24
- def browser_instrumentation_footer(options={})
29
+ def browser_timing_footer
25
30
 
26
31
  license_key = NewRelic::Agent.instance.browser_monitoring_key
27
32
 
@@ -30,6 +35,7 @@ eos
30
35
  application_id = NewRelic::Agent.instance.application_id
31
36
  beacon = NewRelic::Agent.instance.beacon
32
37
  transaction_name = Thread::current[:newrelic_scope_name] || "<unknown>"
38
+ obf = obfuscate(transaction_name)
33
39
 
34
40
  frame = Thread.current[:newrelic_metric_frame]
35
41
 
@@ -39,10 +45,24 @@ eos
39
45
  app_time = ((Time.now - frame.start).to_f * 1000.0).round
40
46
 
41
47
  <<-eos
42
- <script type="text/javascript" charset="utf-8">EPISODES.q.push(["nrfinish","#{beacon}","#{license_key}","#{application_id}","#{transaction_name}","#{queue_time}","#{app_time}"])</script>
48
+ <script type="text/javascript" charset="utf-8">NREUMQ.push(["nrf2","#{beacon}","#{license_key}",#{application_id},"#{obf}",#{queue_time},#{app_time}])</script>
43
49
  eos
44
50
  end
45
51
  end
52
+
53
+ private
54
+
55
+ def obfuscate(text)
56
+ obfuscated = ""
57
+
58
+ key = NewRelic::Control.instance.license_key
59
+
60
+ text.bytes.each_with_index do |byte, i|
61
+ obfuscated.concat((byte ^ key[i % 13]))
62
+ end
63
+
64
+ [obfuscated].pack("m0").chomp
65
+ end
46
66
  end
47
67
  end
48
68
  end
@@ -20,8 +20,9 @@ module NewRelic
20
20
  def shutdown; end
21
21
  def push_trace_execution_flag(*args); end
22
22
  def pop_trace_execution_flag(*args); end
23
- def browser_instrumentation_header(options={}); end
24
- def browser_instrumentation_footer(options={}); end
23
+ def browser_timing_header(protocol=nil); end
24
+ def browser_timing_short_header; end
25
+ def browser_timing_footer; end
25
26
  end
26
27
  end
27
28
  end
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 2
5
5
  MINOR = 13
6
6
  TINY = 4
7
- BUILD = 'eum3' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 'rum4' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
10
10
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "2.13.4.eum3"
8
+ s.version = "2.13.4.rum4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser", "Justin George"]
12
- s.date = %q{2011-02-16}
12
+ s.date = %q{2011-03-16}
13
13
  s.description = %q{New Relic RPM is a Ruby performance management system, developed by
14
14
  New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
15
15
  information about the performance of your Ruby on Rails or Merb
@@ -260,7 +260,7 @@ for instructions for previous versions
260
260
  }
261
261
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Performance Monitoring Agent"]
262
262
  s.require_paths = ["lib"]
263
- s.rubygems_version = %q{1.3.7}
263
+ s.rubygems_version = %q{1.5.2}
264
264
  s.summary = %q{New Relic Ruby Performance Monitoring Agent}
265
265
 
266
266
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1847304018
5
- prerelease: true
4
+ hash: 1958316443
5
+ prerelease: 7
6
6
  segments:
7
7
  - 2
8
8
  - 13
9
9
  - 4
10
- - eum3
11
- version: 2.13.4.eum3
10
+ - rum
11
+ - 4
12
+ version: 2.13.4.rum4
12
13
  platform: ruby
13
14
  authors:
14
15
  - Bill Kayser
@@ -17,7 +18,7 @@ autorequire:
17
18
  bindir: bin
18
19
  cert_chain: []
19
20
 
20
- date: 2011-02-16 00:00:00 -08:00
21
+ date: 2011-03-16 00:00:00 -07:00
21
22
  default_executable:
22
23
  dependencies:
23
24
  - !ruby/object:Gem::Dependency
@@ -345,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
346
  requirements: []
346
347
 
347
348
  rubyforge_project:
348
- rubygems_version: 1.3.7
349
+ rubygems_version: 1.5.2
349
350
  signing_key:
350
351
  specification_version: 3
351
352
  summary: New Relic Ruby Performance Monitoring Agent