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.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -74
  3. data/CHANGELOG.md +77 -0
  4. data/CONTRIBUTING.md +14 -6
  5. data/LICENSE +1 -88
  6. data/lib/new_relic/agent.rb +2 -103
  7. data/lib/new_relic/agent/agent.rb +3 -32
  8. data/lib/new_relic/agent/commands/thread_profiler_session.rb +2 -6
  9. data/lib/new_relic/agent/configuration/default_source.rb +1 -8
  10. data/lib/new_relic/agent/configuration/yaml_source.rb +1 -12
  11. data/lib/new_relic/agent/cross_app_monitor.rb +2 -1
  12. data/lib/new_relic/agent/cross_app_tracing.rb +4 -2
  13. data/lib/new_relic/agent/datastores/mongo.rb +1 -1
  14. data/lib/new_relic/agent/datastores/redis.rb +1 -1
  15. data/lib/new_relic/agent/encoding_normalizer.rb +1 -20
  16. data/lib/new_relic/agent/error_collector.rb +8 -21
  17. data/lib/new_relic/agent/inbound_request_monitor.rb +4 -1
  18. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +14 -30
  19. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +1 -1
  20. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -5
  21. data/lib/new_relic/agent/instrumentation/curb.rb +2 -2
  22. data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
  23. data/lib/new_relic/agent/instrumentation/grape.rb +3 -3
  24. data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -2
  25. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -2
  26. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +2 -2
  27. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +3 -7
  28. data/lib/new_relic/agent/instrumentation/queue_time.rb +13 -15
  29. data/lib/new_relic/agent/instrumentation/rack.rb +4 -50
  30. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  31. data/lib/new_relic/agent/instrumentation/resque.rb +1 -2
  32. data/lib/new_relic/agent/instrumentation/sinatra.rb +0 -1
  33. data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
  34. data/lib/new_relic/agent/javascript_instrumentor.rb +3 -2
  35. data/lib/new_relic/agent/method_tracer.rb +1 -60
  36. data/lib/new_relic/agent/new_relic_service.rb +3 -2
  37. data/lib/new_relic/agent/new_relic_service/encoders.rb +5 -6
  38. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +7 -16
  39. data/lib/new_relic/agent/pipe_channel_manager.rb +1 -3
  40. data/lib/new_relic/agent/pipe_service.rb +1 -3
  41. data/lib/new_relic/agent/rules_engine.rb +2 -17
  42. data/lib/new_relic/agent/stats_engine.rb +0 -2
  43. data/lib/new_relic/agent/stats_engine/metric_stats.rb +0 -48
  44. data/lib/new_relic/agent/supported_versions.rb +12 -19
  45. data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
  46. data/lib/new_relic/agent/transaction.rb +0 -3
  47. data/lib/new_relic/agent/transaction/attributes.rb +1 -10
  48. data/lib/new_relic/agent/vm.rb +1 -4
  49. data/lib/new_relic/agent/vm/jruby_vm.rb +1 -3
  50. data/lib/new_relic/agent/vm/mri_vm.rb +2 -10
  51. data/lib/new_relic/control.rb +1 -2
  52. data/lib/new_relic/control/frameworks/rails.rb +1 -1
  53. data/lib/new_relic/control/frameworks/rails3.rb +1 -2
  54. data/lib/new_relic/control/frameworks/rails4.rb +1 -1
  55. data/lib/new_relic/control/frameworks/rails5.rb +1 -1
  56. data/lib/new_relic/control/instance_methods.rb +1 -1
  57. data/{vendor/gems/dependency_detection-0.0.1.build/lib → lib/new_relic}/dependency_detection.rb +0 -1
  58. data/lib/new_relic/helper.rb +6 -13
  59. data/lib/new_relic/language_support.rb +44 -139
  60. data/lib/new_relic/metric_spec.rb +0 -17
  61. data/lib/new_relic/noticed_error.rb +18 -27
  62. data/lib/new_relic/version.rb +3 -48
  63. data/lib/tasks/versions.rake +7 -5
  64. data/newrelic_rpm.gemspec +1 -16
  65. data/test/agent_helper.rb +4 -2
  66. data/test/environments/lib/environments/runner.rb +5 -14
  67. data/test/environments/norails/Gemfile +0 -8
  68. data/test/environments/rails21/Gemfile +0 -8
  69. data/test/environments/rails21/config/database.yml +1 -1
  70. data/test/environments/rails22/Gemfile +0 -8
  71. data/test/environments/rails22/config/database.yml +1 -1
  72. data/test/environments/rails23/Gemfile +1 -7
  73. data/test/environments/rails23/config/database.yml +1 -1
  74. data/test/environments/rails30/Gemfile +0 -1
  75. data/test/environments/rails30/config/database.yml +1 -1
  76. data/test/environments/rails31/Gemfile +0 -3
  77. data/test/environments/rails31/config/database.yml +1 -1
  78. data/test/environments/rails32/Gemfile +0 -3
  79. data/test/environments/rails32/config/database.yml +1 -1
  80. data/test/environments/rails40/Gemfile +0 -26
  81. data/test/environments/rails40/config/database.yml +1 -1
  82. data/test/environments/rails41/Gemfile +0 -18
  83. data/test/environments/rails41/config/database.yml +1 -1
  84. data/test/environments/rails42/Gemfile +0 -22
  85. data/test/environments/rails42/config/database.yml +1 -1
  86. data/test/environments/rails50/Gemfile +0 -13
  87. data/test/environments/rails50/config/database.yml +1 -1
  88. data/test/helpers/logging.rb +37 -0
  89. data/test/helpers/minitest.rb +50 -0
  90. data/test/helpers/misc.rb +87 -0
  91. data/test/helpers/transaction_sample.rb +44 -0
  92. data/test/multiverse/lib/multiverse/suite.rb +6 -91
  93. data/test/multiverse/script/runner +1 -1
  94. data/test/multiverse/suites/active_record/Envfile +1 -28
  95. data/test/multiverse/suites/active_record/active_record_test.rb +6 -6
  96. data/test/multiverse/suites/active_record/config/database.rb +2 -3
  97. data/test/multiverse/suites/active_record/config/database.yml +0 -2
  98. data/test/multiverse/suites/activemerchant/Envfile +4 -18
  99. data/test/multiverse/suites/agent_only/encoding_handling_test.rb +7 -15
  100. data/test/multiverse/suites/agent_only/error_events_test.rb +1 -7
  101. data/test/multiverse/suites/agent_only/harvest_timestamps_test.rb +4 -20
  102. data/test/multiverse/suites/agent_only/labels_test.rb +1 -1
  103. data/test/multiverse/suites/agent_only/marshaling_test.rb +5 -10
  104. data/test/multiverse/suites/agent_only/script/public_api_when_disabled.rb +0 -11
  105. data/test/multiverse/suites/agent_only/start_up_test.rb +3 -3
  106. data/test/multiverse/suites/agent_only/synthetics_test.rb +1 -1
  107. data/test/multiverse/suites/agent_only/thread_profiling_test.rb +0 -3
  108. data/test/multiverse/suites/agent_only/xray_sessions_test.rb +0 -3
  109. data/test/multiverse/suites/capistrano/Envfile +2 -4
  110. data/test/multiverse/suites/capistrano2/Envfile +0 -4
  111. data/test/multiverse/suites/curb/Envfile +3 -7
  112. data/test/multiverse/suites/datamapper/Envfile +2 -2
  113. data/test/multiverse/suites/datamapper/datamapper_test.rb +2 -2
  114. data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +0 -1
  115. data/test/multiverse/suites/delayed_job/Envfile +28 -41
  116. data/test/multiverse/suites/excon/Envfile +0 -3
  117. data/test/multiverse/suites/grape/Envfile +0 -4
  118. data/test/multiverse/suites/grape/grape_versioning_test.rb +2 -2
  119. data/test/multiverse/suites/grape/grape_versioning_test_api.rb +2 -2
  120. data/test/multiverse/suites/json/Envfile +1 -9
  121. data/test/multiverse/suites/marshalling/Envfile +0 -9
  122. data/test/multiverse/suites/memcached/Envfile +5 -23
  123. data/test/multiverse/suites/mongo/Envfile +9 -11
  124. data/test/multiverse/suites/padrino/Envfile +0 -6
  125. data/test/multiverse/suites/rack/http_response_code_test.rb +0 -1
  126. data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +5 -10
  127. data/test/multiverse/suites/rack/rack_cascade_test.rb +0 -1
  128. data/test/multiverse/suites/rack/rack_env_mutation_test.rb +0 -1
  129. data/test/multiverse/suites/rack/response_content_type_test.rb +0 -1
  130. data/test/multiverse/suites/rails/Envfile +1 -19
  131. data/test/multiverse/suites/rails/activejob_test.rb +1 -2
  132. data/test/multiverse/suites/rails/error_tracing_test.rb +0 -13
  133. data/test/multiverse/suites/rails/gc_instrumentation_test.rb +12 -32
  134. data/test/multiverse/suites/rake/Envfile +15 -22
  135. data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
  136. data/test/multiverse/suites/sequel/database.rb +1 -4
  137. data/test/multiverse/suites/sidekiq/Envfile +13 -23
  138. data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +3 -3
  139. data/test/multiverse/suites/typhoeus/Envfile +0 -19
  140. data/test/multiverse/suites/typhoeus/typhoeus_test.rb +3 -3
  141. data/test/multiverse/suites/yajl/Envfile +5 -0
  142. data/test/multiverse/suites/yajl/yajl_test.rb +1 -3
  143. data/test/new_relic/agent/agent/start_test.rb +3 -3
  144. data/test/new_relic/agent/agent_logger_test.rb +2 -2
  145. data/test/new_relic/agent/agent_test.rb +2 -2
  146. data/test/new_relic/agent/attribute_processing_test.rb +3 -4
  147. data/test/new_relic/agent/audit_logger_test.rb +4 -6
  148. data/test/new_relic/agent/aws_info_test.rb +17 -1
  149. data/test/new_relic/agent/busy_calculator_test.rb +14 -16
  150. data/test/new_relic/agent/configuration/manager_test.rb +1 -7
  151. data/test/new_relic/agent/cross_app_monitor_test.rb +1 -1
  152. data/test/new_relic/agent/database_test.rb +2 -10
  153. data/test/new_relic/agent/datastores/mongo/event_formatter_test.rb +90 -93
  154. data/test/new_relic/agent/datastores/redis_test.rb +14 -16
  155. data/test/new_relic/agent/encoding_normalizer_test.rb +38 -40
  156. data/test/new_relic/agent/error_collector_test.rb +16 -49
  157. data/test/new_relic/agent/instrumentation/active_record_helper_test.rb +0 -6
  158. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +1 -1
  159. data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +101 -103
  160. data/test/new_relic/agent/instrumentation/rack_test.rb +11 -14
  161. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +0 -10
  162. data/test/new_relic/agent/javascript_instrumentor_test.rb +2 -2
  163. data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +0 -10
  164. data/test/new_relic/agent/method_tracer_test.rb +35 -76
  165. data/test/new_relic/agent/new_relic_service_test.rb +86 -102
  166. data/test/new_relic/agent/pipe_channel_manager_test.rb +4 -9
  167. data/test/new_relic/agent/pipe_service_test.rb +2 -3
  168. data/test/new_relic/agent/rpm_agent_test.rb +0 -4
  169. data/test/new_relic/agent/sampled_buffer_test.rb +2 -2
  170. data/test/new_relic/agent/samplers/cpu_sampler_test.rb +28 -0
  171. data/test/new_relic/agent/samplers/memory_sampler_test.rb +66 -0
  172. data/test/new_relic/agent/sized_buffer_test.rb +1 -1
  173. data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +2 -14
  174. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +44 -66
  175. data/test/new_relic/agent/stats_test.rb +6 -8
  176. data/test/new_relic/agent/synthetics_event_buffer_test.rb +1 -1
  177. data/test/new_relic/agent/transaction/attributes_test.rb +4 -12
  178. data/test/new_relic/agent/transaction_test.rb +2 -10
  179. data/test/new_relic/agent/utilization_data_test.rb +17 -1
  180. data/test/new_relic/agent/vm/mri_vm_test.rb +5 -7
  181. data/test/new_relic/agent_test.rb +0 -43
  182. data/test/new_relic/coerce_test.rb +1 -3
  183. data/test/new_relic/fake_collector.rb +3 -3
  184. data/test/new_relic/fake_external_server.rb +1 -1
  185. data/test/new_relic/fake_server.rb +1 -1
  186. data/test/new_relic/http_client_test_cases.rb +3 -3
  187. data/test/new_relic/language_support_test.rb +6 -12
  188. data/test/new_relic/latest_changes_test.rb +0 -11
  189. data/test/new_relic/license_test.rb +3 -8
  190. data/test/new_relic/multiverse_helpers.rb +1 -1
  191. data/test/new_relic/noticed_error_test.rb +11 -7
  192. data/test/new_relic/rack/browser_monitoring_test.rb +1 -3
  193. data/test/nullverse/nullverse_helper.rb +1 -1
  194. data/test/performance/lib/performance.rb +1 -1
  195. data/test/performance/lib/performance/instrumentation/gc_stats.rb +4 -6
  196. data/test/performance/lib/performance/instrumentation/perf_tools.rb +1 -1
  197. data/test/performance/lib/performance/instrumentation/stackprof.rb +1 -1
  198. data/test/performance/lib/performance/platform.rb +1 -8
  199. data/test/performance/script/runner +1 -3
  200. data/test/performance/suites/active_record.rb +3 -24
  201. data/test/test_helper.rb +9 -216
  202. metadata +9 -45
  203. data/lib/conditional_vendored_dependency_detection.rb +0 -7
  204. data/lib/new_relic/agent/hash_extensions.rb +0 -41
  205. data/lib/new_relic/agent/instrumentation/metric_frame.rb +0 -39
  206. data/lib/new_relic/agent/instrumentation/rails/errors.rb +0 -51
  207. data/lib/new_relic/agent/instrumentation/rails3/errors.rb +0 -47
  208. data/lib/new_relic/agent/instrumentation/rails4/errors.rb +0 -46
  209. data/lib/new_relic/agent/stats_engine/samplers.rb +0 -22
  210. data/lib/new_relic/agent/vm/rubinius_vm.rb +0 -140
  211. data/lib/new_relic/json_wrapper.rb +0 -78
  212. data/lib/new_relic/okjson.rb +0 -602
  213. data/lib/new_relic/rack/error_collector.rb +0 -27
  214. data/lib/new_relic/timer_lib.rb +0 -31
  215. data/test/helpers/runtime_detection.rb +0 -17
  216. data/test/multiverse/suites/no_json/Envfile +0 -12
  217. data/test/multiverse/suites/no_json/config/newrelic.yml +0 -27
  218. data/test/multiverse/suites/no_json/marshal_config_test.rb +0 -22
  219. data/test/new_relic/agent/hash_extensions_test.rb +0 -59
  220. data/test/new_relic/agent/instrumentation/metric_frame_test.rb +0 -22
  221. data/test/new_relic/agent/stats_engine/samplers_test.rb +0 -98
  222. data/test/new_relic/agent/vm/rubinius_vm_test.rb +0 -69
  223. data/test/new_relic/json_wrapper_test.rb +0 -32
  224. data/test/new_relic/rack/deferred_instrumentation_test.rb +0 -33
  225. data/test/new_relic/rack/error_collector_test.rb +0 -83
  226. data/test/new_relic/version_number_test.rb +0 -101
  227. data/test/script/before_install/revert_rubygems.sh +0 -15
  228. data/test/script/before_install/update_bundler.sh +0 -12
  229. 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
- NewRelic::LanguageSupport.with_cautious_gc do
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)
@@ -71,9 +71,7 @@ module NewRelic
71
71
  private
72
72
 
73
73
  def marshal_payload(data)
74
- NewRelic::LanguageSupport.with_cautious_gc do
75
- Marshal.dump(data)
76
- end
74
+ Marshal.dump(data)
77
75
  end
78
76
 
79
77
  def write_to_pipe(endpoint, 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
- if NewRelic::LanguageSupport.uniq_accepts_block?
54
- def self.reject_rules_with_duplicate_prefixes!(rules)
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 => ["1.8.7", "1.9.2", "1.9.3", "2.0.0", "~> 2.1.0", "~> 2.2.0", "~> 2.3.0"],
15
- :experimental=> ["2.4.0-preview3"],
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
- "1.8.7 includes support for Ruby Enterprise Edition (REE).",
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 => ["~> 1.7.0", "~> 9.0", "~> 9.1"],
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 => ["~>2.1.0", "~>2.2.0", "~>2.3.0", "~3.0.0", "~>3.1.0", "~>3.2.0", "~>4.0.0", "~>4.1.0", "~>4.2.0", "~> 5.0.0"],
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.x was 3.6.8.168"]
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
  {
@@ -9,7 +9,7 @@ module NewRelic
9
9
  ALL_TRANSACTIONS = "**ALL**".freeze
10
10
 
11
11
  def self.is_supported?
12
- RUBY_VERSION >= "1.9.2" && !is_resque?
12
+ !is_resque?
13
13
  end
14
14
 
15
15
  # Because of Resque's forking, we don't poll thread backtraces for it.
@@ -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
- if CAN_BYTESLICE
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
@@ -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.using_engine?('jruby')
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
@@ -26,9 +26,7 @@ module NewRelic
26
26
 
27
27
  def supports?(key)
28
28
  case key
29
- when :gc_runs
30
- RUBY_VERSION >= "1.9.2"
31
- when :thread_count
29
+ when :gc_runs, :thread_count
32
30
  true
33
31
  else
34
32
  false
@@ -57,26 +57,18 @@ module NewRelic
57
57
 
58
58
  def supports?(key)
59
59
  case key
60
- when :gc_runs
61
- RUBY_VERSION >= '1.9.2'
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
@@ -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 'conditional_vendored_dependency_detection'
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'
@@ -115,7 +115,7 @@ module NewRelic
115
115
  end
116
116
 
117
117
  def rails_version
118
- @rails_version ||= NewRelic::VersionNumber.new(::Rails::VERSION::STRING)
118
+ @rails_version ||= Gem::Version.new(::Rails::VERSION::STRING)
119
119
  end
120
120
 
121
121
  protected
@@ -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 ||= NewRelic::VersionNumber.new(::Rails::VERSION::STRING)
30
+ @rails_version ||= Gem::Version.new(::Rails::VERSION::STRING)
32
31
  end
33
32
 
34
33
  protected
@@ -3,7 +3,7 @@
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
5
  require 'new_relic/control/frameworks/rails3'
6
- require 'new_relic/rack/error_collector'
6
+
7
7
  module NewRelic
8
8
  class Control
9
9
  module Frameworks
@@ -3,7 +3,7 @@
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
5
  require 'new_relic/control/frameworks/rails4'
6
- require 'new_relic/rack/error_collector'
6
+
7
7
  module NewRelic
8
8
  class Control
9
9
  module Frameworks
@@ -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
 
@@ -2,7 +2,6 @@
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
- require 'dependency_detection/version'
6
5
  module DependencyDetection
7
6
 
8
7
  module_function
@@ -9,20 +9,13 @@ module NewRelic
9
9
  module Helper
10
10
  extend self
11
11
 
12
- # confirm a string is correctly encoded (in >= 1.9)
12
+ # Confirm a string is correctly encoded,
13
13
  # If not force the encoding to ASCII-8BIT (binary)
14
- if NewRelic::LanguageSupport.supports_string_encodings?
15
- def correctly_encoded(string)
16
- return string unless string.is_a? String
17
- # The .dup here is intentional, since force_encoding mutates the target,
18
- # and we don't know who is going to use this string downstream of us.
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::LanguageSupport
6
- extend self
7
-
8
- RUBY_VERSION_192 = '1.9.2'.freeze
9
-
10
- # need to use syck rather than psych when possible
11
- def needs_syck?
12
- !NewRelic::LanguageSupport.using_engine?('jruby') &&
13
- NewRelic::LanguageSupport.using_version?('1.9.2')
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
- @@forkable
29
- end
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
- def with_cautious_gc
62
- if broken_gc?
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
- def gc_profiler_usable?
70
- if defined?(::GC::Profiler) && !jruby?
71
- true
72
- else
73
- false
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
- def gc_profiler_enabled?
78
- if gc_profiler_usable? && ::GC::Profiler.enabled? && !::NewRelic::Agent.config[:disable_gc_profiler]
79
- true
80
- else
81
- false
32
+ def jruby?
33
+ RUBY_ENGINE == 'jruby'
82
34
  end
83
- end
84
35
 
85
- def object_space_usable?
86
- if defined?(::JRuby) && JRuby.respond_to?(:runtime)
87
- JRuby.runtime.is_object_space_enabled
88
- elsif defined?(::ObjectSpace) && !rubinius?
89
- true
90
- else
91
- false
92
- end
93
- end
94
-
95
- if ::RUBY_VERSION >= RUBY_VERSION_192
96
- def uniq_accepts_block?; true; end
97
- else
98
- def uniq_accepts_block?; false; end
99
- end
100
-
101
- def jruby?
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
- def bundled_gem?(gem_name)
154
- defined?(Bundler) && Bundler.rubygems.all_specs.map(&:name).include?(gem_name)
155
- rescue => e
156
- ::NewRelic::Agent.logger.info("Could not determine if third party #{gem_name} gem is installed", e)
157
- false
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