newrelic_rpm 3.5.1.alpha → 3.5.1.beta1

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.

data/CHANGELOG CHANGED
@@ -2,34 +2,69 @@
2
2
  # New Relic Ruby Agent Release Notes #
3
3
 
4
4
  ### Next Up ###
5
+ ## v3.5.2 ##
6
+
7
+ ### current version ###
5
8
  ## v3.5.1 ##
6
9
 
7
- * Enabling Memory Profiling on Lion and Moutain Lion
10
+ * Enabling Memory Profiling on Lion and Mountain Lion
8
11
 
9
12
  The agent's list of supported platforms for memory profiling wasn't correctly checking
10
13
  for more recent versions of OS X.
11
14
 
15
+ * Fixed an arity issue encountered when calling newrelic_notice_error from Rails applications.
16
+
17
+ * End user queue time was not being properly reported, works properly now.
18
+
19
+ * Better handling of a thread safety issue.
20
+
21
+ Some issues may remain, which we are working to address, but they should be gracefully handled
22
+ now, rather than crashing the running app.
23
+
24
+ * Use "java_import" rather than "include_class" when require Java Jars into a JRuby app.
25
+
26
+ Thanks to Jan Habermann for the pull request
27
+
28
+ * Replaced alias_method mechanism with super call in DataMapper instrumentation.
29
+
30
+ Thanks to Michael Rykov for the pull request
31
+
32
+ * Fixed the Rubinius GC profiler.
33
+
34
+ Thanks to Dirkjan Bussink
35
+
36
+ * Use ActiveSupport.on_load to load controller instrumentation Rails 3.
37
+
38
+ Thanks to Jonathan del Strother
39
+
40
+ * Reduce the number of thread local reference in a particular high traffic method
41
+
42
+ Thanks to Jeremy Kemper
43
+
44
+ ## v3.5.0.1 ##
45
+
46
+ * (Fix) Due to a serious resource leak we have ended support for versions of Phusion Passenger
47
+ older than 2.1.1. Users of older versions are encouraged upgrade to a more recent version.
12
48
 
13
- ### current version ###
14
49
  ## v3.5.0 ##
15
50
 
16
51
  * (Fix) RUM Stops Working After 3.4.2.1 Agent Upgrade
17
52
 
18
- v3.4.2.1 introduced a bug that caused the browser monitor auto instrument
53
+ v3.4.2.1 introduced a bug that caused the browser monitor auto instrumentation
19
54
  (for RUM) default to be false. The correct value of true is now used
20
55
 
21
- * When the Ruby Agent detects Unicorn is the dispatcher create an INFO level log message
56
+ * When the Ruby Agent detects Unicorn as the dispatcher it creates an INFO level log message
57
+ with additional information
22
58
 
23
59
  To help customers using Unicorn, if the agent detects it (Unicorn) is being used as the
24
60
  dispatcher an INFO level log message it created that includes a link to New Relic
25
61
  online doc that has additional steps that may be required to get performance data reporting.
26
62
 
27
- * (Fix) In version 3.4.2 of the Ruby Agent the server side config value for Apdex T was
28
- disgregarded
63
+ * (Fix) In version 3.4.2 of the Ruby Agent the server side value for Apdex T was disgregarded
29
64
 
30
- When server side config was being used with version 3.4.2 of the agent it ignored the Apdex T
31
- value that was in the New Relic UI. The server side value for Apdex T now always takes
32
- precedence.
65
+ With version 3.4.2 of the agent, the value set in the newrelic.yml file took precedence over the
66
+ value set in the New Relic UI. As of version 3.5.0 only the value for Apdex T set in the
67
+ New Relic UI will be used. Any setting in the yaml file will be ignored.
33
68
 
34
69
  * Improved Error Detection/Reporting capabilities for Rails 3 apps
35
70
 
@@ -40,18 +75,26 @@
40
75
 
41
76
  * The Ruby Agent now logs certain information it receives from the New Relic servers
42
77
 
43
- When the agent connects to the New Relic servers it receives various bits of information
44
- back. Different amounts of this information will appear in the agent log, depending on
45
- the current log level setting.
78
+ After connecting to the New Relic servers the agent logs the New Relic URL
79
+ of the app it is reporting to.
46
80
 
47
81
  * GC profiling overhead for Ruby 1.9 reduced
48
82
 
49
- For Ruby 1.9 the amount of time spent in GC profiling has been reduce.
83
+ For Ruby 1.9 the amount of time spent in GC profiling has been reduced.
84
+
85
+ * Know issue with Ruby 1.8.7-p334, sqlite3-ruby 1.3.0 or older, and resque 1.23.0
86
+
87
+ The Ruby Agent will not work in conjunction with Ruby 1.8.7-p334, sqlite3-ruby 1.3.3
88
+ or earlier, and resque 1.23.0. Your app will likely stop functioning. This is a known problem
89
+ with Ruby versions up to 1.8.7-p334. Upgrading to the last release of Ruby 1.8.7
90
+ is recommended. This issue has been present in every version of the agent we've tested
91
+ going back for a year.
92
+
50
93
 
51
94
  ### previous versions ###
52
95
  ## v3.4.2.1 ##
53
96
 
54
- * Fix issue when app_name is nil
97
+ * Fix issue when app_name is nil
55
98
 
56
99
  If the app_name setting ends up being nil an exception got generated and the application
57
100
  wouldn't run. This would notably occur when running a Heroku app locally without the
@@ -75,7 +118,6 @@
75
118
  The code that reads the configuration information and confirgures the agent
76
119
  got substantially reorganized, consolidated, simplified, and made more robust.
77
120
 
78
-
79
121
  ## v3.4.1 ##
80
122
  #### Bug Fixes ####
81
123
  * Fix edge case in RUM auto instrumentation where X-UA-Compatible meta tag is
@@ -85,17 +85,8 @@ module NewRelic
85
85
  # handles things like static setup of the header for inclusion
86
86
  # into pages
87
87
  attr_reader :beacon_configuration
88
- attr_reader :cross_process_id
89
88
  attr_accessor :service
90
89
 
91
- def cross_process_encoding_bytes
92
- if @cross_process_encoding_key && @cross_process_encoding_bytes.nil?
93
- @cross_process_encoding_bytes = []
94
- @cross_process_encoding_key.each_byte {|byte| @cross_process_encoding_bytes << byte}
95
- end
96
- @cross_process_encoding_bytes
97
- end
98
-
99
90
  # Returns the length of the unsent errors array, if it exists,
100
91
  # otherwise nil
101
92
  def unsent_errors_size
@@ -763,9 +754,6 @@ module NewRelic
763
754
  Agent.config.apply_config(server_config, 1)
764
755
  log_connection!(config_data) if @service
765
756
 
766
- @cross_process_id = Agent.config[:cross_process_id]
767
- @cross_process_encoding_key = Agent.config[:encoding_key]
768
-
769
757
  @beacon_configuration = BeaconConfiguration.new
770
758
  end
771
759
 
@@ -898,22 +886,9 @@ module NewRelic
898
886
 
899
887
  @unsent_timeslice_data ||= {}
900
888
  @unsent_timeslice_data = @stats_engine.harvest_timeslice_data(@unsent_timeslice_data, @metric_ids)
901
-
902
- warn_if_no_unicorn_metrics
903
-
904
889
  @unsent_timeslice_data
905
890
  end
906
891
 
907
- # this is just a support band-aid until we get a chance to
908
- # overhaul the Unicorn instrumentation properly
909
- def warn_if_no_unicorn_metrics
910
- if Agent.config[:dispatcher].to_s == 'unicorn'
911
- if @stats_engine.get_stats_no_scope('HttpDispatcher').call_count == 0
912
- NewRelic::Control.instance.log.warn('Unicorn detected but no metric send, please see https://newrelic.com/docs/troubleshooting/im-using-unicorn-and-i-dont-see-any-data')
913
- end
914
- end
915
- end
916
-
917
892
  # takes an array of arrays of spec and id, adds it into the
918
893
  # metric cache so we can save the collector some work by
919
894
  # sending integers instead of strings
@@ -1038,6 +1013,7 @@ module NewRelic
1038
1013
  end
1039
1014
 
1040
1015
  def transmit_data
1016
+ now = Time.now
1041
1017
  log.debug "Sending data to New Relic Service"
1042
1018
  harvest_and_send_errors
1043
1019
  harvest_and_send_slowest_sample
@@ -1053,6 +1029,8 @@ module NewRelic
1053
1029
  raise e
1054
1030
  ensure
1055
1031
  NewRelic::Agent::Database.close_connections unless forked?
1032
+ @stats_engine.get_stats_no_scope('Supportability/Harvest') \
1033
+ .record_data_point((Time.now - now).to_f)
1056
1034
  end
1057
1035
 
1058
1036
  # This method contacts the server to send remaining data and
@@ -1086,7 +1064,6 @@ module NewRelic
1086
1064
  extend ClassMethods
1087
1065
  include InstanceMethods
1088
1066
  include BrowserMonitoring
1089
- include CrossProcessMonitoring
1090
1067
  end
1091
1068
  end
1092
1069
  end
@@ -35,6 +35,7 @@ module NewRelic
35
35
  :send_environment_info => true,
36
36
  :start_channel_listener => false,
37
37
  :data_report_period => 60,
38
+ :keep_retrying => true,
38
39
 
39
40
  :log_file_name => 'newrelic_agent.log',
40
41
  :log_file_path => 'log/',
@@ -25,15 +25,22 @@ module NewRelic
25
25
  @ignore = {}
26
26
  @capture_source = Agent.config[:'error_collector.capture_source']
27
27
 
28
- ignore_errors = Agent.config[:'error_collector.ignore_errors']
29
- ignore_errors = ignore_errors.split(",") if ignore_errors.is_a? String
30
- ignore_errors.each { |error| error.strip! }
31
- ignore(ignore_errors)
28
+ initialize_ignored_errors(Agent.config[:'error_collector.ignore_errors'])
32
29
  @lock = Mutex.new
33
30
 
34
31
  Agent.config.register_callback(:'error_collector.enabled') do |config_enabled|
35
32
  log.debug "Errors will #{config_enabled ? '' : 'not '}be sent to the New Relic service."
36
33
  end
34
+ Agent.config.register_callback(:'error_collector.ignore_errors') do |ignore_errors|
35
+ initialize_ignored_errors(ignore_errors)
36
+ end
37
+ end
38
+
39
+ def initialize_ignored_errors(ignore_errors)
40
+ @ignore.clear
41
+ ignore_errors = ignore_errors.split(",") if ignore_errors.is_a? String
42
+ ignore_errors.each { |error| error.strip! }
43
+ ignore(ignore_errors)
37
44
  end
38
45
 
39
46
  def enabled?
@@ -269,11 +269,9 @@ module NewRelic
269
269
  else
270
270
  perform_action_without_newrelic_trace(*args)
271
271
  end
272
- if defined?(request) && request && defined?(response) && response
273
- if !Agent.config[:disable_mobile_headers]
274
- NewRelic::Agent::BrowserMonitoring.insert_mobile_response_header(request, response)
275
- end
276
- NewRelic::Agent::CrossProcessMonitoring.insert_cross_process_response_header(request, response)
272
+ if defined?(request) && request && defined?(response) &&
273
+ response && !Agent.config[:disable_mobile_headers]
274
+ NewRelic::Agent::BrowserMonitoring.insert_mobile_response_header(request, response)
277
275
  end
278
276
  result
279
277
  rescue => e
@@ -27,21 +27,11 @@ module NewRelic
27
27
  attr_accessor :request
28
28
 
29
29
 
30
- @@check_server_connection = false
31
- def self.check_server_connection=(value)
32
- @@check_server_connection = value
33
- end
34
30
  # Return the currently active metric frame, or nil. Call with +true+
35
31
  # to create a new metric frame if one is not already on the thread.
36
32
  def self.current(create_if_empty=nil)
37
33
  f = Thread.current[:newrelic_metric_frame]
38
34
  return f if f || !create_if_empty
39
-
40
- # Reconnect to the server if necessary. This is only done
41
- # for old versions of passenger that don't implement an explicit after_fork
42
- # event.
43
- agent.after_fork(:keep_retrying => false) if @@check_server_connection
44
-
45
35
  Thread.current[:newrelic_metric_frame] = new
46
36
  end
47
37
 
@@ -263,7 +253,7 @@ module NewRelic
263
253
  end
264
254
 
265
255
  def queue_time
266
- apdex_start - start
256
+ start - apdex_start
267
257
  end
268
258
 
269
259
  def add_custom_parameters(p)
@@ -1,6 +1,6 @@
1
1
  DependencyDetection.defer do
2
2
  @name = :passenger
3
-
3
+
4
4
  depends_on do
5
5
  defined?(::PhusionPassenger)
6
6
  end
@@ -21,17 +21,3 @@ DependencyDetection.defer do
21
21
  end
22
22
  end
23
23
  end
24
-
25
- DependencyDetection.defer do
26
- depends_on do
27
- defined?(::Passenger) && defined?(::Passenger::AbstractServer)
28
- end
29
-
30
- executes do
31
- ## We're on an older version of passenger
32
- ## FIXME: This warning is printing on current version of passenger
33
- # NewRelic::Agent.logger.warn "An older version of Phusion Passenger has been detected. We recommend using at least release 2.1.1."
34
-
35
- NewRelic::Agent::Instrumentation::MetricFrame.check_server_connection = true
36
- end
37
- end
@@ -6,7 +6,11 @@ module NewRelic
6
6
  def newrelic_notice_error(exception, custom_params = {})
7
7
  filtered_params = (respond_to? :filter_parameters) ? filter_parameters(params) : params
8
8
  filtered_params.merge!(custom_params)
9
- NewRelic::Agent.agent.error_collector.notice_error(exception, request, newrelic_metric_path, filtered_params)
9
+ NewRelic::Agent::Instrumentation::MetricFrame.notice_error( \
10
+ exception, \
11
+ :request => request, \
12
+ :metric => newrelic_metric_path, \
13
+ :custom_params => filtered_params)
10
14
  end
11
15
  end
12
16
  end
@@ -77,10 +77,15 @@ module NewRelic
77
77
  return if @started == true
78
78
  @started = true
79
79
  @thread = Thread.new do
80
+ now = nil
80
81
  loop do
81
82
  clean_up_pipes
82
83
  pipes_to_listen_to = @pipes.values.map{|pipe| pipe.out} + [wake.out]
84
+ NewRelic::Agent.instance.stats_engine \
85
+ .get_stats_no_scope('Supportability/Listeners') \
86
+ .record_data_point((Time.now - now).to_f) if now
83
87
  if ready = IO.select(pipes_to_listen_to, [], [], @select_timeout)
88
+ now = Time.now
84
89
  pipe = ready[0][0]
85
90
  if pipe == wake.out
86
91
  pipe.read(1)
@@ -92,7 +97,7 @@ module NewRelic
92
97
  break if !should_keep_listening?
93
98
  end
94
99
  end
95
- @thread #.abort_on_exception = true
100
+ @thread['newrelic_label'] = 'Pipe Channel Manager'
96
101
  sleep 0.001 # give time for the thread to spawn
97
102
  end
98
103
 
@@ -35,7 +35,7 @@ module NewRelic
35
35
  end
36
36
 
37
37
  def self.supported_on_this_platform?
38
- defined?(JRuby) or platform =~ /linux|darwin|freebsd|solaris/
38
+ defined?(JRuby) or platform =~ /linux|darwin9|darwin10|freebsd|solaris/
39
39
  end
40
40
 
41
41
  def self.platform
@@ -8,34 +8,69 @@ module NewRelic
8
8
  # A simple mutex-synchronized hash to make sure our statistics
9
9
  # are internally consistent even in truly-threaded rubies like JRuby
10
10
  class SynchronizedHash < ::Hash
11
- include NewRelic::LanguageSupport::SynchronizedHash
12
-
11
+ attr_reader :lock
12
+
13
13
  def initialize
14
14
  @lock = Mutex.new
15
15
  end
16
-
16
+
17
+ def initialize_copy(old)
18
+ super
19
+ old.each do |key, value|
20
+ self.store(key, value.dup)
21
+ end
22
+ end
23
+
17
24
  def []=(*args)
18
25
  @lock.synchronize { super }
26
+ rescue => e
27
+ log_error(e)
19
28
  end
20
29
 
21
30
  def clear(*args)
22
31
  @lock.synchronize { super }
32
+ rescue => e
33
+ log_error(e)
23
34
  end
24
35
 
25
36
  def delete(*args)
26
37
  @lock.synchronize { super }
38
+ rescue => e
39
+ log_error(e)
27
40
  end
28
41
 
29
42
  def delete_if(*args)
30
43
  @lock.synchronize { super }
44
+ rescue => e
45
+ log_error(e)
46
+ end
47
+
48
+ def reset
49
+ values.each { |s| s.reset }
50
+ end
51
+
52
+ def log_error(e)
53
+ backtraces = Thread.list.map { |t| log_thread(t) }.join("\n\n")
54
+ NewRelic::Control.instance.log.warn(
55
+ "SynchronizedHash failure: #{e.class.name}: #{e.message}\n#{backtraces}")
56
+ end
57
+
58
+ def log_thread(t)
59
+ # Ruby 1.8 doesn't expose backtrace properly, so make sure it's there
60
+ if t.nil? || !t.respond_to?(:backtrace) || t.backtrace.nil?
61
+ return "#{t}\n\tNo backtrace for thread"
62
+ end
63
+
64
+ backtrace = t.backtrace.map { |b| "\t#{b}" }.join("\n")
65
+ "\t#{t}\n#{backtrace}"
31
66
  end
32
67
  end
33
-
68
+
34
69
  # Returns all of the metric names of all the stats in the engine
35
70
  def metrics
36
71
  stats_hash.keys.map(&:to_s)
37
72
  end
38
-
73
+
39
74
  # a simple accessor for looking up a stat with no scope -
40
75
  # returns a new stats object if no stats object for that
41
76
  # metric exists yet
@@ -64,17 +99,16 @@ module NewRelic
64
99
  end
65
100
  stats
66
101
  end
67
-
102
+
68
103
  # Returns a stat if one exists, otherwise returns nil. If you
69
104
  # want auto-initialization, use one of get_stats or get_stats_no_scope
70
105
  def lookup_stats(metric_name, scope_name = '')
71
106
  stats_hash[NewRelic::MetricSpec.new(metric_name, scope_name)]
72
107
  end
73
-
108
+
74
109
  # This module was extracted from the harvest method and should
75
110
  # be refactored
76
111
  module Harvest
77
-
78
112
  # merge data from previous harvests into this stats engine -
79
113
  # takes into account the case where there are new stats for
80
114
  # that metric, and the case where there is no current data
@@ -135,10 +169,12 @@ module NewRelic
135
169
 
136
170
  def merge_stats(other_engine_or_hash, metric_ids)
137
171
  old_data = get_stats_hash_from(other_engine_or_hash)
138
-
139
172
  timeslice_data = {}
140
- stats_hash.each do | metric_spec, stats |
141
-
173
+ stats_hash.lock.synchronize do
174
+ Thread.current['newrelic_stats_hash'] = stats_hash.clone
175
+ stats_hash.reset
176
+ end
177
+ Thread.current['newrelic_stats_hash'].each do |metric_spec, stats|
142
178
  metric_spec = coerce_to_metric_spec(metric_spec)
143
179
  stats_copy = clone_and_reset_stats(metric_spec, stats)
144
180
  merge_old_data!(metric_spec, stats_copy, old_data)
@@ -160,7 +196,6 @@ module NewRelic
160
196
  # sacrificing efficiency.
161
197
  # +++
162
198
  def harvest_timeslice_data(previous_timeslice_data, metric_ids)
163
-
164
199
  poll harvest_samplers
165
200
  merge_stats(previous_timeslice_data, metric_ids)
166
201
  end
@@ -173,9 +208,9 @@ module NewRelic
173
208
 
174
209
  # Reset each of the stats, such as when a new passenger instance starts up.
175
210
  def reset_stats
176
- stats_hash.values.each { |s| s.reset }
211
+ stats_hash.reset
177
212
  end
178
-
213
+
179
214
  # returns a memoized SynchronizedHash that holds the actual
180
215
  # instances of Stats keyed off their MetricName
181
216
  def stats_hash
@@ -28,10 +28,15 @@ module Agent
28
28
  return if periodic_samplers.empty?
29
29
 
30
30
  @sampler_thread = Thread.new do
31
- while true do
31
+ loop do
32
+ now = Time.now
32
33
  begin
33
34
  sleep POLL_PERIOD
34
35
  poll periodic_samplers
36
+ ensure
37
+ NewRelic::Agent.instance.stats_engine \
38
+ .get_stats_no_scope('Supportability/Samplers') \
39
+ .record_data_point((Time.now - now).to_f)
35
40
  end
36
41
  end
37
42
  end
@@ -77,7 +77,6 @@ module NewRelic
77
77
  require 'new_relic/agent'
78
78
  require 'new_relic/agent/chained_call'
79
79
  require 'new_relic/agent/browser_monitoring'
80
- require 'new_relic/agent/cross_process_monitoring'
81
80
  require 'new_relic/agent/agent'
82
81
  require 'new_relic/agent/shim_agent'
83
82
  require 'new_relic/agent/method_tracer'
@@ -158,13 +158,12 @@ module NewRelic
158
158
  def install_shim
159
159
  super
160
160
  require 'new_relic/agent/instrumentation/controller_instrumentation'
161
- if ActiveSupport.respond_to?(:on_load) # rails 3+
162
- ActiveSupport.on_load(:action_controller) { include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim }
163
- else
164
- ActionController::Base.class_eval { include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim }
161
+ if !ActiveSupport.respond_to?(:on_load) # rails 3+
162
+ ActionController::Base.class_eval do
163
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim
164
+ end
165
165
  end
166
166
  end
167
-
168
167
  end
169
168
  end
170
169
  end
@@ -79,6 +79,13 @@ module NewRelic
79
79
  end
80
80
  local_env.append_plugin_list { ::Rails.configuration.plugins.to_a }
81
81
  end
82
+
83
+ def install_shim
84
+ super
85
+ ActiveSupport.on_load(:action_controller) do
86
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim
87
+ end
88
+ end
82
89
  end
83
90
  end
84
91
  end
@@ -1,6 +1,6 @@
1
1
  module NewRelic::LanguageSupport
2
2
  extend self
3
-
3
+
4
4
  module Control
5
5
  def self.included(base)
6
6
  # need to use syck rather than psych when possible
@@ -21,23 +21,8 @@ module NewRelic::LanguageSupport
21
21
  end
22
22
  end
23
23
  end
24
-
25
- module SynchronizedHash
26
- def self.included(base)
27
- # need to lock iteration of stats hash in 1.9.x
28
- if NewRelic::LanguageSupport.using_version?('1.9') ||
29
- NewRelic::LanguageSupport.using_engine?('jruby')
30
- base.class_eval do
31
- def each(*args, &block)
32
- @lock.synchronize { super }
33
- end
34
- end
35
- end
36
- end
37
- end
38
-
24
+
39
25
  @@forkable = nil
40
-
41
26
  def can_fork?
42
27
  # this is expensive to check, so we should only check once
43
28
  return @@forkable if @@forkable != nil
@@ -51,7 +36,7 @@ module NewRelic::LanguageSupport
51
36
 
52
37
  @@forkable
53
38
  end
54
-
39
+
55
40
  def using_engine?(engine)
56
41
  if defined?(::RUBY_ENGINE)
57
42
  ::RUBY_ENGINE == engine
@@ -81,7 +66,7 @@ module NewRelic::LanguageSupport
81
66
  yield
82
67
  end
83
68
  end
84
-
69
+
85
70
  def with_cautious_gc
86
71
  if broken_gc?
87
72
  with_disabled_gc { yield }
@@ -14,7 +14,6 @@ module NewRelic
14
14
  #
15
15
  # NewRelic::LocalEnvironment should be accessed through NewRelic::Control#env (via the NewRelic::Control singleton).
16
16
  class LocalEnvironment
17
-
18
17
  # mongrel, thin, webrick, or possibly nil
19
18
  attr_accessor :dispatcher
20
19
  # used to distinguish instances of a dispatcher from each other, may be nil
@@ -23,7 +22,7 @@ module NewRelic
23
22
  attr_accessor :framework
24
23
  # The number of cpus, if detected, or nil - many platforms do not
25
24
  # support this :(
26
- attr_reader :processors
25
+ attr_reader :processors
27
26
  alias environment dispatcher
28
27
 
29
28
  def initialize
@@ -397,7 +396,7 @@ module NewRelic
397
396
  end
398
397
 
399
398
  def check_for_passenger
400
- if (defined?(::Passenger) && defined?(::Passenger::AbstractServer)) || defined?(::PhusionPassenger)
399
+ if defined?(::PhusionPassenger)
401
400
  @dispatcher = :passenger
402
401
  end
403
402
  end
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 3
5
5
  MINOR = 5
6
6
  TINY = 1
7
- BUILD = 'alpha' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 'beta1' # 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
 
data/newrelic_rpm.gemspec CHANGED
@@ -4,15 +4,20 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "newrelic_rpm"
8
- s.version = "3.5.1.alpha"
7
+ s.name = %q{newrelic_rpm}
8
+ s.version = "3.5.1.beta1"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
10
  s.authors = ["Bill Kayser", "Jon Guymon", "Justin George", "Darin Swanson", "Rob Saul"]
12
- s.date = "2012-10-11"
13
- s.description = "New Relic is a performance management system, developed by New Relic,\nInc (http://www.newrelic.com). New Relic provides you with deep\ninformation about the performance of your web application as it runs\nin production. The New Relic Ruby Agent is dual-purposed as a either a\nGem or plugin, hosted on\nhttp://github.com/newrelic/rpm/\n"
14
- s.email = "support@newrelic.com"
15
- s.executables = ["mongrel_rpm", "newrelic_cmd", "newrelic"]
11
+ s.date = %q{2012-10-31}
12
+ s.description = %q{New Relic is a performance management system, developed by New Relic,
13
+ Inc (http://www.newrelic.com). New Relic provides you with deep
14
+ information about the performance of your web application as it runs
15
+ in production. The New Relic Ruby Agent is dual-purposed as a either a
16
+ Gem or plugin, hosted on
17
+ http://github.com/newrelic/rpm/
18
+ }
19
+ s.email = %q{support@newrelic.com}
20
+ s.executables = ["newrelic_cmd", "newrelic", "mongrel_rpm"]
16
21
  s.extra_rdoc_files = [
17
22
  "CHANGELOG",
18
23
  "LICENSE",
@@ -29,7 +34,6 @@ Gem::Specification.new do |s|
29
34
  "cert/cacert.pem",
30
35
  "cert/oldsite.pem",
31
36
  "cert/site.pem",
32
- "config.dot",
33
37
  "install.rb",
34
38
  "lib/conditional_vendored_dependency_detection.rb",
35
39
  "lib/conditional_vendored_metric_parser.rb",
@@ -45,7 +49,6 @@ Gem::Specification.new do |s|
45
49
  "lib/new_relic/agent/configuration/manager.rb",
46
50
  "lib/new_relic/agent/configuration/server_source.rb",
47
51
  "lib/new_relic/agent/configuration/yaml_source.rb",
48
- "lib/new_relic/agent/cross_process_monitoring.rb",
49
52
  "lib/new_relic/agent/database.rb",
50
53
  "lib/new_relic/agent/error_collector.rb",
51
54
  "lib/new_relic/agent/instrumentation.rb",
@@ -309,11 +312,30 @@ Gem::Specification.new do |s|
309
312
  "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb",
310
313
  "vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb"
311
314
  ]
312
- s.homepage = "http://www.github.com/newrelic/rpm"
313
- s.post_install_message = "\nPLEASE NOTE:\n\nDeveloper Mode is now a Rack middleware.\n\nDeveloper Mode is no longer available in Rails 2.1 and earlier.\nHowever, starting in version 2.12 you can use Developer Mode in any\nRack based framework, in addition to Rails. To install developer mode\nin a non-Rails application, just add NewRelic::Rack::DeveloperMode to\nyour middleware stack.\n\nIf you are using JRuby, we recommend using at least version 1.4 or \nlater because of issues with the implementation of the timeout library.\n\nRefer to the README.md file for more information.\n\nPlease see http://github.com/newrelic/rpm/blob/master/CHANGELOG\nfor a complete description of the features and enhancements available\nin version 3.5 of the Ruby Agent.\n \n"
315
+ s.homepage = %q{http://www.github.com/newrelic/rpm}
316
+ s.post_install_message = %q{
317
+ PLEASE NOTE:
318
+
319
+ Developer Mode is now a Rack middleware.
320
+
321
+ Developer Mode is no longer available in Rails 2.1 and earlier.
322
+ However, starting in version 2.12 you can use Developer Mode in any
323
+ Rack based framework, in addition to Rails. To install developer mode
324
+ in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
325
+ your middleware stack.
326
+
327
+ If you are using JRuby, we recommend using at least version 1.4 or
328
+ later because of issues with the implementation of the timeout library.
329
+
330
+ Refer to the README.md file for more information.
331
+
332
+ Please see http://github.com/newrelic/rpm/blob/master/CHANGELOG
333
+ for a complete description of the features and enhancements available
334
+ in version 3.5 of the Ruby Agent.
335
+
336
+ }
314
337
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Agent"]
315
338
  s.require_paths = ["lib"]
316
- s.rubygems_version = "1.6.2"
317
339
  s.summary = "New Relic Ruby Agent"
318
340
 
319
341
  if s.respond_to? :specification_version then
@@ -68,7 +68,9 @@ module NewRelic
68
68
  end
69
69
 
70
70
  app = Thread.new do
71
- @agent.stats_engine.stats_hash["a"] = NewRelic::StatsBase.new
71
+ 200.times do |i|
72
+ @agent.stats_engine.stats_hash["a#{i}"] = NewRelic::StatsBase.new
73
+ end
72
74
  end
73
75
 
74
76
  assert_nothing_raised do
@@ -76,20 +78,6 @@ module NewRelic
76
78
  end
77
79
  end
78
80
 
79
- def test_harvest_timeslice_data_should_not_warn_normally
80
- NewRelic::Control.instance.log.expects(:warn).never
81
- @agent.stats_engine.get_stats_no_scope('HttpDispatcher').record_data_point(1.0)
82
- @agent.send(:harvest_timeslice_data)
83
- end
84
-
85
- def test_harvest_timeslice_data_should_warn_if_unicorn_and_no_web_metrics
86
- NewRelic::Control.instance.log.expects(:warn) \
87
- .with('Unicorn detected but no metric send, please see https://newrelic.com/docs/troubleshooting/im-using-unicorn-and-i-dont-see-any-data')
88
- with_config(:dispatcher => 'unicorn') do
89
- @agent.send(:harvest_timeslice_data)
90
- end
91
- end
92
-
93
81
  def test_harvest_errors
94
82
  assert_equal([], @agent.send(:harvest_errors), 'should return errors')
95
83
  end
@@ -143,6 +143,18 @@ class NewRelic::Agent::ErrorCollectorTest < Test::Unit::TestCase
143
143
  assert_equal 0, errors.length
144
144
  end
145
145
 
146
+ def test_exclude_later_config_changes
147
+ @error_collector.notice_error(IOError.new("message"))
148
+
149
+ NewRelic::Agent.config.apply_config(:'error_collector.ignore_errors' => "IOError")
150
+ @error_collector.notice_error(IOError.new("message"))
151
+
152
+ errors = @error_collector.harvest_errors([])
153
+
154
+ assert_equal 1, errors.length
155
+
156
+ end
157
+
146
158
  def test_exclude_block
147
159
  NewRelic::Agent.logger.expects(:error).never
148
160
  @error_collector.ignore_error_filter &wrapped_filter_proc
@@ -47,4 +47,10 @@ class NewRelic::Agent::Instrumentation::MetricFrameTest < Test::Unit::TestCase
47
47
  assert_equal "/", f.uri
48
48
  assert_nil f.referer
49
49
  end
50
+
51
+ def test_queue_time
52
+ f.apdex_start = 1000
53
+ f.start = 1500
54
+ assert_equal 500, f.queue_time
55
+ end
50
56
  end
@@ -1,30 +1,13 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','..','test_helper'))
2
2
  require 'new_relic/agent/stats_engine/metric_stats'
3
+
3
4
  class NewRelic::Agent::StatsEngine::MetricStats::HarvestTest < Test::Unit::TestCase
4
5
  include NewRelic::Agent::StatsEngine::MetricStats::Harvest
5
6
 
6
7
  attr_accessor :stats_hash
7
- def test_merge_stats_trivial
8
- self.stats_hash = {}
9
- merge_stats({}, {})
10
- end
11
-
12
8
  def test_merge_stats_with_nil_stats
13
- metric_ids = mock('metric ids')
14
- mock_stats_hash = mock('stats_hash')
15
- mock_spec = mock('spec')
16
- mock_stats = mock('stats')
17
- mock_stats_hash.expects(:each).yields(mock_spec, mock_stats)
18
- self.stats_hash = mock_stats_hash
19
-
20
- self.expects(:coerce_to_metric_spec).with(mock_spec).returns(mock_spec)
21
- self.expects(:clone_and_reset_stats).with(mock_spec, mock_stats).returns(mock_stats)
22
- self.expects(:merge_old_data!).with(mock_spec, mock_stats, {})
23
- metric_ids.expects(:[]).with(mock_spec).returns('an id')
24
- self.expects(:add_data_to_send_unless_empty).with({}, mock_stats, mock_spec, 'an id')
25
-
26
-
27
- merge_stats({}, metric_ids)
9
+ self.stats_hash = NewRelic::Agent::StatsEngine::MetricStats::SynchronizedHash.new
10
+ assert_equal({}, merge_stats({}, {}))
28
11
  end
29
12
 
30
13
 
@@ -44,7 +44,7 @@ class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
44
44
  assert_equal 4, @engine.get_stats("c").total_call_time
45
45
 
46
46
  metric_data = @engine.harvest_timeslice_data({}, {}).values
47
-
47
+
48
48
  # after harvest, all the metrics should be reset
49
49
  assert_equal 0, @engine.get_stats("a").call_count
50
50
  assert_equal 0, @engine.get_stats("a").total_call_time
@@ -78,5 +78,16 @@ class NewRelic::Agent::MetricStatsTest < Test::Unit::TestCase
78
78
  assert_equal 2, stats.call_count
79
79
  assert_equal 3, stats.total_call_time
80
80
  end
81
+
82
+ def test_rescues_from_synchronization_failure_on_write
83
+ hash = NewRelic::Agent::StatsEngine::MetricStats::SynchronizedHash.new
84
+ 10.times { |i| hash[i] = i }
85
+
86
+ assert_nothing_raised do
87
+ hash.each do |k, v|
88
+ hash[11] = 1
89
+ end
90
+ end
91
+ end
81
92
  end
82
93
 
@@ -28,8 +28,7 @@ class NewRelic::LocalEnvironmentTest < Test::Unit::TestCase
28
28
 
29
29
  def test_passenger
30
30
  class << self
31
- module ::Passenger
32
- const_set "AbstractServer", 0
31
+ module ::PhusionPassenger
33
32
  end
34
33
  end
35
34
  e = NewRelic::LocalEnvironment.new
@@ -42,9 +41,9 @@ class NewRelic::LocalEnvironmentTest < Test::Unit::TestCase
42
41
  assert_nil e.dispatcher_instance_id
43
42
  end
44
43
 
45
- ::Passenger.class_eval { remove_const :AbstractServer }
44
+ Object.send(:remove_const, :PhusionPassenger)
46
45
  end
47
-
46
+
48
47
  def test_snapshot
49
48
  e = NewRelic::LocalEnvironment.new
50
49
  s = e.snapshot
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: 2096628268
4
+ hash: -2943348816
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 5
9
9
  - 1
10
- - alpha
11
- version: 3.5.1.alpha
10
+ - beta
11
+ - 1
12
+ version: 3.5.1.beta1
12
13
  platform: ruby
13
14
  authors:
14
15
  - Bill Kayser
@@ -20,7 +21,7 @@ autorequire:
20
21
  bindir: bin
21
22
  cert_chain: []
22
23
 
23
- date: 2012-10-11 00:00:00 -07:00
24
+ date: 2012-10-31 00:00:00 -07:00
24
25
  default_executable:
25
26
  dependencies:
26
27
  - !ruby/object:Gem::Dependency
@@ -75,9 +76,9 @@ description: |
75
76
 
76
77
  email: support@newrelic.com
77
78
  executables:
78
- - mongrel_rpm
79
79
  - newrelic_cmd
80
80
  - newrelic
81
+ - mongrel_rpm
81
82
  extensions: []
82
83
 
83
84
  extra_rdoc_files:
@@ -95,7 +96,6 @@ files:
95
96
  - cert/cacert.pem
96
97
  - cert/oldsite.pem
97
98
  - cert/site.pem
98
- - config.dot
99
99
  - install.rb
100
100
  - lib/conditional_vendored_dependency_detection.rb
101
101
  - lib/conditional_vendored_metric_parser.rb
@@ -111,7 +111,6 @@ files:
111
111
  - lib/new_relic/agent/configuration/manager.rb
112
112
  - lib/new_relic/agent/configuration/server_source.rb
113
113
  - lib/new_relic/agent/configuration/yaml_source.rb
114
- - lib/new_relic/agent/cross_process_monitoring.rb
115
114
  - lib/new_relic/agent/database.rb
116
115
  - lib/new_relic/agent/error_collector.rb
117
116
  - lib/new_relic/agent/instrumentation.rb
data/config.dot DELETED
@@ -1,290 +0,0 @@
1
- digraph AgentEnabled {
2
- node[color=green]
3
- "[agent_enabled]"
4
- "[developer_mode]"
5
- "[monitor_mode]"
6
- "[slow_sql.explain_threshold]"
7
- "[slow_sql.stack_trace_threshold]"
8
- "[slow_sql.explain_enabled]"
9
- "[slow_sql.enabled]"
10
- "[slow_sql.record_sql]"
11
- "[transaction_tracer.limit_segments]"
12
- "[transaction_tracer.stack_trace_threshold]"
13
- "[transaction_tracer.explain_threshold]"
14
- "[transaction_tracer.explain_enabled]"
15
- "[transaction_tracer.transaction_threshold]"
16
- "[transaction_tracer.record_sql]"
17
- "[transaction_tracer.random_sample]"
18
- "[transaction_tracer.enabled]"
19
- "[error_collector.capture_source]"
20
- "[error_collector.enabled]"
21
- "[error_collector.ignore_errors]"
22
- "[browser_monitoring.auto_instrument]"
23
- "[license_key]"
24
- "[ssl]"
25
- "[verify_certificate]"
26
- "[api_host]"
27
- "[api_port]"
28
- "[proxy_host]"
29
- "[proxy_port]"
30
- "[proxy_user]"
31
- "[proxy_pass]"
32
- "[host]"
33
- "[port]"
34
- "[timeout]"
35
- "[log_level]"
36
- "[apdex_t]"
37
- "[capture_params]"
38
- "[app_name]"
39
- "[multi_homed]"
40
- "[disable_samplers]"
41
- "[log_file_name]"
42
- "[log_file_path]"
43
- "[dispatcher]"
44
- "[force_send]"
45
- "[disable_mobile_headers]"
46
- "[textmate]"
47
- "[post_size_limit]"
48
- "[sync_startup]"
49
- "[send_data_on_exit]"
50
- "[high_security]"
51
- "[validate_seed]"
52
- "[validate_token]"
53
- "[disable_backtrace_cleanup]"
54
- "[disable_activerecord_instrumentation]"
55
- "[disable_dj]"
56
- "[capture_memcache_keys]"
57
- "[disable_memcache_instrumentation]"
58
- "[disable_view_instrumentation]"
59
- "[disable_resque]"
60
-
61
- node[shape=box,color=orange]
62
- "Control#init_plugin"
63
- "Control#api_server"
64
- "Control#proxy_server"
65
- "Control#server_from_host"
66
- "Control#http_connection"
67
- "Control#set_log_level!"
68
- "Control#log_path"
69
- "Control#log_to_stdout?"
70
- "Control#convert_to_ip_address"
71
- "Control#server"
72
- "Control#setup_log"
73
- "Control#should_log?"
74
- "Control#log!"
75
-
76
- node[color=green]
77
- "Config#app_names"
78
-
79
- node[color=black]
80
- "Agent#initialize"
81
- "Agent#after_fork"
82
- "Agent#disabled?"
83
- "Agent#shutdown"
84
- "Agent#using_forking_dispatcher?"
85
- "Agent#has_license_key?"
86
- "Agent#correct_license_length"
87
- "Agent#apdex_f"
88
- "Agent#check_config_and_start_agent"
89
- "Agent#install_exit_handler"
90
- "Agent#log_app_names"
91
- "Agent#connect_settings"
92
- "Agent#log_seed_token"
93
- "Agent#log_error"
94
- "Agent#monitoring?"
95
- "Agent#check_trasaction_sampler_status"
96
- "Agent#check_sql_sampler_status"
97
- "Agent#config_transaction_tracer"
98
- "Agent#set_sql_recording!"
99
- "Agent#already_started?"
100
- "Agent#log_connection"
101
- "Agent#manual_start"
102
-
103
- "MethodTracer#remove_method_tracer"
104
-
105
- "ErrorCollector#initialize"
106
- "ErrorCollector#request_params_from_opts"
107
-
108
- "ControllerInstrumentation#perform_action_with_newrelic_trace"
109
-
110
- "NewRelicService#initialize"
111
- "NewRelicService#check_post_size"
112
- "NewRelicService#connect"
113
- "NewRelicService#send_request"
114
-
115
- "SqlSampler#configure!"
116
-
117
- "TransactionSampler#configure!"
118
- "TransactionSampler#notice_push_scope"
119
- "TransactionSampler#capture_segment_trace"
120
- "TransactionSampler#store_segment_for_developer_mode"
121
-
122
- "NoticedError#initialize"
123
-
124
- "BeaconConfiguration#license_bytes"
125
-
126
- "ActiveRecord#depends_on"
127
- "DelayedJobInstrumentation#depends_on"
128
- "Memcache#memcache_key_snippet"
129
- "Memcache#depends_on"
130
- "Rails::ActionController#depends_on"
131
- "Rails3::ActionController#depends_on"
132
- "Resque#depends_on"
133
-
134
- "DelayedJobSampler#initialize"
135
- "DelayedJobInjection#depends_on"
136
-
137
- "MetricFrame.update_apdex"
138
-
139
- "TranactionInfo#force_persist_sample?"
140
- "TranactionInfo#include_guid?"
141
-
142
- "TransactionSampleBuilder#initialize"
143
- "TransactionSampleBuilder#set_transaction_info"
144
-
145
- "Rails#install_browser_monitoring"
146
- "Rails#log!"
147
- "Rails3#log!"
148
-
149
- "CollectionHelper#strip_nr_from_backtrace"
150
-
151
- "Deployments#initialize"
152
-
153
- #######
154
-
155
- "Control#init_plugin" -> "[agent_enabled]"
156
- "Control#init_plugin" -> "Control#setup_log"
157
- "Control#init_plugin" -> "[disable_samplers]"
158
- "Control#should_log?" -> "[agent_enabled]"
159
- "Control#api_server" -> "[api_host]"
160
- "Control#api_server" -> "[api_port]"
161
- "Control#proxy_server" -> "[proxy_host]"
162
- "Control#proxy_server" -> "[proxy_port]"
163
- "Control#proxy_server" -> "[proxy_user]"
164
- "Control#proxy_server" -> "[proxy_pass]"
165
- "Control#server_from_host" -> "[host]"
166
- "Control#server_from_host" -> "[port]"
167
- "Control#server_from_host" -> "Control#convert_to_ip_address"
168
- "Control#http_connection" -> "[ssl]"
169
- "Control#http_connection" -> "[verify_certificate]"
170
- "Control#http_connection" -> "Control#proxy_server"
171
- "Control#set_log_level!" -> "[log_level]"
172
- "Control#log_path" -> "[log_file_path]"
173
- "Control#log_path" -> "Control#log_to_stdout?"
174
- "Control#log_to_stdout?" -> "[log_file_path]"
175
- "Control#convert_to_ip_address" -> "[ssl]"
176
- "Control#convert_to_ip_address" -> "[verify_certificate]"
177
- "Control#server" -> "Control#server_from_host"
178
- "Control#setup_log" -> "Control#set_log_level!"
179
- "Control#setup_log" -> "Control#log_path"
180
- "Control#setup_log" -> "Control#log_to_stdout?"
181
- "Control#setup_log" -> "[log_file_name]"
182
- "Control#log!" -> "Control#should_log?"
183
- "Control#log!" -> "Control#log_path"
184
-
185
- "Agent#initialize" -> "[monitor_mode]"
186
- "Agent#after_fork" -> "[agent_enabled]"
187
- "Agent#after_fork" -> "[monitor_mode]"
188
- "Agent#disabled?" -> "[agent_enabled]"
189
- "Agent#shutdown" -> "[force_send]"
190
- "Agent#shutdown" -> "[dispatcher]"
191
- "Agent#using_forking_dispatcher?" -> "[dispatcher]"
192
- "Agent#has_license_key?" -> "[license_key]"
193
- "Agent#correct_license_length" -> "[license_key]"
194
- "Agent#apdex_f" -> "[apdex_t]"
195
- "Agent#check_config_and_start_agent" -> "[sync_startup]"
196
- "Agent#install_exit_handler" -> "[send_data_on_exit]"
197
- "Agent#log_app_names" -> "Config#app_names"
198
- "Agent#connect_settings" -> "Config#app_names"
199
- "Agent#log_seed_token" -> "[validate_seed]"
200
- "Agent#log_seed_token" -> "[validate_token]"
201
- "Agent#validate_settings" -> "[validate_seed]"
202
- "Agent#validate_settings" -> "[validate_token]"
203
- "Agent#log_error" -> "Control#server"
204
- "Agent#monitoring?" -> "[monitor_mode]"
205
- "Agent#check_trasaction_sampler_status" -> "[developer_mode]"
206
- "Agent#check_sql_sampler_status" -> "[slow_sql.enabled]"
207
- "Agent#check_sql_sampler_status" -> "[slow_sql.record_sql]"
208
- "Agent#check_sql_sampler_status" -> "[transaction_tracer.enabled]"
209
- "Agent#config_transaction_tracer" -> "[transaction_tracer.enabled]"
210
- "Agent#config_transaction_tracer" -> "[transaction_tracer.random_sample]"
211
- "Agent#config_transaction_tracer" -> "[transaction_tracer.transaction_threshold]"
212
- "Agent#set_sql_recording!" -> "[transaction_tracer.record_sql]"
213
- "Agent#already_started?" -> "Control#log!"
214
- "Agent#log_connection" -> "Control#log!"
215
- "Agent#manual_start" -> "Control#init_plugin"
216
-
217
- "MethodTracer#remove_method_tracer" -> "[agent_enabled]"
218
-
219
- "Rails#init_config" -> "[agent_enabled]"
220
- "Rails#init_config" -> "[developer_mode]"
221
-
222
- "ErrorCollector#initialize" -> "[error_collector.enabled]"
223
- "ErrorCollector#initialize" -> "[error_collector.capture_source]"
224
- "ErrorCollector#initialize" -> "[error_collector.ignore_errors]"
225
- "ErrorCollector#request_params_from_opts" -> "[capture_params]"
226
-
227
- "ControllerInstrumentation#perform_action_with_newrelic_trace" -> "[disable_mobile_headers]"
228
-
229
- "NewRelicService#initialize" -> "[timeout]"
230
- "NewRelicService#initialize" -> "[license_key]"
231
- "NewRelicService#initialize" -> "Control#server"
232
- "NewRelicService#check_post_size" -> "[post_size_limit]"
233
- "NewRelicService#connect" -> "Control#server_from_host"
234
- "NewRelicService#send_request" -> "Control#http_connection"
235
-
236
- "SqlSampler#configure!" -> "[slow_sql.explain_threshold]"
237
- "SqlSampler#configure!" -> "[slow_sql.explain_enabled]"
238
- "SqlSampler#configure!" -> "[slow_sql.stack_trace_threshold]"
239
- "SqlSampler#configure!" -> "[slow_sql.enabled]"
240
-
241
- "TransactionSampler#configure!" -> "[transaction_tracer.limit_segments]"
242
- "TransactionSampler#configure!" -> "[transaction_tracer.stack_trace_threshold]"
243
- "TransactionSampler#configure!" -> "[transaction_tracer.explain_threshold]"
244
- "TransactionSampler#configure!" -> "[transaction_tracer.explain_enabled]"
245
- "TransactionSampler#configure!" -> "[transaction_tracer.transaction_threshold]"
246
- "TransactionSampler#configure!" -> "[developer_mode]"
247
- "TransactionSampler#notice_push_scope" -> "[developer_mode]"
248
- "TransactionSampler#capture_segment_trace" -> "[developer_mode]"
249
- "TransactionSampler#store_segment_for_developer_mode" -> "[developer_mode]"
250
-
251
- "NoticedError#initialize" -> "[high_security]"
252
-
253
- "BeaconConfiguration#license_bytes" -> "[license_key]"
254
-
255
- "ActiveRecord#depends_on" -> "[disable_activerecord_instrumentation]"
256
-
257
- "DelayedJobInstrumentation#depends_on" -> "[disable_dj]"
258
-
259
- "Memcache#memcache_key_snippet" -> "[capture_memcache_keys]"
260
- "Memcache#depends_on" -> "[disable_memcache_instrumentation]"
261
-
262
- "Rails::ActionController#depends_on" -> "[disable_view_instrumentation]"
263
- "Rails3::ActionController#depends_on" -> "[disable_view_instrumentation]"
264
- "Resque#depends_on" -> "[disable_resque]"
265
-
266
- "DelayedJobSampler#initialize" -> "[disable_dj]"
267
- "DelayedJobInjection#depends_on" -> "[disable_dj]"
268
- "DelayedJobInjection#executes" -> "Control#init_plugin"
269
-
270
- "MetricFrame.update_apdex" -> "[apdex_t]"
271
-
272
- "TranactionInfo#force_persist_sample?" -> "[apdex_t]"
273
- "TranactionInfo#include_guid?" -> "[apdex_t]"
274
-
275
- "TransactionSampleBuilder#initialize" -> "[transaction_tracer.limit_segments]"
276
- "TransactionSampleBuilder#set_transaction_info" -> "[capture_params]"
277
-
278
- "Rails#install_browser_monitoring" -> "[browser_monitoring.auto_instrument]"
279
- "Rails#log!" -> "Control#should_log?"
280
- "Rails3#log!" -> "Control#should_log?"
281
-
282
- "CollectionHelper#strip_nr_from_backtrace" -> "[disable_backtrace_cleanup]"
283
-
284
- "Deployments#initialize" -> "Config#app_names"
285
- "Deployments#run" -> "Control#http_connection"
286
- "Deployments#run" -> "[license_key]"
287
- "Deployments#run" -> "Control#api_server"
288
-
289
- "Config#app_names" -> "[app_name]"
290
- }
@@ -1,93 +0,0 @@
1
- require 'base64'
2
- module NewRelic
3
- module Agent
4
- module CrossProcessMonitoring
5
- #start copied from BrowserMonitoring
6
-
7
- class DummyMetricFrame
8
- def initialize
9
- @attributes = {}
10
- end
11
-
12
- def user_attributes
13
- @attributes
14
- end
15
-
16
- def queue_time
17
- 0.0
18
- end
19
- end
20
-
21
- @@dummy_metric_frame = DummyMetricFrame.new
22
-
23
- #end
24
-
25
- module_function
26
-
27
- #start copy from BrowserMonitoring
28
-
29
- def browser_monitoring_transaction_name
30
- NewRelic::Agent::TransactionInfo.get.transaction_name
31
- end
32
-
33
- def browser_monitoring_queue_time_in_seconds
34
- clamp_to_positive((current_metric_frame.queue_time.to_f).round)
35
- end
36
-
37
- def browser_monitoring_app_time_in_seconds
38
- clamp_to_positive(((Time.now - browser_monitoring_start_time).to_f).round)
39
- end
40
-
41
- def current_metric_frame
42
- Thread.current[:last_metric_frame] || @@dummy_metric_frame
43
- end
44
-
45
- def clamp_to_positive(value)
46
- return 0.0 if value < 0
47
- value
48
- end
49
-
50
- def browser_monitoring_start_time
51
- NewRelic::Agent::TransactionInfo.get.start_time
52
- end
53
-
54
- # end copy
55
-
56
- def obfuscate_with_key(text, key_bytes)
57
- obfuscated = ""
58
- index = 0
59
- text.each_byte{|byte|
60
- obfuscated.concat((byte ^ key_bytes[index % key_bytes.length].to_i))
61
- index+=1
62
- }
63
-
64
- [obfuscated].pack("m0").gsub("\n", '')
65
- end
66
-
67
- def insert_cross_process_response_header(request, response)
68
-
69
- if NewRelic::Agent.instance.cross_process_id && (id = cross_process_id_from_request(request))
70
- content_length = -1
71
- # FIXME the transaction name might not be properly encoded. use a json generator
72
- payload = %[["#{NewRelic::Agent.instance.cross_process_id}","#{browser_monitoring_transaction_name}",#{browser_monitoring_queue_time_in_seconds},#{browser_monitoring_app_time_in_seconds},#{content_length}] ]
73
- payload = obfuscate_with_key payload, NewRelic::Agent.instance.cross_process_encoding_bytes
74
-
75
- response['X-NewRelic-App-Data'] = payload
76
- #FIXME generate ClientApplication metric. id must be decoded first
77
- # String metricName = MessageFormat.format("ClientApplication/{0}/all", id);
78
- end
79
- end
80
-
81
- def cross_process_id_from_request(request)
82
- headers = ['X-NewRelic-ID', 'HTTP_X_NEWRELIC_ID', 'X_NEWRELIC_ID']
83
- headers.each do |header|
84
- id = request.env[header]
85
- return id if id
86
- end
87
- nil
88
- end
89
-
90
- private
91
- end
92
- end
93
- end