newrelic_rpm 3.5.4.35.beta → 3.5.5.38
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +42 -0
- data/GUIDELINES_FOR_CONTRIBUTING.md +3 -0
- data/Rakefile +8 -0
- data/bin/mongrel_rpm +1 -1
- data/init.rb +1 -8
- data/lib/new_relic/agent.rb +11 -13
- data/lib/new_relic/agent/agent.rb +89 -110
- data/lib/new_relic/agent/agent_logger.rb +165 -0
- data/lib/new_relic/agent/audit_logger.rb +72 -0
- data/lib/new_relic/agent/beacon_configuration.rb +4 -4
- data/lib/new_relic/agent/browser_monitoring.rb +13 -7
- data/lib/new_relic/agent/busy_calculator.rb +2 -2
- data/lib/new_relic/agent/configuration.rb +25 -0
- data/lib/new_relic/agent/configuration/defaults.rb +45 -8
- data/lib/new_relic/agent/configuration/environment_source.rb +8 -15
- data/lib/new_relic/agent/configuration/manager.rb +22 -2
- data/lib/new_relic/agent/configuration/mask_defaults.rb +10 -0
- data/lib/new_relic/agent/configuration/yaml_source.rb +4 -2
- data/lib/new_relic/agent/cross_process_monitoring.rb +43 -0
- data/lib/new_relic/agent/database.rb +2 -4
- data/lib/new_relic/agent/error_collector.rb +4 -9
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +1 -1
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +1 -1
- data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
- data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +41 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +7 -7
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +4 -4
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net.rb +1 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +3 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +2 -2
- data/lib/new_relic/agent/method_tracer.rb +6 -8
- data/lib/new_relic/agent/new_relic_service.rb +94 -106
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -6
- data/lib/new_relic/agent/sql_sampler.rb +3 -18
- data/lib/new_relic/agent/stats_engine.rb +0 -5
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +3 -3
- data/lib/new_relic/agent/stats_engine/samplers.rb +2 -4
- data/lib/new_relic/agent/thread.rb +8 -3
- data/lib/new_relic/agent/thread_profiler.rb +38 -27
- data/lib/new_relic/agent/transaction_info.rb +1 -1
- data/lib/new_relic/agent/transaction_sample_builder.rb +2 -3
- data/lib/new_relic/agent/transaction_sampler.rb +3 -7
- data/lib/new_relic/agent/worker_loop.rb +3 -11
- data/lib/new_relic/control.rb +0 -2
- data/lib/new_relic/control/class_methods.rb +8 -2
- data/lib/new_relic/control/frameworks/merb.rb +0 -6
- data/lib/new_relic/control/frameworks/rails.rb +8 -29
- data/lib/new_relic/control/frameworks/rails3.rb +8 -20
- data/lib/new_relic/control/frameworks/rails4.rb +23 -0
- data/lib/new_relic/control/frameworks/ruby.rb +1 -22
- data/lib/new_relic/control/instance_methods.rb +12 -34
- data/lib/new_relic/control/instrumentation.rb +7 -12
- data/lib/new_relic/control/server_methods.rb +5 -8
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/local_environment.rb +30 -64
- data/lib/new_relic/metric_data.rb +1 -1
- data/lib/new_relic/metric_spec.rb +1 -1
- data/lib/new_relic/noticed_error.rb +1 -1
- data/lib/new_relic/rack/browser_monitoring.rb +5 -5
- data/lib/new_relic/stats.rb +9 -7
- data/lib/new_relic/transaction_sample.rb +2 -7
- data/lib/new_relic/version.rb +1 -1
- data/lib/newrelic_rpm.rb +1 -1
- data/newrelic_rpm.gemspec.erb +15 -17
- data/test/config/newrelic.yml +1 -1
- data/test/config/test_control.rb +18 -18
- data/test/fixtures/gemspec_no_build.rb +0 -2
- data/test/fixtures/gemspec_with_build.rb +0 -2
- data/test/fixtures/gemspec_with_build_and_stage.rb +0 -2
- data/test/multiverse/README.md +3 -8
- data/test/multiverse/suites/agent_only/Envfile +1 -0
- data/test/multiverse/suites/agent_only/audit_log_test.rb +99 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +1 -1
- data/test/multiverse/suites/config_file_loading/Envfile +7 -0
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +106 -0
- data/test/multiverse/suites/logging/Envfile +4 -0
- data/test/multiverse/suites/logging/config/newrelic.yml +22 -0
- data/test/multiverse/suites/logging/logging_test.rb +143 -0
- data/test/multiverse/suites/no_load/config/newrelic.yml +1 -2
- data/test/multiverse/suites/rum_auto_instrumentation/sanity_test.rb +0 -13
- data/test/new_relic/agent/agent/connect_test.rb +30 -92
- data/test/new_relic/agent/agent/start_test.rb +4 -84
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +8 -43
- data/test/new_relic/agent/agent_logger_test.rb +153 -0
- data/test/new_relic/agent/agent_test.rb +10 -9
- data/test/new_relic/agent/audit_logger_test.rb +105 -0
- data/test/new_relic/agent/browser_monitoring_test.rb +2 -1
- data/test/new_relic/agent/busy_calculator_test.rb +7 -0
- data/test/new_relic/agent/configuration/environment_source_test.rb +25 -20
- data/test/new_relic/agent/configuration/manager_test.rb +59 -4
- data/test/new_relic/agent/configuration/yaml_source_test.rb +20 -1
- data/test/new_relic/agent/cross_process_monitoring_test.rb +77 -0
- data/test/new_relic/agent/database_test.rb +0 -11
- data/test/new_relic/agent/error_collector/notice_error_test.rb +1 -3
- data/test/new_relic/agent/error_collector_test.rb +11 -7
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +39 -19
- data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +39 -0
- data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +1 -1
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +0 -6
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +3 -15
- data/test/new_relic/agent/new_relic_service_test.rb +48 -8
- data/test/new_relic/agent/pipe_channel_manager_test.rb +1 -1
- data/test/new_relic/agent/sql_sampler_test.rb +1 -1
- data/test/new_relic/agent/thread_profiler_test.rb +46 -45
- data/test/new_relic/agent/thread_test.rb +13 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +1 -1
- data/test/new_relic/agent/worker_loop_test.rb +4 -9
- data/test/new_relic/agent_test.rb +6 -9
- data/test/new_relic/control/class_methods_test.rb +0 -18
- data/test/new_relic/control_test.rb +6 -9
- data/test/new_relic/dispatcher_test.rb +54 -0
- data/test/new_relic/fake_collector.rb +15 -14
- data/test/new_relic/fake_service.rb +4 -1
- data/test/new_relic/fakes_sending_data.rb +30 -0
- data/test/new_relic/framework_test.rb +53 -0
- data/test/new_relic/local_environment_test.rb +5 -2
- data/test/new_relic/rack/browser_monitoring_test.rb +2 -1
- data/test/new_relic/rack/developer_mode_test.rb +1 -1
- data/test/new_relic/stats_test.rb +10 -0
- data/test/new_relic/transaction_sample_test.rb +2 -2
- data/test/script/ci.sh +1 -1
- data/test/test_helper.rb +23 -0
- data/ui/views/newrelic/file/images/arrow-close.png +0 -0
- data/ui/views/newrelic/file/images/arrow-open.png +0 -0
- data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/file/images/file_icon.png +0 -0
- data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
- metadata +47 -41
- data/InstallationNotes.md +0 -15
- data/lib/new_relic/control/logging_methods.rb +0 -125
- data/test/multiverse/Rakefile +0 -17
- data/test/multiverse/suites/rum_auto_instrumentation/problem_response.html +0 -422
- data/test/new_relic/control/logging_methods_test.rb +0 -211
@@ -9,12 +9,19 @@ module NewRelic
|
|
9
9
|
'NEWRELIC_LICENSE_KEY' => :license_key,
|
10
10
|
'NEW_RELIC_APP_NAME' => :app_name,
|
11
11
|
'NEWRELIC_APP_NAME' => :app_name,
|
12
|
+
'NEW_RELIC_HOST' => :host,
|
13
|
+
'NEW_RELIC_PORT' => :port
|
14
|
+
}.each do |key, val|
|
15
|
+
self[val] = ENV[key] if ENV[key]
|
16
|
+
end
|
17
|
+
|
18
|
+
symbol_map = {
|
12
19
|
'NEW_RELIC_DISPATCHER' => :dispatcher,
|
13
20
|
'NEWRELIC_DISPATCHER' => :dispatcher,
|
14
21
|
'NEW_RELIC_FRAMEWORK' => :framework,
|
15
22
|
'NEWRELIC_FRAMEWORK' => :framework
|
16
23
|
}.each do |key, val|
|
17
|
-
self[val] = ENV[key] if ENV[key]
|
24
|
+
self[val] = ENV[key].intern if ENV[key]
|
18
25
|
end
|
19
26
|
|
20
27
|
boolean_map = {
|
@@ -35,20 +42,6 @@ module NewRelic
|
|
35
42
|
self[:log_file_name] = File.basename(ENV['NEW_RELIC_LOG'])
|
36
43
|
end
|
37
44
|
end
|
38
|
-
|
39
|
-
initialize_thread_profiler_settings
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
def initialize_thread_profiler_settings
|
44
|
-
thread_profiler_supported = NewRelic::Agent::ThreadProfiler.is_supported?
|
45
|
-
self[:'thread_profiler.is_supported'] = thread_profiler_supported
|
46
|
-
|
47
|
-
# If not supporting thread profiling, ignore all other enabled's.
|
48
|
-
# Otherwise, don't set so defaulting is heeded.
|
49
|
-
if !thread_profiler_supported
|
50
|
-
self[:'thread_profiler.enabled'] = false
|
51
|
-
end
|
52
45
|
end
|
53
46
|
end
|
54
47
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
require 'new_relic/agent/configuration/defaults'
|
3
|
+
require 'new_relic/agent/configuration/mask_defaults'
|
3
4
|
require 'new_relic/agent/configuration/yaml_source'
|
4
5
|
require 'new_relic/agent/configuration/server_source'
|
5
6
|
require 'new_relic/agent/configuration/environment_source'
|
@@ -22,6 +23,7 @@ module NewRelic
|
|
22
23
|
invoke_callbacks(:add, source)
|
23
24
|
@config_stack.insert(level, source.freeze)
|
24
25
|
reset_cache
|
26
|
+
log_config(:add, source)
|
25
27
|
end
|
26
28
|
|
27
29
|
def remove_config(source=nil)
|
@@ -32,6 +34,7 @@ module NewRelic
|
|
32
34
|
end
|
33
35
|
reset_cache
|
34
36
|
invoke_callbacks(:remove, source)
|
37
|
+
log_config(:remove, source)
|
35
38
|
end
|
36
39
|
|
37
40
|
def replace_or_add_config(source, level=0)
|
@@ -83,14 +86,14 @@ module NewRelic
|
|
83
86
|
end
|
84
87
|
end
|
85
88
|
|
86
|
-
def
|
89
|
+
def flattened
|
87
90
|
@config_stack.reverse.inject({}) do |flat,layer|
|
88
91
|
thawed_layer = layer.dup
|
89
92
|
thawed_layer.each do |k,v|
|
90
93
|
begin
|
91
94
|
thawed_layer[k] = instance_eval(&v) if v.respond_to?(:call)
|
92
95
|
rescue => e
|
93
|
-
NewRelic::
|
96
|
+
::NewRelic::Agent.logger.debug("#{e.class.name} : #{e.message} - when accessing config key #{k}")
|
94
97
|
thawed_layer[k] = nil
|
95
98
|
end
|
96
99
|
thawed_layer.delete(:config)
|
@@ -99,6 +102,17 @@ module NewRelic
|
|
99
102
|
end
|
100
103
|
end
|
101
104
|
|
105
|
+
def apply_mask(hash)
|
106
|
+
MASK_DEFAULTS. \
|
107
|
+
select {|_, proc| proc.call}. \
|
108
|
+
each {|key, _| hash.delete(key) }
|
109
|
+
hash
|
110
|
+
end
|
111
|
+
|
112
|
+
def to_collector_hash
|
113
|
+
DottedHash.new(apply_mask(flattened)).to_hash
|
114
|
+
end
|
115
|
+
|
102
116
|
def app_names
|
103
117
|
case self[:app_name]
|
104
118
|
when Array then self[:app_name]
|
@@ -110,6 +124,12 @@ module NewRelic
|
|
110
124
|
def reset_cache
|
111
125
|
@cache = Hash.new {|hash,key| hash[key] = self.fetch(key) }
|
112
126
|
end
|
127
|
+
|
128
|
+
def log_config(direction, source)
|
129
|
+
::NewRelic::Agent.logger.debug(
|
130
|
+
"Updating config (#{direction}) from #{source.class}. Results:",
|
131
|
+
flattened.inspect)
|
132
|
+
end
|
113
133
|
end
|
114
134
|
end
|
115
135
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Configuration
|
4
|
+
MASK_DEFAULTS = {
|
5
|
+
:'thread_profiler' => Proc.new { !NewRelic::Agent::ThreadProfiler.is_supported? },
|
6
|
+
:'thread_profiler.enabled' => Proc.new { !NewRelic::Agent::ThreadProfiler.is_supported? },
|
7
|
+
}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -7,11 +7,13 @@ module NewRelic
|
|
7
7
|
attr_accessor :file_path
|
8
8
|
|
9
9
|
def initialize(path, env)
|
10
|
+
::NewRelic::Agent.logger.debug("Reading configuration from #{path}")
|
11
|
+
|
10
12
|
config = {}
|
11
13
|
begin
|
12
14
|
@file_path = File.expand_path(path)
|
13
15
|
if !File.exists?(@file_path)
|
14
|
-
NewRelic::
|
16
|
+
::NewRelic::Agent.logger.error("Unable to load configuration from #{path}")
|
15
17
|
return
|
16
18
|
end
|
17
19
|
|
@@ -25,7 +27,7 @@ module NewRelic
|
|
25
27
|
erb = ERB.new(file).result(binding)
|
26
28
|
config = merge!(YAML.load(erb)[env] || {})
|
27
29
|
rescue ScriptError, StandardError => e
|
28
|
-
NewRelic::
|
30
|
+
::NewRelic::Agent.logger.error("Unable to read configuration file #{path}: #{e}")
|
29
31
|
end
|
30
32
|
|
31
33
|
if config['transaction_tracer'] &&
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module CrossProcessMonitoring
|
4
|
+
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def insert_response_header(request, response)
|
8
|
+
if Agent.config[:'cross_process.enabled'] &&
|
9
|
+
NewRelic::Agent.instance.cross_process_id && (id = id_from_request(request))
|
10
|
+
|
11
|
+
content_length = -1
|
12
|
+
timings = NewRelic::Agent::BrowserMonitoring.timings
|
13
|
+
|
14
|
+
# FIXME the transaction name might not be properly encoded. use a json generator
|
15
|
+
payload = %[["#{NewRelic::Agent.instance.cross_process_id}","#{timings.transaction_name}",#{timings.queue_time_in_millis},#{timings.app_time_in_millis},#{content_length}] ]
|
16
|
+
payload = obfuscate_with_key(payload, NewRelic::Agent.instance.cross_process_encoding_bytes)
|
17
|
+
|
18
|
+
response['X-NewRelic-App-Data'] = payload
|
19
|
+
#FIXME generate ClientApplication metric. id must be decoded first
|
20
|
+
# String metricName = MessageFormat.format("ClientApplication/{0}/all", id);
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def obfuscate_with_key(text, key_bytes)
|
25
|
+
obfuscated = ""
|
26
|
+
index = 0
|
27
|
+
text.each_byte{|byte|
|
28
|
+
obfuscated.concat((byte ^ key_bytes[index % key_bytes.length].to_i))
|
29
|
+
index+=1
|
30
|
+
}
|
31
|
+
|
32
|
+
[obfuscated].pack("m0").gsub("\n", '')
|
33
|
+
end
|
34
|
+
|
35
|
+
def id_from_request(request)
|
36
|
+
%w{X-NewRelic-ID HTTP_X_NEWRELIC_ID X_NEWRELIC_ID}.each do |header|
|
37
|
+
return request.env[header] if request.env.has_key?(header)
|
38
|
+
end
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -113,8 +113,7 @@ module NewRelic
|
|
113
113
|
rescue => e
|
114
114
|
begin
|
115
115
|
# guarantees no throw from explain_sql
|
116
|
-
NewRelic::
|
117
|
-
NewRelic::Control.instance.log.debug(e.backtrace.join("\n"))
|
116
|
+
::NewRelic::Agent.logger.error("Error getting query plan:", e)
|
118
117
|
rescue
|
119
118
|
# double exception. throw up your hands
|
120
119
|
end
|
@@ -145,8 +144,7 @@ module NewRelic
|
|
145
144
|
connection = ActiveRecord::Base.send("#{config[:adapter]}_connection", config)
|
146
145
|
@connections[config] = connection
|
147
146
|
rescue => e
|
148
|
-
NewRelic::Agent.
|
149
|
-
NewRelic::Agent.agent.log.error(e.backtrace.join("\n"))
|
147
|
+
::NewRelic::Agent.logger.error("Caught exception trying to get connection to DB for explain. Control: #{config}", e)
|
150
148
|
nil
|
151
149
|
end
|
152
150
|
end
|
@@ -29,7 +29,7 @@ module NewRelic
|
|
29
29
|
@lock = Mutex.new
|
30
30
|
|
31
31
|
Agent.config.register_callback(:'error_collector.enabled') do |config_enabled|
|
32
|
-
|
32
|
+
::NewRelic::Agent.logger.debug "Errors will #{config_enabled ? '' : 'not '}be sent to the New Relic service."
|
33
33
|
end
|
34
34
|
Agent.config.register_callback(:'error_collector.ignore_errors') do |ignore_errors|
|
35
35
|
initialize_ignored_errors(ignore_errors)
|
@@ -66,7 +66,7 @@ module NewRelic
|
|
66
66
|
def ignore(errors)
|
67
67
|
errors.each do |error|
|
68
68
|
@ignore[error] = true
|
69
|
-
|
69
|
+
::NewRelic::Agent.logger.debug("Ignoring errors of type '#{error}'")
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -193,7 +193,7 @@ module NewRelic
|
|
193
193
|
# the maximum limit, and logs a warning if we are over the limit.
|
194
194
|
def over_queue_limit?(message)
|
195
195
|
over_limit = (@errors.length >= MAX_ERROR_QUEUE_LENGTH)
|
196
|
-
|
196
|
+
::NewRelic::Agent.logger.warn("The error reporting queue has reached #{MAX_ERROR_QUEUE_LENGTH}. The error detail for this and subsequent errors will not be transmitted to New Relic until the queued errors have been sent: #{message}") if over_limit
|
197
197
|
over_limit
|
198
198
|
end
|
199
199
|
|
@@ -228,7 +228,7 @@ module NewRelic
|
|
228
228
|
add_to_error_queue(NewRelic::NoticedError.new(action_path, exception_options, exception))
|
229
229
|
exception
|
230
230
|
rescue => e
|
231
|
-
|
231
|
+
::NewRelic::Agent.logger.warn("Failure when capturing error '#{exception}':", e)
|
232
232
|
end
|
233
233
|
|
234
234
|
# Get the errors currently queued up. Unsent errors are left
|
@@ -245,11 +245,6 @@ module NewRelic
|
|
245
245
|
errors
|
246
246
|
end
|
247
247
|
end
|
248
|
-
|
249
|
-
private
|
250
|
-
def log
|
251
|
-
NewRelic::Agent.logger
|
252
|
-
end
|
253
248
|
end
|
254
249
|
end
|
255
250
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Instrumentation
|
4
|
+
class BrowserMonitoringTimings
|
5
|
+
|
6
|
+
def initialize(queue_time_in_seconds, transaction)
|
7
|
+
if transaction.nil?
|
8
|
+
@start_time_in_seconds = 0.0
|
9
|
+
else
|
10
|
+
@transaction_name = transaction.transaction_name
|
11
|
+
@start_time_in_seconds = transaction.start_time
|
12
|
+
end
|
13
|
+
|
14
|
+
@queue_time_in_seconds = queue_time_in_seconds
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :transaction_name
|
18
|
+
|
19
|
+
def start_time_in_millis
|
20
|
+
convert_to_milliseconds(@start_time_in_seconds)
|
21
|
+
end
|
22
|
+
|
23
|
+
def queue_time_in_millis
|
24
|
+
convert_to_milliseconds(@queue_time_in_seconds)
|
25
|
+
end
|
26
|
+
|
27
|
+
def app_time_in_millis
|
28
|
+
convert_to_milliseconds(Time.now - @start_time_in_seconds)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def convert_to_milliseconds(value)
|
34
|
+
value = (value.to_f * 1000.0).round
|
35
|
+
return 0.0 if value < 0
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -60,7 +60,7 @@ module NewRelic
|
|
60
60
|
if specifiers.empty?
|
61
61
|
self.newrelic_write_attr property, true
|
62
62
|
elsif ! (Hash === specifiers)
|
63
|
-
logger.error "newrelic_#{property} takes an optional hash with :only and :except lists of actions (illegal argument type '#{specifiers.class}')"
|
63
|
+
::NewRelic::Agent.logger.error "newrelic_#{property} takes an optional hash with :only and :except lists of actions (illegal argument type '#{specifiers.class}')"
|
64
64
|
else
|
65
65
|
self.newrelic_write_attr property, specifiers
|
66
66
|
end
|
@@ -159,7 +159,7 @@ module NewRelic
|
|
159
159
|
alias_method method.to_s, with_method_name
|
160
160
|
send visibility, method
|
161
161
|
send visibility, with_method_name
|
162
|
-
NewRelic::
|
162
|
+
::NewRelic::Agent.logger.debug("Traced transaction: class = #{self.name}, method = #{method.to_s}, options = #{options.inspect}")
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -269,9 +269,10 @@ module NewRelic
|
|
269
269
|
else
|
270
270
|
perform_action_without_newrelic_trace(*args)
|
271
271
|
end
|
272
|
-
if defined?(request) && request && defined?(response) &&
|
273
|
-
|
274
|
-
|
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
|
275
276
|
end
|
276
277
|
result
|
277
278
|
rescue => e
|
@@ -449,8 +450,7 @@ module NewRelic
|
|
449
450
|
end
|
450
451
|
queue_start || now
|
451
452
|
rescue => e
|
452
|
-
NewRelic::
|
453
|
-
NewRelic::Control.instance.log.debug("#{e.backtrace[0..20]}")
|
453
|
+
::NewRelic::Agent.logger.error("Error detecting upstream wait time:", e)
|
454
454
|
now
|
455
455
|
end
|
456
456
|
|
@@ -57,24 +57,24 @@ DependencyDetection.defer do
|
|
57
57
|
if defined? ::MemCache
|
58
58
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::MemCache,
|
59
59
|
commands)
|
60
|
-
NewRelic::Agent.logger.
|
60
|
+
::NewRelic::Agent.logger.info 'Installing MemCache instrumentation'
|
61
61
|
end
|
62
62
|
if defined? ::Memcached
|
63
63
|
commands << 'cas'
|
64
64
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::Memcached,
|
65
65
|
commands)
|
66
|
-
NewRelic::Agent.logger.
|
66
|
+
::NewRelic::Agent.logger.info 'Installing Memcached instrumentation'
|
67
67
|
end
|
68
68
|
if defined? ::Dalli::Client
|
69
69
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::Dalli::Client,
|
70
70
|
commands)
|
71
|
-
NewRelic::Agent.logger.
|
71
|
+
::NewRelic::Agent.logger.info 'Installing Dalli Memcache instrumentation'
|
72
72
|
end
|
73
73
|
if defined? ::Spymemcached
|
74
74
|
commands << 'multiget'
|
75
75
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::Spymemcached,
|
76
76
|
commands)
|
77
|
-
NewRelic::Agent.logger.
|
77
|
+
::NewRelic::Agent.logger.info 'Installing Spymemcached instrumentation'
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|