newrelic_rpm 3.18.1.330 → 4.0.0.332
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -74
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTING.md +14 -6
- data/LICENSE +1 -88
- data/lib/new_relic/agent.rb +2 -103
- data/lib/new_relic/agent/agent.rb +3 -32
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +2 -6
- data/lib/new_relic/agent/configuration/default_source.rb +1 -8
- data/lib/new_relic/agent/configuration/yaml_source.rb +1 -12
- data/lib/new_relic/agent/cross_app_monitor.rb +2 -1
- data/lib/new_relic/agent/cross_app_tracing.rb +4 -2
- data/lib/new_relic/agent/datastores/mongo.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -20
- data/lib/new_relic/agent/error_collector.rb +8 -21
- data/lib/new_relic/agent/inbound_request_monitor.rb +4 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +14 -30
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -5
- data/lib/new_relic/agent/instrumentation/curb.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +3 -3
- data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -2
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +2 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +3 -7
- data/lib/new_relic/agent/instrumentation/queue_time.rb +13 -15
- data/lib/new_relic/agent/instrumentation/rack.rb +4 -50
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +1 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +0 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +3 -2
- data/lib/new_relic/agent/method_tracer.rb +1 -60
- data/lib/new_relic/agent/new_relic_service.rb +3 -2
- data/lib/new_relic/agent/new_relic_service/encoders.rb +5 -6
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +7 -16
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -3
- data/lib/new_relic/agent/pipe_service.rb +1 -3
- data/lib/new_relic/agent/rules_engine.rb +2 -17
- data/lib/new_relic/agent/stats_engine.rb +0 -2
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +0 -48
- data/lib/new_relic/agent/supported_versions.rb +12 -19
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +0 -3
- data/lib/new_relic/agent/transaction/attributes.rb +1 -10
- data/lib/new_relic/agent/vm.rb +1 -4
- data/lib/new_relic/agent/vm/jruby_vm.rb +1 -3
- data/lib/new_relic/agent/vm/mri_vm.rb +2 -10
- data/lib/new_relic/control.rb +1 -2
- data/lib/new_relic/control/frameworks/rails.rb +1 -1
- data/lib/new_relic/control/frameworks/rails3.rb +1 -2
- data/lib/new_relic/control/frameworks/rails4.rb +1 -1
- data/lib/new_relic/control/frameworks/rails5.rb +1 -1
- data/lib/new_relic/control/instance_methods.rb +1 -1
- data/{vendor/gems/dependency_detection-0.0.1.build/lib → lib/new_relic}/dependency_detection.rb +0 -1
- data/lib/new_relic/helper.rb +6 -13
- data/lib/new_relic/language_support.rb +44 -139
- data/lib/new_relic/metric_spec.rb +0 -17
- data/lib/new_relic/noticed_error.rb +18 -27
- data/lib/new_relic/version.rb +3 -48
- data/lib/tasks/versions.rake +7 -5
- data/newrelic_rpm.gemspec +1 -16
- data/test/agent_helper.rb +4 -2
- data/test/environments/lib/environments/runner.rb +5 -14
- data/test/environments/norails/Gemfile +0 -8
- data/test/environments/rails21/Gemfile +0 -8
- data/test/environments/rails21/config/database.yml +1 -1
- data/test/environments/rails22/Gemfile +0 -8
- data/test/environments/rails22/config/database.yml +1 -1
- data/test/environments/rails23/Gemfile +1 -7
- data/test/environments/rails23/config/database.yml +1 -1
- data/test/environments/rails30/Gemfile +0 -1
- data/test/environments/rails30/config/database.yml +1 -1
- data/test/environments/rails31/Gemfile +0 -3
- data/test/environments/rails31/config/database.yml +1 -1
- data/test/environments/rails32/Gemfile +0 -3
- data/test/environments/rails32/config/database.yml +1 -1
- data/test/environments/rails40/Gemfile +0 -26
- data/test/environments/rails40/config/database.yml +1 -1
- data/test/environments/rails41/Gemfile +0 -18
- data/test/environments/rails41/config/database.yml +1 -1
- data/test/environments/rails42/Gemfile +0 -22
- data/test/environments/rails42/config/database.yml +1 -1
- data/test/environments/rails50/Gemfile +0 -13
- data/test/environments/rails50/config/database.yml +1 -1
- data/test/helpers/logging.rb +37 -0
- data/test/helpers/minitest.rb +50 -0
- data/test/helpers/misc.rb +87 -0
- data/test/helpers/transaction_sample.rb +44 -0
- data/test/multiverse/lib/multiverse/suite.rb +6 -91
- data/test/multiverse/script/runner +1 -1
- data/test/multiverse/suites/active_record/Envfile +1 -28
- data/test/multiverse/suites/active_record/active_record_test.rb +6 -6
- data/test/multiverse/suites/active_record/config/database.rb +2 -3
- data/test/multiverse/suites/active_record/config/database.yml +0 -2
- data/test/multiverse/suites/activemerchant/Envfile +4 -18
- data/test/multiverse/suites/agent_only/encoding_handling_test.rb +7 -15
- data/test/multiverse/suites/agent_only/error_events_test.rb +1 -7
- data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +4 -20
- data/test/multiverse/suites/agent_only/labels_test.rb +1 -1
- data/test/multiverse/suites/agent_only/marshaling_test.rb +5 -10
- data/test/multiverse/suites/agent_only/script/public_api_when_disabled.rb +0 -11
- data/test/multiverse/suites/agent_only/start_up_test.rb +3 -3
- data/test/multiverse/suites/agent_only/synthetics_test.rb +1 -1
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +0 -3
- data/test/multiverse/suites/agent_only/xray_sessions_test.rb +0 -3
- data/test/multiverse/suites/capistrano/Envfile +2 -4
- data/test/multiverse/suites/capistrano2/Envfile +0 -4
- data/test/multiverse/suites/curb/Envfile +3 -7
- data/test/multiverse/suites/datamapper/Envfile +2 -2
- data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -2
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +0 -1
- data/test/multiverse/suites/delayed_job/Envfile +28 -41
- data/test/multiverse/suites/excon/Envfile +0 -3
- data/test/multiverse/suites/grape/Envfile +0 -4
- data/test/multiverse/suites/grape/grape_versioning_test.rb +2 -2
- data/test/multiverse/suites/grape/grape_versioning_test_api.rb +2 -2
- data/test/multiverse/suites/json/Envfile +1 -9
- data/test/multiverse/suites/marshalling/Envfile +0 -9
- data/test/multiverse/suites/memcached/Envfile +5 -23
- data/test/multiverse/suites/mongo/Envfile +9 -11
- data/test/multiverse/suites/padrino/Envfile +0 -6
- data/test/multiverse/suites/rack/http_response_code_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +5 -10
- data/test/multiverse/suites/rack/rack_cascade_test.rb +0 -1
- data/test/multiverse/suites/rack/rack_env_mutation_test.rb +0 -1
- data/test/multiverse/suites/rack/response_content_type_test.rb +0 -1
- data/test/multiverse/suites/rails/Envfile +1 -19
- data/test/multiverse/suites/rails/activejob_test.rb +1 -2
- data/test/multiverse/suites/rails/error_tracing_test.rb +0 -13
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +12 -32
- data/test/multiverse/suites/rake/Envfile +15 -22
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sequel/database.rb +1 -4
- data/test/multiverse/suites/sidekiq/Envfile +13 -23
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +3 -3
- data/test/multiverse/suites/typhoeus/Envfile +0 -19
- data/test/multiverse/suites/typhoeus/typhoeus_test.rb +3 -3
- data/test/multiverse/suites/yajl/Envfile +5 -0
- data/test/multiverse/suites/yajl/yajl_test.rb +1 -3
- data/test/new_relic/agent/agent/start_test.rb +3 -3
- data/test/new_relic/agent/agent_logger_test.rb +2 -2
- data/test/new_relic/agent/agent_test.rb +2 -2
- data/test/new_relic/agent/attribute_processing_test.rb +3 -4
- data/test/new_relic/agent/audit_logger_test.rb +4 -6
- data/test/new_relic/agent/aws_info_test.rb +17 -1
- data/test/new_relic/agent/busy_calculator_test.rb +14 -16
- data/test/new_relic/agent/configuration/manager_test.rb +1 -7
- data/test/new_relic/agent/cross_app_monitor_test.rb +1 -1
- data/test/new_relic/agent/database_test.rb +2 -10
- data/test/new_relic/agent/datastores/mongo/event_formatter_test.rb +90 -93
- data/test/new_relic/agent/datastores/redis_test.rb +14 -16
- data/test/new_relic/agent/encoding_normalizer_test.rb +38 -40
- data/test/new_relic/agent/error_collector_test.rb +16 -49
- data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +0 -6
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +101 -103
- data/test/new_relic/agent/instrumentation/rack_test.rb +11 -14
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +0 -10
- data/test/new_relic/agent/javascript_instrumentor_test.rb +2 -2
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +0 -10
- data/test/new_relic/agent/method_tracer_test.rb +35 -76
- data/test/new_relic/agent/new_relic_service_test.rb +86 -102
- data/test/new_relic/agent/pipe_channel_manager_test.rb +4 -9
- data/test/new_relic/agent/pipe_service_test.rb +2 -3
- data/test/new_relic/agent/rpm_agent_test.rb +0 -4
- data/test/new_relic/agent/sampled_buffer_test.rb +2 -2
- data/test/new_relic/agent/samplers/cpu_sampler_test.rb +28 -0
- data/test/new_relic/agent/samplers/memory_sampler_test.rb +66 -0
- data/test/new_relic/agent/sized_buffer_test.rb +1 -1
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +2 -14
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +44 -66
- data/test/new_relic/agent/stats_test.rb +6 -8
- data/test/new_relic/agent/synthetics_event_buffer_test.rb +1 -1
- data/test/new_relic/agent/transaction/attributes_test.rb +4 -12
- data/test/new_relic/agent/transaction_test.rb +2 -10
- data/test/new_relic/agent/utilization_data_test.rb +17 -1
- data/test/new_relic/agent/vm/mri_vm_test.rb +5 -7
- data/test/new_relic/agent_test.rb +0 -43
- data/test/new_relic/coerce_test.rb +1 -3
- data/test/new_relic/fake_collector.rb +3 -3
- data/test/new_relic/fake_external_server.rb +1 -1
- data/test/new_relic/fake_server.rb +1 -1
- data/test/new_relic/http_client_test_cases.rb +3 -3
- data/test/new_relic/language_support_test.rb +6 -12
- data/test/new_relic/latest_changes_test.rb +0 -11
- data/test/new_relic/license_test.rb +3 -8
- data/test/new_relic/multiverse_helpers.rb +1 -1
- data/test/new_relic/noticed_error_test.rb +11 -7
- data/test/new_relic/rack/browser_monitoring_test.rb +1 -3
- data/test/nullverse/nullverse_helper.rb +1 -1
- data/test/performance/lib/performance.rb +1 -1
- data/test/performance/lib/performance/instrumentation/gc_stats.rb +4 -6
- data/test/performance/lib/performance/instrumentation/perf_tools.rb +1 -1
- data/test/performance/lib/performance/instrumentation/stackprof.rb +1 -1
- data/test/performance/lib/performance/platform.rb +1 -8
- data/test/performance/script/runner +1 -3
- data/test/performance/suites/active_record.rb +3 -24
- data/test/test_helper.rb +9 -216
- metadata +9 -45
- data/lib/conditional_vendored_dependency_detection.rb +0 -7
- data/lib/new_relic/agent/hash_extensions.rb +0 -41
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +0 -39
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +0 -51
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +0 -47
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +0 -46
- data/lib/new_relic/agent/stats_engine/samplers.rb +0 -22
- data/lib/new_relic/agent/vm/rubinius_vm.rb +0 -140
- data/lib/new_relic/json_wrapper.rb +0 -78
- data/lib/new_relic/okjson.rb +0 -602
- data/lib/new_relic/rack/error_collector.rb +0 -27
- data/lib/new_relic/timer_lib.rb +0 -31
- data/test/helpers/runtime_detection.rb +0 -17
- data/test/multiverse/suites/no_json/Envfile +0 -12
- data/test/multiverse/suites/no_json/config/newrelic.yml +0 -27
- data/test/multiverse/suites/no_json/marshal_config_test.rb +0 -22
- data/test/new_relic/agent/hash_extensions_test.rb +0 -59
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +0 -22
- data/test/new_relic/agent/stats_engine/samplers_test.rb +0 -98
- data/test/new_relic/agent/vm/rubinius_vm_test.rb +0 -69
- data/test/new_relic/json_wrapper_test.rb +0 -32
- data/test/new_relic/rack/deferred_instrumentation_test.rb +0 -33
- data/test/new_relic/rack/error_collector_test.rb +0 -83
- data/test/new_relic/version_number_test.rb +0 -101
- data/test/script/before_install/revert_rubygems.sh +0 -15
- data/test/script/before_install/update_bundler.sh +0 -12
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +0 -7
@@ -243,9 +243,7 @@ module NewRelic
|
|
243
243
|
end
|
244
244
|
|
245
245
|
def unmarshal(data)
|
246
|
-
|
247
|
-
Marshal.load(data)
|
248
|
-
end
|
246
|
+
Marshal.load(data)
|
249
247
|
rescue StandardError => e
|
250
248
|
::NewRelic::Agent.logger.error "Failure unmarshalling message from Resque child process", e
|
251
249
|
::NewRelic::Agent.logger.debug Base64.encode64(data)
|
@@ -50,23 +50,8 @@ module NewRelic
|
|
50
50
|
# When multiple rules share the same prefix,
|
51
51
|
# only apply the rule with the last instance of the prefix.
|
52
52
|
# Note that the incoming rules are in reverse order to facilitate this.
|
53
|
-
|
54
|
-
|
55
|
-
rules.uniq! { |rule| rule.prefix }
|
56
|
-
end
|
57
|
-
else
|
58
|
-
def self.reject_rules_with_duplicate_prefixes!(rules)
|
59
|
-
unique_rules = {}
|
60
|
-
|
61
|
-
rules.reject! do |rule|
|
62
|
-
if unique_rules[rule.prefix]
|
63
|
-
true
|
64
|
-
else
|
65
|
-
unique_rules[rule.prefix] = rule
|
66
|
-
false
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
53
|
+
def self.reject_rules_with_duplicate_prefixes!(rules)
|
54
|
+
rules.uniq! { |rule| rule.prefix }
|
70
55
|
end
|
71
56
|
|
72
57
|
def initialize(rules=[], segment_term_rules=[])
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/stats_engine/metric_stats'
|
6
|
-
require 'new_relic/agent/stats_engine/samplers'
|
7
6
|
require 'new_relic/agent/stats_engine/gc_profiler'
|
8
7
|
require 'new_relic/agent/stats_engine/stats_hash'
|
9
8
|
|
@@ -12,7 +11,6 @@ module NewRelic
|
|
12
11
|
# This class handles all the statistics gathering for the agent
|
13
12
|
class StatsEngine
|
14
13
|
include MetricStats
|
15
|
-
include Samplers
|
16
14
|
|
17
15
|
attr_accessor :metric_rules
|
18
16
|
|
@@ -108,49 +108,6 @@ module NewRelic
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
# This method is deprecated and not thread safe, and should not be used
|
112
|
-
# by any new client code.
|
113
|
-
#
|
114
|
-
# Lookup the Stats object for a given unscoped metric, returning a new
|
115
|
-
# Stats object if one did not exist previously.
|
116
|
-
#
|
117
|
-
# @api public
|
118
|
-
# @deprecated Use {::NewRelic::Agent.record_metric} instead.
|
119
|
-
#
|
120
|
-
def get_stats_no_scope(metric_name)
|
121
|
-
get_stats(metric_name, false)
|
122
|
-
end
|
123
|
-
|
124
|
-
# This method is deprecated and not thread safe, and should not be used
|
125
|
-
# by any new client code. Use NewRelic::Agent.record_metric instead.
|
126
|
-
#
|
127
|
-
# If scoped_metric_only is true, only a scoped metric is created (used
|
128
|
-
# by rendering metrics which by definition are per controller only)
|
129
|
-
# Leaving second, unused parameter for compatibility
|
130
|
-
#
|
131
|
-
# @api public
|
132
|
-
# @deprecated Use {::NewRelic::Agent.record_metric} instead.
|
133
|
-
#
|
134
|
-
def get_stats(metric_name, _ = true, scoped_metric_only = false, scope = nil)
|
135
|
-
stats = nil
|
136
|
-
with_stats_lock do
|
137
|
-
if scoped_metric_only
|
138
|
-
stats = @stats_hash[NewRelic::MetricSpec.new(metric_name, scope)]
|
139
|
-
else
|
140
|
-
unscoped_spec = NewRelic::MetricSpec.new(metric_name)
|
141
|
-
unscoped_stats = @stats_hash[unscoped_spec]
|
142
|
-
if scope && scope != metric_name
|
143
|
-
scoped_spec = NewRelic::MetricSpec.new(metric_name, scope)
|
144
|
-
scoped_stats = @stats_hash[scoped_spec]
|
145
|
-
stats = NewRelic::Agent::ChainedStats.new(scoped_stats, unscoped_stats)
|
146
|
-
else
|
147
|
-
stats = unscoped_stats
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
stats
|
152
|
-
end
|
153
|
-
|
154
111
|
# Helper for recording a straight value into the count
|
155
112
|
def tl_record_supportability_metric_count(metric, value)
|
156
113
|
real_name = "Supportability/#{metric}"
|
@@ -167,11 +124,6 @@ module NewRelic
|
|
167
124
|
end
|
168
125
|
end
|
169
126
|
|
170
|
-
# Renamed to reset!, here for backwards compatibility with 3rd-party
|
171
|
-
# gems (though this really isn't part of the public API).
|
172
|
-
# @deprecated
|
173
|
-
def reset_stats; reset!; end
|
174
|
-
|
175
127
|
# merge data from previous harvests into this stats engine
|
176
128
|
def merge!(other_stats_hash)
|
177
129
|
with_stats_lock do
|
@@ -11,30 +11,22 @@ module NewRelic
|
|
11
11
|
{
|
12
12
|
:type => :ruby,
|
13
13
|
:name => "MRI",
|
14
|
-
:supported => ["
|
15
|
-
:
|
14
|
+
:supported => ["2.0.0", "~> 2.1.0", "~> 2.2.0", "~> 2.3.0", "~> 2.4.0"],
|
15
|
+
:deprecated => ["1.8.6", "1.8.7", "1.9.2", "1.9.3"],
|
16
16
|
:url => "https://www.ruby-lang.org",
|
17
17
|
:feed => "https://www.ruby-lang.org/en/feeds/news.rss",
|
18
|
-
:notes => [
|
19
|
-
|
20
|
-
"1.8.7 & REE require the 'json' gem to be present in your Gemfile/operating environment.",
|
21
|
-
"Last supported agent on 1.8.6 was 3.6.8.168."]
|
18
|
+
:notes => ["Last supported agent for 1.8.7, 1.9.2, and 1.9.3 was 3.18.0.329.",
|
19
|
+
"Last supported agent on 1.8.6 was 3.6.8.168."]
|
22
20
|
},
|
23
21
|
:jruby =>
|
24
22
|
{
|
25
23
|
:type => :ruby,
|
26
24
|
:name => "JRuby",
|
27
|
-
:supported => ["~>
|
25
|
+
:supported => ["~> 9.0", "~> 9.1"],
|
26
|
+
:deprecated => ["~> 1.7.0"],
|
28
27
|
:url => "http://jruby.org",
|
29
|
-
:feed => "http://jruby.org/atom.xml"
|
30
|
-
|
31
|
-
:rbx =>
|
32
|
-
{
|
33
|
-
:type => :ruby,
|
34
|
-
:name => "Rubinius",
|
35
|
-
:supported => ["~> 2.2.1"],
|
36
|
-
:url => "http://rubini.us",
|
37
|
-
:feed => "http://rubini.us/feed/atom.xml"
|
28
|
+
:feed => "http://jruby.org/atom.xml",
|
29
|
+
:notes => ["Last supported agent for ~> 1.7.0 was 3.18.0.329."]
|
38
30
|
},
|
39
31
|
|
40
32
|
# App servers
|
@@ -86,11 +78,12 @@ module NewRelic
|
|
86
78
|
:rails =>
|
87
79
|
{
|
88
80
|
:type => :web,
|
89
|
-
:supported => ["
|
90
|
-
:deprecated => ["~>2.0.0"],
|
81
|
+
:supported => ["~3.0.0", "~>3.1.0", "~>3.2.0", "~>4.0.0", "~>4.1.0", "~>4.2.0", "~> 5.0.0"],
|
82
|
+
:deprecated => ["~>2.0.0", "~>2.1.0", "~>2.2.0", "~>2.3.0"],
|
91
83
|
:url => "https://rubygems.org/gems/rails",
|
92
84
|
:feed => "https://rubygems.org/gems/rails/versions.atom",
|
93
|
-
:notes => ["Last supported agent for 2.0.
|
85
|
+
:notes => ["Last supported agent for ~>2.1.0, ~>2.2.0, and ~>2.3.0 was 3.18.0.329.",
|
86
|
+
"Last supported agent for 2.0.x was 3.6.8.168."]
|
94
87
|
},
|
95
88
|
:sinatra =>
|
96
89
|
{
|
@@ -864,9 +864,6 @@ module NewRelic
|
|
864
864
|
attributes.merge_custom_attributes(p)
|
865
865
|
end
|
866
866
|
|
867
|
-
alias_method :set_user_attributes, :add_custom_attributes
|
868
|
-
alias_method :add_custom_parameters, :add_custom_attributes
|
869
|
-
|
870
867
|
def recording_web_transaction?
|
871
868
|
web_category?(@category)
|
872
869
|
end
|
@@ -14,8 +14,6 @@ module NewRelic
|
|
14
14
|
|
15
15
|
EMPTY_HASH = {}.freeze
|
16
16
|
|
17
|
-
CAN_BYTESLICE = String.instance_methods.include?(:byteslice)
|
18
|
-
|
19
17
|
def initialize(filter)
|
20
18
|
@filter = filter
|
21
19
|
|
@@ -148,15 +146,8 @@ module NewRelic
|
|
148
146
|
# the end. It'll either remove the one-character-too-many we have, or
|
149
147
|
# peel off the partial, mangled character left by the byteslice.
|
150
148
|
def slice(incoming)
|
151
|
-
|
152
|
-
result = incoming.to_s.byteslice(0, VALUE_LIMIT + 1)
|
153
|
-
else
|
154
|
-
# < 1.9.3 doesn't have byteslice, so we take off bytes instead.
|
155
|
-
result = incoming.to_s.bytes.take(VALUE_LIMIT + 1).pack("C*")
|
156
|
-
end
|
157
|
-
|
149
|
+
result = incoming.to_s.byteslice(0, VALUE_LIMIT + 1)
|
158
150
|
result.chop!
|
159
|
-
result
|
160
151
|
end
|
161
152
|
end
|
162
153
|
end
|
data/lib/new_relic/agent/vm.rb
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
require 'new_relic/language_support'
|
6
6
|
require 'new_relic/agent/vm/mri_vm'
|
7
7
|
require 'new_relic/agent/vm/jruby_vm'
|
8
|
-
require 'new_relic/agent/vm/rubinius_vm'
|
9
8
|
|
10
9
|
module NewRelic
|
11
10
|
module Agent
|
@@ -19,10 +18,8 @@ module NewRelic
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def self.create_vm
|
22
|
-
if NewRelic::LanguageSupport.
|
21
|
+
if NewRelic::LanguageSupport.jruby?
|
23
22
|
JRubyVM.new
|
24
|
-
elsif NewRelic::LanguageSupport.using_engine?('rbx')
|
25
|
-
RubiniusVM.new
|
26
23
|
else
|
27
24
|
MriVM.new
|
28
25
|
end
|
@@ -57,26 +57,18 @@ module NewRelic
|
|
57
57
|
|
58
58
|
def supports?(key)
|
59
59
|
case key
|
60
|
-
when :gc_runs
|
61
|
-
|
60
|
+
when :gc_runs, :total_allocated_object, :heap_live, :heap_free, :thread_count
|
61
|
+
true
|
62
62
|
when :gc_total_time
|
63
63
|
NewRelic::LanguageSupport.gc_profiler_enabled?
|
64
|
-
when :total_allocated_object
|
65
|
-
RUBY_VERSION >= '2.0.0'
|
66
64
|
when :major_gc_count
|
67
65
|
RUBY_VERSION >= '2.1.0'
|
68
66
|
when :minor_gc_count
|
69
67
|
RUBY_VERSION >= '2.1.0'
|
70
|
-
when :heap_live
|
71
|
-
RUBY_VERSION >= '1.9.3'
|
72
|
-
when :heap_free
|
73
|
-
RUBY_VERSION >= '1.9.3'
|
74
68
|
when :method_cache_invalidations
|
75
69
|
RUBY_VERSION >= '2.1.0'
|
76
70
|
when :constant_cache_invalidations
|
77
71
|
RUBY_VERSION >= '2.1.0'
|
78
|
-
when :thread_count
|
79
|
-
true
|
80
72
|
else
|
81
73
|
false
|
82
74
|
end
|
data/lib/new_relic/control.rb
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'yaml'
|
6
|
-
require '
|
6
|
+
require 'new_relic/dependency_detection'
|
7
7
|
require 'new_relic/local_environment'
|
8
8
|
require 'new_relic/language_support'
|
9
9
|
require 'new_relic/helper'
|
10
|
-
require 'new_relic/json_wrapper'
|
11
10
|
|
12
11
|
require 'singleton'
|
13
12
|
require 'erb'
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/rails'
|
6
|
-
require 'new_relic/rack/error_collector'
|
7
6
|
|
8
7
|
module NewRelic
|
9
8
|
class Control
|
@@ -28,7 +27,7 @@ module NewRelic
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def version
|
31
|
-
@rails_version ||=
|
30
|
+
@rails_version ||= Gem::Version.new(::Rails::VERSION::STRING)
|
32
31
|
end
|
33
32
|
|
34
33
|
protected
|
@@ -86,7 +86,7 @@ module NewRelic
|
|
86
86
|
Agent.logger.error("Attempted to start agent in #{env.inspect} environment, but agent was already running in #{@started_in_env.inspect}",
|
87
87
|
"The agent will continue running in #{@started_in_env.inspect}. To alter this, ensure the desired environment is set before the agent starts.")
|
88
88
|
else
|
89
|
-
Agent.logger.info("Starting the New Relic agent in #{env.inspect} environment.",
|
89
|
+
Agent.logger.info("Starting the New Relic agent version #{NewRelic::VERSION::STRING} in #{env.inspect} environment.",
|
90
90
|
"To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the #{env.inspect} section of your newrelic.yml.")
|
91
91
|
end
|
92
92
|
|
data/lib/new_relic/helper.rb
CHANGED
@@ -9,20 +9,13 @@ module NewRelic
|
|
9
9
|
module Helper
|
10
10
|
extend self
|
11
11
|
|
12
|
-
#
|
12
|
+
# Confirm a string is correctly encoded,
|
13
13
|
# If not force the encoding to ASCII-8BIT (binary)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
string.valid_encoding? ? string : string.dup.force_encoding("ASCII-8BIT")
|
20
|
-
end
|
21
|
-
else
|
22
|
-
#noop
|
23
|
-
def correctly_encoded(string)
|
24
|
-
string
|
25
|
-
end
|
14
|
+
def correctly_encoded(string)
|
15
|
+
return string unless string.is_a? String
|
16
|
+
# The .dup here is intentional, since force_encoding mutates the target,
|
17
|
+
# and we don't know who is going to use this string downstream of us.
|
18
|
+
string.valid_encoding? ? string : string.dup.force_encoding(Encoding::ASCII_8BIT)
|
26
19
|
end
|
27
20
|
|
28
21
|
def instance_method_visibility(klass, method_name)
|
@@ -2,158 +2,63 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
|
-
module NewRelic
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
@@forkable = nil
|
17
|
-
def can_fork?
|
18
|
-
# this is expensive to check, so we should only check once
|
19
|
-
return @@forkable if @@forkable != nil
|
20
|
-
|
21
|
-
if Process.respond_to?(:fork)
|
22
|
-
# if this is not 1.9.2 or higher, we have to make sure
|
23
|
-
@@forkable = ::RUBY_VERSION < '1.9.2' ? test_forkability : true
|
24
|
-
else
|
25
|
-
@@forkable = false
|
5
|
+
module NewRelic
|
6
|
+
module LanguageSupport
|
7
|
+
extend self
|
8
|
+
|
9
|
+
@@forkable = nil
|
10
|
+
def can_fork?
|
11
|
+
# this is expensive to check, so we should only check once
|
12
|
+
return @@forkable if @@forkable != nil
|
13
|
+
@@forkable = Process.respond_to?(:fork)
|
26
14
|
end
|
27
15
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def using_engine?(engine)
|
32
|
-
if defined?(::RUBY_ENGINE)
|
33
|
-
::RUBY_ENGINE == engine
|
34
|
-
else
|
35
|
-
engine == 'ruby'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def broken_gc?
|
40
|
-
NewRelic::LanguageSupport.using_version?('1.8.7') &&
|
41
|
-
RUBY_PATCHLEVEL < 348 &&
|
42
|
-
!NewRelic::LanguageSupport.using_engine?('jruby') &&
|
43
|
-
!NewRelic::LanguageSupport.using_engine?('rbx')
|
44
|
-
end
|
45
|
-
|
46
|
-
def with_disabled_gc
|
47
|
-
if defined?(::GC) && ::GC.respond_to?(:disable)
|
48
|
-
val = nil
|
49
|
-
begin
|
50
|
-
::GC.disable
|
51
|
-
val = yield
|
52
|
-
ensure
|
53
|
-
::GC.enable
|
54
|
-
end
|
55
|
-
val
|
56
|
-
else
|
57
|
-
yield
|
16
|
+
def gc_profiler_usable?
|
17
|
+
defined?(::GC::Profiler) && !jruby?
|
58
18
|
end
|
59
|
-
end
|
60
19
|
|
61
|
-
|
62
|
-
|
63
|
-
with_disabled_gc { yield }
|
64
|
-
else
|
65
|
-
yield
|
20
|
+
def gc_profiler_enabled?
|
21
|
+
gc_profiler_usable? && ::GC::Profiler.enabled? && !::NewRelic::Agent.config[:disable_gc_profiler]
|
66
22
|
end
|
67
|
-
end
|
68
23
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
24
|
+
def object_space_usable?
|
25
|
+
if defined?(::JRuby) && JRuby.respond_to?(:runtime)
|
26
|
+
JRuby.runtime.is_object_space_enabled
|
27
|
+
else
|
28
|
+
defined?(::ObjectSpace)
|
29
|
+
end
|
74
30
|
end
|
75
|
-
end
|
76
31
|
|
77
|
-
|
78
|
-
|
79
|
-
true
|
80
|
-
else
|
81
|
-
false
|
32
|
+
def jruby?
|
33
|
+
RUBY_ENGINE == 'jruby'
|
82
34
|
end
|
83
|
-
end
|
84
35
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
103
|
-
end
|
104
|
-
|
105
|
-
def rubinius?
|
106
|
-
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
107
|
-
end
|
108
|
-
|
109
|
-
def ree?
|
110
|
-
defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /Ruby Enterprise Edition/
|
111
|
-
end
|
112
|
-
|
113
|
-
def using_version?(version)
|
114
|
-
numbers = version.split('.')
|
115
|
-
numbers == ::RUBY_VERSION.split('.')[0, numbers.size]
|
116
|
-
end
|
117
|
-
|
118
|
-
def supports_string_encodings?
|
119
|
-
RUBY_VERSION >= '1.9.0'
|
120
|
-
end
|
121
|
-
|
122
|
-
def constantize(const_name)
|
123
|
-
const_name.to_s.sub(/\A::/,'').split('::').inject(Object) do |namespace, name|
|
124
|
-
begin
|
125
|
-
result = namespace.const_get(name)
|
126
|
-
|
127
|
-
# const_get looks up the inheritence chain, so if it's a class
|
128
|
-
# in the constant make sure we found the one in our namespace.
|
129
|
-
#
|
130
|
-
# Can't help if the constant isn't a class...
|
131
|
-
if result.is_a?(Module)
|
132
|
-
expected_name = "#{namespace}::#{name}".gsub(/^Object::/, "")
|
133
|
-
return unless expected_name == result.to_s
|
36
|
+
def constantize(const_name)
|
37
|
+
const_name.to_s.sub(/\A::/,'').split('::').inject(Object) do |namespace, name|
|
38
|
+
begin
|
39
|
+
result = namespace.const_get(name)
|
40
|
+
|
41
|
+
# const_get looks up the inheritence chain, so if it's a class
|
42
|
+
# in the constant make sure we found the one in our namespace.
|
43
|
+
#
|
44
|
+
# Can't help if the constant isn't a class...
|
45
|
+
if result.is_a?(Module)
|
46
|
+
expected_name = "#{namespace}::#{name}".gsub(/^Object::/, "")
|
47
|
+
return unless expected_name == result.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
result
|
51
|
+
rescue NameError
|
52
|
+
nil
|
134
53
|
end
|
135
|
-
|
136
|
-
result
|
137
|
-
rescue NameError
|
138
|
-
nil
|
139
54
|
end
|
140
55
|
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def test_forkability
|
144
|
-
child = Process.fork { exit! }
|
145
|
-
# calling wait here doesn't seem like it should necessary, but it seems to
|
146
|
-
# resolve some weird edge cases with resque forking.
|
147
|
-
Process.wait child
|
148
|
-
true
|
149
|
-
rescue NotImplementedError
|
150
|
-
false
|
151
|
-
end
|
152
56
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
57
|
+
def bundled_gem?(gem_name)
|
58
|
+
defined?(Bundler) && Bundler.rubygems.all_specs.map(&:name).include?(gem_name)
|
59
|
+
rescue => e
|
60
|
+
::NewRelic::Agent.logger.info("Could not determine if third party #{gem_name} gem is installed", e)
|
61
|
+
false
|
62
|
+
end
|
158
63
|
end
|
159
64
|
end
|