newrelic_rpm 9.0.0 → 9.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +6 -16
  4. data/.rubocop_todo.yml +4 -43
  5. data/.simplecov +1 -1
  6. data/CHANGELOG.md +60 -2
  7. data/Gemfile +1 -1
  8. data/Guardfile +7 -7
  9. data/README.md +1 -2
  10. data/Rakefile +8 -8
  11. data/Thorfile +1 -1
  12. data/bin/nrdebug +20 -20
  13. data/init.rb +1 -1
  14. data/lib/new_relic/agent/agent.rb +3 -16
  15. data/lib/new_relic/agent/agent_helpers/connect.rb +4 -9
  16. data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
  17. data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
  18. data/lib/new_relic/agent/agent_helpers/special_startup.rb +2 -2
  19. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
  20. data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
  21. data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
  22. data/lib/new_relic/agent/agent_logger.rb +9 -9
  23. data/lib/new_relic/agent/attribute_filter.rb +2 -2
  24. data/lib/new_relic/agent/attribute_processing.rb +2 -2
  25. data/lib/new_relic/agent/audit_logger.rb +5 -5
  26. data/lib/new_relic/agent/autostart.rb +1 -1
  27. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  28. data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
  29. data/lib/new_relic/agent/commands/thread_profiler_session.rb +5 -5
  30. data/lib/new_relic/agent/configuration/default_source.rb +57 -56
  31. data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
  32. data/lib/new_relic/agent/configuration/high_security_source.rb +3 -3
  33. data/lib/new_relic/agent/configuration/manager.rb +2 -2
  34. data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -10
  35. data/lib/new_relic/agent/configuration/server_source.rb +24 -24
  36. data/lib/new_relic/agent/configuration/yaml_source.rb +4 -4
  37. data/lib/new_relic/agent/connect/request_builder.rb +1 -1
  38. data/lib/new_relic/agent/connect/response_handler.rb +1 -1
  39. data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
  40. data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
  41. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  42. data/lib/new_relic/agent/database/obfuscator.rb +2 -2
  43. data/lib/new_relic/agent/database.rb +4 -4
  44. data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
  45. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
  46. data/lib/new_relic/agent/datastores/redis.rb +6 -6
  47. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +7 -8
  48. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
  49. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
  50. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
  52. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
  53. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
  54. data/lib/new_relic/agent/distributed_tracing.rb +5 -5
  55. data/lib/new_relic/agent/error_collector.rb +35 -7
  56. data/lib/new_relic/agent/error_filter.rb +2 -2
  57. data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
  58. data/lib/new_relic/agent/event_loop.rb +3 -3
  59. data/lib/new_relic/agent/external.rb +1 -1
  60. data/lib/new_relic/agent/harvester.rb +1 -3
  61. data/lib/new_relic/agent/heap.rb +2 -1
  62. data/lib/new_relic/agent/hostname.rb +1 -1
  63. data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
  64. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
  65. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
  66. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
  67. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
  68. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
  69. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
  70. data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
  71. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +5 -2
  72. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
  73. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +3 -3
  74. data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
  75. data/lib/new_relic/agent/instrumentation/active_record.rb +3 -2
  76. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -35
  77. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
  78. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
  79. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
  80. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +3 -3
  81. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +5 -3
  82. data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
  83. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +5 -5
  84. data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
  85. data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
  86. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +1 -1
  87. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
  88. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -1
  89. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +3 -3
  90. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
  91. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -1
  92. data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
  93. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -4
  94. data/lib/new_relic/agent/instrumentation/grape.rb +3 -3
  95. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +2 -1
  96. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +3 -3
  97. data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
  98. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  99. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  100. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +2 -2
  101. data/lib/new_relic/agent/instrumentation/memcache.rb +6 -6
  102. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
  103. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
  104. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +5 -5
  105. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  106. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +1 -1
  107. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -3
  108. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
  109. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +1 -1
  110. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +3 -2
  111. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +7 -7
  113. data/lib/new_relic/agent/instrumentation/rake.rb +2 -2
  114. data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
  115. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -1
  116. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  117. data/lib/new_relic/agent/instrumentation/sequel.rb +4 -4
  118. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
  119. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  120. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +1 -1
  121. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  122. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +6 -5
  123. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
  124. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +2 -1
  125. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -5
  126. data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
  127. data/lib/new_relic/agent/linking_metadata.rb +2 -2
  128. data/lib/new_relic/agent/log_event_aggregator.rb +15 -15
  129. data/lib/new_relic/agent/logging.rb +73 -33
  130. data/lib/new_relic/agent/messaging.rb +7 -5
  131. data/lib/new_relic/agent/method_tracer.rb +6 -6
  132. data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
  133. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -4
  134. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
  135. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  136. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
  137. data/lib/new_relic/agent/new_relic_service.rb +14 -14
  138. data/lib/new_relic/agent/obfuscator.rb +1 -1
  139. data/lib/new_relic/agent/parameter_filtering.rb +6 -6
  140. data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
  141. data/lib/new_relic/agent/pipe_service.rb +5 -3
  142. data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
  143. data/lib/new_relic/agent/sampler.rb +1 -1
  144. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  145. data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
  146. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
  147. data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
  148. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  149. data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
  150. data/lib/new_relic/agent/span_event_primitive.rb +2 -2
  151. data/lib/new_relic/agent/sql_sampler.rb +2 -2
  152. data/lib/new_relic/agent/stats.rb +1 -1
  153. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
  154. data/lib/new_relic/agent/system_info.rb +10 -10
  155. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  156. data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
  157. data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
  158. data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
  159. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  160. data/lib/new_relic/agent/tracer.rb +8 -7
  161. data/lib/new_relic/agent/transaction/abstract_segment.rb +7 -7
  162. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  163. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
  164. data/lib/new_relic/agent/transaction/distributed_tracing.rb +6 -6
  165. data/lib/new_relic/agent/transaction/external_request_segment.rb +11 -11
  166. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
  167. data/lib/new_relic/agent/transaction/request_attributes.rb +2 -2
  168. data/lib/new_relic/agent/transaction/segment.rb +1 -1
  169. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  170. data/lib/new_relic/agent/transaction/trace.rb +1 -1
  171. data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
  172. data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
  173. data/lib/new_relic/agent/transaction/tracing.rb +2 -2
  174. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  175. data/lib/new_relic/agent/transaction.rb +39 -36
  176. data/lib/new_relic/agent/transaction_error_primitive.rb +5 -5
  177. data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
  178. data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
  179. data/lib/new_relic/agent/transaction_sampler.rb +3 -3
  180. data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
  181. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  182. data/lib/new_relic/agent/utilization/azure.rb +3 -3
  183. data/lib/new_relic/agent/utilization/gcp.rb +3 -3
  184. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  185. data/lib/new_relic/agent/utilization/vendor.rb +1 -1
  186. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  187. data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
  188. data/lib/new_relic/agent/worker_loop.rb +1 -1
  189. data/lib/new_relic/agent.rb +78 -16
  190. data/lib/new_relic/cli/command.rb +3 -3
  191. data/lib/new_relic/cli/commands/deployments.rb +26 -25
  192. data/lib/new_relic/cli/commands/install.rb +14 -14
  193. data/lib/new_relic/collection_helper.rb +2 -2
  194. data/lib/new_relic/constants.rb +7 -8
  195. data/lib/new_relic/control/class_methods.rb +3 -3
  196. data/lib/new_relic/control/frameworks/rails.rb +30 -18
  197. data/lib/new_relic/control/instance_methods.rb +5 -5
  198. data/lib/new_relic/control/instrumentation.rb +1 -1
  199. data/lib/new_relic/control/private_instance_methods.rb +1 -1
  200. data/lib/new_relic/dependency_detection.rb +4 -17
  201. data/lib/new_relic/environment_report.rb +4 -4
  202. data/lib/new_relic/helper.rb +2 -1
  203. data/lib/new_relic/language_support.rb +1 -1
  204. data/lib/new_relic/latest_changes.rb +5 -5
  205. data/lib/new_relic/noticed_error.rb +20 -18
  206. data/lib/new_relic/rack/browser_monitoring.rb +20 -16
  207. data/lib/new_relic/recipes/capistrano3.rb +1 -1
  208. data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
  209. data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
  210. data/lib/new_relic/supportability_helper.rb +2 -0
  211. data/lib/new_relic/version.rb +1 -1
  212. data/lib/newrelic_rpm.rb +3 -3
  213. data/lib/sequel/extensions/new_relic_instrumentation.rb +3 -3
  214. data/lib/sequel/plugins/new_relic_instrumentation.rb +1 -1
  215. data/lib/tasks/config.rake +12 -12
  216. data/lib/tasks/coverage_report.rake +3 -3
  217. data/lib/tasks/helpers/format.rb +9 -9
  218. data/lib/tasks/helpers/removers.rb +5 -5
  219. data/lib/tasks/install.rake +4 -4
  220. data/lib/tasks/multiverse.rb +12 -6
  221. data/lib/tasks/tests.rake +6 -6
  222. data/newrelic_rpm.gemspec +13 -13
  223. data/test/agent_helper.rb +25 -24
  224. metadata +2 -2
@@ -29,11 +29,11 @@ module NewRelic
29
29
  def self.instrumentation_value_of(disable_key, prepend_key = nil)
30
30
  proc do
31
31
  if NewRelic::Agent.config[disable_key]
32
- "disabled"
32
+ 'disabled'
33
33
  elsif prepend_key && !NewRelic::Agent.config[prepend_key]
34
- "chain"
34
+ 'chain'
35
35
  else
36
- "auto"
36
+ 'auto'
37
37
  end
38
38
  end
39
39
  end
@@ -47,7 +47,7 @@ module NewRelic
47
47
  # Marks the config option as deprecated in the documentation once generated.
48
48
  # Does not appear in logs.
49
49
  def self.deprecated_description(new_setting, description)
50
- link_ref = new_setting.to_s.tr(".", "-")
50
+ link_ref = new_setting.to_s.tr('.', '-')
51
51
  %{Please see: [#{new_setting}](docs/agents/ruby-agent/configuration/ruby-agent-configuration##{link_ref}). \n\n#{description}}
52
52
  end
53
53
 
@@ -80,34 +80,35 @@ module NewRelic
80
80
  default_settings[:transform] if default_settings
81
81
  end
82
82
 
83
- def self.config_search_paths
83
+ def self.config_search_paths # rubocop:disable Metrics/AbcSize
84
84
  proc {
85
- paths = [
86
- File.join("config", "newrelic.yml"),
87
- File.join("newrelic.yml"),
88
- File.join("config", "newrelic.yml.erb"),
89
- File.join("newrelic.yml.erb")
90
- ]
85
+ yaml = 'newrelic.yml'
86
+ config_yaml = File.join('config', yaml)
87
+ erb = 'newrelic.yml.erb'
88
+ config_erb = File.join('config', erb)
89
+
90
+ paths = [config_yaml, yaml, config_erb, erb]
91
91
 
92
92
  if NewRelic::Control.instance.root
93
- paths << File.join(NewRelic::Control.instance.root, "config", "newrelic.yml")
94
- paths << File.join(NewRelic::Control.instance.root, "newrelic.yml")
95
- paths << File.join(NewRelic::Control.instance.root, "config", "newrelic.yml.erb")
96
- paths << File.join(NewRelic::Control.instance.root, "newrelic.yml.erb")
93
+ paths << File.join(NewRelic::Control.instance.root, config_yaml)
94
+ paths << File.join(NewRelic::Control.instance.root, yaml)
95
+ paths << File.join(NewRelic::Control.instance.root, config_erb)
96
+ paths << File.join(NewRelic::Control.instance.root, erb)
97
97
  end
98
98
 
99
99
  if ENV['HOME']
100
- paths << File.join(ENV['HOME'], ".newrelic", "newrelic.yml")
101
- paths << File.join(ENV['HOME'], "newrelic.yml")
102
- paths << File.join(ENV['HOME'], ".newrelic", "newrelic.yml.erb")
103
- paths << File.join(ENV['HOME'], "newrelic.yml.erb")
100
+ paths << File.join(ENV['HOME'], '.newrelic', yaml)
101
+ paths << File.join(ENV['HOME'], yaml)
102
+ paths << File.join(ENV['HOME'], '.newrelic', erb)
103
+ paths << File.join(ENV['HOME'], erb)
104
104
  end
105
105
 
106
106
  # If we're packaged for warbler, we can tell from GEM_HOME
107
- if ENV["GEM_HOME"] && ENV["GEM_HOME"].end_with?(".jar!")
108
- app_name = File.basename(ENV["GEM_HOME"], ".jar!")
109
- paths << File.join(ENV["GEM_HOME"], app_name, "config", "newrelic.yml")
110
- paths << File.join(ENV["GEM_HOME"], app_name, "config", "newrelic.yml.erb")
107
+ # the following line needs else branch coverage
108
+ if ENV['GEM_HOME'] && ENV['GEM_HOME'].end_with?('.jar!') # rubocop:disable Style/SafeNavigation
109
+ app_name = File.basename(ENV['GEM_HOME'], '.jar!')
110
+ paths << File.join(ENV['GEM_HOME'], app_name, config_yaml)
111
+ paths << File.join(ENV['GEM_HOME'], app_name, config_erb)
111
112
  end
112
113
 
113
114
  paths
@@ -206,11 +207,11 @@ module NewRelic
206
207
  # only used for deployment task
207
208
  proc do
208
209
  api_version = if NewRelic::Agent.config[:api_key].nil? || NewRelic::Agent.config[:api_key].empty?
209
- "rpm"
210
+ 'rpm'
210
211
  else
211
- "api"
212
+ 'api'
212
213
  end
213
- api_region = "eu." if String(NewRelic::Agent.config[:license_key]).start_with?('eu')
214
+ api_region = 'eu.' if String(NewRelic::Agent.config[:license_key]).start_with?('eu')
214
215
 
215
216
  "#{api_version}.#{api_region}newrelic.com"
216
217
  end
@@ -432,7 +433,7 @@ module NewRelic
432
433
  :public => true,
433
434
  :type => Boolean,
434
435
  :allowed_from_server => true,
435
- :description => "Allows newrelic distributed tracing headers to be suppressed on outbound requests."
436
+ :description => 'Allows newrelic distributed tracing headers to be suppressed on outbound requests.'
436
437
  },
437
438
  :force_install_exit_handler => {
438
439
  :default => false,
@@ -959,7 +960,7 @@ module NewRelic
959
960
  :description => 'If `true`, enables an audit log which logs communications with the New Relic [collector](/docs/using-new-relic/welcome-new-relic/get-started/glossary/#collector).'
960
961
  },
961
962
  :'audit_log.endpoints' => {
962
- :default => [".*"],
963
+ :default => ['.*'],
963
964
  :public => true,
964
965
  :type => Array,
965
966
  :allowed_from_server => false,
@@ -1281,10 +1282,10 @@ module NewRelic
1281
1282
  :type => String,
1282
1283
  :allowed_from_server => false,
1283
1284
  :external => :infinite_tracing,
1284
- :description => "Configures the hostname for the trace observer Host. " \
1285
- "When configured, enables tail-based sampling by sending all recorded spans " \
1286
- "to a trace observer for further sampling decisions, irrespective of any usual " \
1287
- "agent sampling decision."
1285
+ :description => 'Configures the hostname for the trace observer Host. ' \
1286
+ 'When configured, enables tail-based sampling by sending all recorded spans ' \
1287
+ 'to a trace observer for further sampling decisions, irrespective of any usual ' \
1288
+ 'agent sampling decision.'
1288
1289
  },
1289
1290
  :'infinite_tracing.trace_observer.port' => {
1290
1291
  :default => 443,
@@ -1292,7 +1293,7 @@ module NewRelic
1292
1293
  :type => Integer,
1293
1294
  :allowed_from_server => false,
1294
1295
  :external => :infinite_tracing,
1295
- :description => "Configures the TCP/IP port for the trace observer Host"
1296
+ :description => 'Configures the TCP/IP port for the trace observer Host'
1296
1297
  },
1297
1298
  # Instrumentation
1298
1299
  :'instrumentation.active_support_logger' => {
@@ -1361,7 +1362,7 @@ module NewRelic
1361
1362
  :type => String,
1362
1363
  :dynamic_name => true,
1363
1364
  :allowed_from_server => false,
1364
- :description => "Controls auto-instrumentation of Excon at start up. May be one of [enabled|disabled]."
1365
+ :description => 'Controls auto-instrumentation of Excon at start up. May be one of [enabled|disabled].'
1365
1366
  },
1366
1367
  :'instrumentation.grape' => {
1367
1368
  :default => 'auto',
@@ -1369,7 +1370,7 @@ module NewRelic
1369
1370
  :type => String,
1370
1371
  :dynamic_name => true,
1371
1372
  :allowed_from_server => false,
1372
- :description => "Controls auto-instrumentation of Grape at start up. May be one of [auto|prepend|chain|disabled]."
1373
+ :description => 'Controls auto-instrumentation of Grape at start up. May be one of [auto|prepend|chain|disabled].'
1373
1374
  },
1374
1375
  :'instrumentation.grpc_client' => {
1375
1376
  :default => instrumentation_value_of(:disable_grpc_client),
@@ -1404,7 +1405,7 @@ module NewRelic
1404
1405
  :type => String,
1405
1406
  :dynamic_name => true,
1406
1407
  :allowed_from_server => false,
1407
- :description => "Controls auto-instrumentation of HTTPClient at start up. May be one of [auto|prepend|chain|disabled]."
1408
+ :description => 'Controls auto-instrumentation of HTTPClient at start up. May be one of [auto|prepend|chain|disabled].'
1408
1409
  },
1409
1410
  :'instrumentation.httprb' => {
1410
1411
  :default => 'auto',
@@ -1457,7 +1458,7 @@ module NewRelic
1457
1458
  :type => String,
1458
1459
  :dynamic_name => true,
1459
1460
  :allowed_from_server => false,
1460
- :description => "Controls auto-instrumentation of Mongo at start up. May be one of [enabled|disabled]."
1461
+ :description => 'Controls auto-instrumentation of Mongo at start up. May be one of [enabled|disabled].'
1461
1462
  },
1462
1463
  :'instrumentation.net_http' => {
1463
1464
  :default => 'auto',
@@ -1466,7 +1467,7 @@ module NewRelic
1466
1467
  :type => String,
1467
1468
  :dynamic_name => true,
1468
1469
  :allowed_from_server => false,
1469
- :description => "Controls auto-instrumentation of Net::HTTP at start up. May be one of [auto|prepend|chain|disabled]."
1470
+ :description => 'Controls auto-instrumentation of Net::HTTP at start up. May be one of [auto|prepend|chain|disabled].'
1470
1471
  },
1471
1472
  :'instrumentation.puma_rack' => {
1472
1473
  :default => value_of(:'instrumentation.rack'),
@@ -1475,9 +1476,9 @@ module NewRelic
1475
1476
  :type => String,
1476
1477
  :dynamic_name => true,
1477
1478
  :allowed_from_server => false,
1478
- :description => "Controls auto-instrumentation of Puma::Rack. When enabled, the agent hooks into the " \
1479
- "`to_app` method in Puma::Rack::Builder to find gems to instrument during " \
1480
- "application startup. May be one of [auto|prepend|chain|disabled]."
1479
+ :description => 'Controls auto-instrumentation of Puma::Rack. When enabled, the agent hooks into the ' \
1480
+ '`to_app` method in Puma::Rack::Builder to find gems to instrument during ' \
1481
+ 'application startup. May be one of [auto|prepend|chain|disabled].'
1481
1482
  },
1482
1483
  :'instrumentation.puma_rack_urlmap' => {
1483
1484
  :default => value_of(:'instrumentation.rack_urlmap'),
@@ -1495,9 +1496,9 @@ module NewRelic
1495
1496
  :type => String,
1496
1497
  :dynamic_name => true,
1497
1498
  :allowed_from_server => false,
1498
- :description => "Controls auto-instrumentation of Rack. When enabled, the agent hooks into the " \
1499
- "`to_app` method in Rack::Builder to find gems to instrument during " \
1500
- "application startup. May be one of [auto|prepend|chain|disabled]."
1499
+ :description => 'Controls auto-instrumentation of Rack. When enabled, the agent hooks into the ' \
1500
+ '`to_app` method in Rack::Builder to find gems to instrument during ' \
1501
+ 'application startup. May be one of [auto|prepend|chain|disabled].'
1501
1502
  },
1502
1503
  :'instrumentation.rack_urlmap' => {
1503
1504
  :default => 'auto',
@@ -1514,7 +1515,7 @@ module NewRelic
1514
1515
  :type => String,
1515
1516
  :dynamic_name => true,
1516
1517
  :allowed_from_server => false,
1517
- :description => "Controls auto-instrumentation of rake at start up. May be one of [auto|prepend|chain|disabled]."
1518
+ :description => 'Controls auto-instrumentation of rake at start up. May be one of [auto|prepend|chain|disabled].'
1518
1519
  },
1519
1520
  :'instrumentation.redis' => {
1520
1521
  :default => 'auto',
@@ -1522,7 +1523,7 @@ module NewRelic
1522
1523
  :type => String,
1523
1524
  :dynamic_name => true,
1524
1525
  :allowed_from_server => false,
1525
- :description => "Controls auto-instrumentation of Redis at start up. May be one of [auto|prepend|chain|disabled]."
1526
+ :description => 'Controls auto-instrumentation of Redis at start up. May be one of [auto|prepend|chain|disabled].'
1526
1527
  },
1527
1528
  :'instrumentation.resque' => {
1528
1529
  :default => 'auto',
@@ -1531,7 +1532,7 @@ module NewRelic
1531
1532
  :type => String,
1532
1533
  :dynamic_name => true,
1533
1534
  :allowed_from_server => false,
1534
- :description => "Controls auto-instrumentation of resque at start up. May be one of [auto|prepend|chain|disabled]."
1535
+ :description => 'Controls auto-instrumentation of resque at start up. May be one of [auto|prepend|chain|disabled].'
1535
1536
  },
1536
1537
  :'instrumentation.sinatra' => {
1537
1538
  :default => 'auto',
@@ -1539,7 +1540,7 @@ module NewRelic
1539
1540
  :type => String,
1540
1541
  :dynamic_name => true,
1541
1542
  :allowed_from_server => false,
1542
- :description => "Controls auto-instrumentation of Sinatra at start up. May be one of [auto|prepend|chain|disabled]."
1543
+ :description => 'Controls auto-instrumentation of Sinatra at start up. May be one of [auto|prepend|chain|disabled].'
1543
1544
  },
1544
1545
  :'instrumentation.thread' => {
1545
1546
  :default => 'auto',
@@ -1547,24 +1548,24 @@ module NewRelic
1547
1548
  :type => String,
1548
1549
  :dynamic_name => true,
1549
1550
  :allowed_from_server => false,
1550
- :description => "Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asynchronous transaction. This does not enable the agent to automatically trace all threads created (see `instrumentation.thread.tracing`). May be one of [auto|prepend|chain|disabled]."
1551
+ :description => 'Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asynchronous transaction. This does not enable the agent to automatically trace all threads created (see `instrumentation.thread.tracing`). May be one of [auto|prepend|chain|disabled].'
1551
1552
  },
1552
1553
  :'instrumentation.thread.tracing' => {
1553
1554
  :default => true,
1554
1555
  :public => true,
1555
1556
  :type => Boolean,
1556
1557
  :allowed_from_server => false,
1557
- :description => "Controls auto-instrumentation of the Thread class at start up to automatically add tracing to all Threads created in the application."
1558
+ :description => 'Controls auto-instrumentation of the Thread class at start up to automatically add tracing to all Threads created in the application.'
1558
1559
  },
1559
1560
  :'thread_ids_enabled' => {
1560
1561
  :default => false,
1561
1562
  :public => false,
1562
1563
  :type => Boolean,
1563
1564
  :allowed_from_server => false,
1564
- :description => "If enabled, will append the current Thread and Fiber object ids onto the segment names of segments created in Threads and concurrent-ruby"
1565
+ :description => 'If enabled, will append the current Thread and Fiber object ids onto the segment names of segments created in Threads and concurrent-ruby'
1565
1566
  },
1566
1567
  :'instrumentation.tilt' => {
1567
- :default => "auto",
1568
+ :default => 'auto',
1568
1569
  :public => true,
1569
1570
  :type => String,
1570
1571
  :dynamic_name => true,
@@ -1578,7 +1579,7 @@ module NewRelic
1578
1579
  :type => String,
1579
1580
  :dynamic_name => true,
1580
1581
  :allowed_from_server => false,
1581
- :description => "Controls auto-instrumentation of Typhoeus at start up. May be one of [auto|prepend|chain|disabled]."
1582
+ :description => 'Controls auto-instrumentation of Typhoeus at start up. May be one of [auto|prepend|chain|disabled].'
1582
1583
  },
1583
1584
  # Message tracer
1584
1585
  :'message_tracer.segment_parameters.enabled' => {
@@ -1709,7 +1710,7 @@ module NewRelic
1709
1710
  :type => Integer,
1710
1711
  :allowed_from_server => false,
1711
1712
  :external => :infinite_tracing,
1712
- :description => "Sets the maximum number of span events to buffer when streaming to the trace observer."
1713
+ :description => 'Sets the maximum number of span events to buffer when streaming to the trace observer.'
1713
1714
  },
1714
1715
  :'span_events.max_samples_stored' => {
1715
1716
  :default => 2000,
@@ -2016,7 +2017,7 @@ module NewRelic
2016
2017
  :public => false,
2017
2018
  :type => String,
2018
2019
  :allowed_from_server => false,
2019
- :description => "URI for the New Relic data collection service."
2020
+ :description => 'URI for the New Relic data collection service.'
2020
2021
  },
2021
2022
  :'infinite_tracing.batching' => {
2022
2023
  :default => true,
@@ -2025,7 +2026,7 @@ module NewRelic
2025
2026
  :allowed_from_server => false,
2026
2027
  :external => :infinite_tracing,
2027
2028
  :description => "If `true` (the default), data sent to the trace observer is batched\ninstead of sending " \
2028
- "each span individually."
2029
+ 'each span individually.'
2029
2030
  },
2030
2031
  :'infinite_tracing.compression_level' => {
2031
2032
  :default => :high,
@@ -94,14 +94,14 @@ module NewRelic
94
94
  elsif type == Array
95
95
  self[config_key] = value.split(/\s*,\s*/)
96
96
  elsif type == NewRelic::Agent::Configuration::Boolean
97
- if value =~ /false|off|no/i
97
+ if /false|off|no/i.match?(value)
98
98
  self[config_key] = false
99
99
  elsif !value.nil?
100
100
  self[config_key] = true
101
101
  end
102
102
  else
103
103
  ::NewRelic::Agent.logger.info("#{environment_key} does not have a corresponding configuration setting (#{config_key} does not exist).")
104
- ::NewRelic::Agent.logger.info("Run `rake newrelic:config:docs` or visit https://newrelic.com/docs/ruby/ruby-agent-configuration to see a list of available configuration settings.")
104
+ ::NewRelic::Agent.logger.info('Run `rake newrelic:config:docs` or visit https://newrelic.com/docs/ruby/ruby-agent-configuration to see a list of available configuration settings.')
105
105
  self[config_key] = value
106
106
  end
107
107
  end
@@ -24,9 +24,9 @@ module NewRelic
24
24
  })
25
25
  end
26
26
 
27
- OFF = "off".freeze
28
- RAW = "raw".freeze
29
- OBFUSCATED = "obfuscated".freeze
27
+ OFF = 'off'.freeze
28
+ RAW = 'raw'.freeze
29
+ OBFUSCATED = 'obfuscated'.freeze
30
30
 
31
31
  SET_TO_OBFUSCATED = [RAW, OBFUSCATED]
32
32
 
@@ -241,8 +241,8 @@ module NewRelic
241
241
  end
242
242
  end
243
243
 
244
- MALFORMED_LABELS_WARNING = "Skipping malformed labels configuration"
245
- PARSING_LABELS_FAILURE = "Failure during parsing labels. Ignoring and carrying on with connect."
244
+ MALFORMED_LABELS_WARNING = 'Skipping malformed labels configuration'
245
+ PARSING_LABELS_FAILURE = 'Failure during parsing labels. Ignoring and carrying on with connect.'
246
246
 
247
247
  MAX_LABEL_COUNT = 64
248
248
  MAX_LABEL_LENGTH = 255
@@ -51,7 +51,7 @@ module NewRelic
51
51
  # permitted by the security policy and is also enabled by the config
52
52
 
53
53
  SECURITY_SETTINGS_MAP = {
54
- "record_sql" => [
54
+ 'record_sql' => [
55
55
  {
56
56
  option: :'transaction_tracer.record_sql',
57
57
  supported: true,
@@ -96,7 +96,7 @@ module NewRelic
96
96
  permitted_fn: nil
97
97
  }
98
98
  ],
99
- "attributes_include" => [
99
+ 'attributes_include' => [
100
100
  {
101
101
  option: :'attributes.include',
102
102
  supported: true,
@@ -147,7 +147,7 @@ module NewRelic
147
147
  permitted_fn: nil
148
148
  }
149
149
  ],
150
- "allow_raw_exception_messages" => [
150
+ 'allow_raw_exception_messages' => [
151
151
  {
152
152
  option: :'strip_exception_messages.enabled',
153
153
  supported: true,
@@ -156,7 +156,7 @@ module NewRelic
156
156
  permitted_fn: nil
157
157
  }
158
158
  ],
159
- "custom_events" => [
159
+ 'custom_events' => [
160
160
  {
161
161
  option: :'custom_insights_events.enabled',
162
162
  supported: true,
@@ -165,7 +165,7 @@ module NewRelic
165
165
  permitted_fn: nil
166
166
  }
167
167
  ],
168
- "custom_parameters" => [
168
+ 'custom_parameters' => [
169
169
  {
170
170
  option: :'custom_attributes.enabled',
171
171
  supported: true,
@@ -174,7 +174,7 @@ module NewRelic
174
174
  permitted_fn: nil
175
175
  }
176
176
  ],
177
- "custom_instrumentation_editor" => [
177
+ 'custom_instrumentation_editor' => [
178
178
  {
179
179
  option: nil,
180
180
  supported: false,
@@ -183,7 +183,7 @@ module NewRelic
183
183
  permitted_fn: nil
184
184
  }
185
185
  ],
186
- "message_parameters" => [
186
+ 'message_parameters' => [
187
187
  {
188
188
  option: :'message_tracer.segment_parameters.enabled',
189
189
  supported: true,
@@ -198,8 +198,8 @@ module NewRelic
198
198
  super(build_overrides(security_policies))
199
199
  end
200
200
 
201
- ENABLED = "enabled".freeze
202
- COLON_COLON = "::".freeze
201
+ ENABLED = 'enabled'.freeze
202
+ COLON_COLON = '::'.freeze
203
203
 
204
204
  def build_overrides(security_policies)
205
205
  security_policies.inject({}) do |settings, (policy_name, policy_settings)|
@@ -222,7 +222,7 @@ module NewRelic
222
222
  settings[policy[:option]] = policy[:disabled_value]
223
223
  NewRelic::Agent.logger.info( \
224
224
  "Setting applied: {#{policy[:option]}: #{policy[:disabled_value]}}. " \
225
- "Source: SecurityPolicySource"
225
+ 'Source: SecurityPolicySource'
226
226
  )
227
227
  end
228
228
  end
@@ -10,27 +10,27 @@ module NewRelic
10
10
  # response, but should still be merged in as config settings to the
11
11
  # main agent configuration.
12
12
  TOP_LEVEL_KEYS = [
13
- "account_id",
14
- "apdex_t",
15
- "application_id",
16
- "beacon",
17
- "browser_key",
18
- "browser_monitoring.debug",
19
- "browser_monitoring.loader",
20
- "browser_monitoring.loader_version",
21
- "cross_process_id",
22
- "data_report_period",
23
- "encoding_key",
24
- "entity_guid",
25
- "error_beacon",
26
- "js_agent_file",
27
- "js_agent_loader",
28
- "max_payload_size_in_bytes",
29
- "primary_application_id",
30
- "sampling_target",
31
- "sampling_target_period_in_seconds",
32
- "trusted_account_ids",
33
- "trusted_account_key"
13
+ 'account_id',
14
+ 'apdex_t',
15
+ 'application_id',
16
+ 'beacon',
17
+ 'browser_key',
18
+ 'browser_monitoring.debug',
19
+ 'browser_monitoring.loader',
20
+ 'browser_monitoring.loader_version',
21
+ 'cross_process_id',
22
+ 'data_report_period',
23
+ 'encoding_key',
24
+ 'entity_guid',
25
+ 'error_beacon',
26
+ 'js_agent_file',
27
+ 'js_agent_loader',
28
+ 'max_payload_size_in_bytes',
29
+ 'primary_application_id',
30
+ 'sampling_target',
31
+ 'sampling_target_period_in_seconds',
32
+ 'trusted_account_ids',
33
+ 'trusted_account_key'
34
34
  ]
35
35
 
36
36
  def initialize(connect_reply, existing_config = {})
@@ -70,7 +70,7 @@ module NewRelic
70
70
 
71
71
  def fix_transaction_threshold(merged_settings)
72
72
  # when value is "apdex_f" remove the config and defer to default
73
- if merged_settings['transaction_tracer.transaction_threshold'].to_s =~ /apdex_f/i
73
+ if /apdex_f/i.match?(merged_settings['transaction_tracer.transaction_threshold'].to_s)
74
74
  merged_settings.delete('transaction_tracer.transaction_threshold')
75
75
  end
76
76
  end
@@ -102,8 +102,8 @@ module NewRelic
102
102
  if event_harvest_config.nil? \
103
103
  || event_harvest_config['harvest_limits'].values.min < 0 \
104
104
  || (event_harvest_config['report_period_ms'] / 1000) <= 0
105
- NewRelic::Agent.logger.warn("Invalid event harvest config found " \
106
- "in connect response; using default event report period.")
105
+ NewRelic::Agent.logger.warn('Invalid event harvest config found ' \
106
+ 'in connect response; using default event report period.')
107
107
  false
108
108
  else
109
109
  true
@@ -84,7 +84,7 @@ module NewRelic
84
84
  # so warn about it since it's very likely to be unintended.
85
85
  NewRelic::Agent.logger.warn(
86
86
  "No configuration file found. Working directory = #{Dir.pwd}",
87
- "Looked in these locations (based on #{based_on}): #{candidate_paths.join(", ")}"
87
+ "Looked in these locations (based on #{based_on}): #{candidate_paths.join(', ')}"
88
88
  )
89
89
  end
90
90
 
@@ -96,7 +96,7 @@ module NewRelic
96
96
  file.gsub!(/^\s*#.*$/, '#')
97
97
  ERB.new(file).result(binding)
98
98
  rescue ScriptError, StandardError => e
99
- log_failure("Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.", e)
99
+ log_failure('Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.', e)
100
100
  nil
101
101
  end
102
102
  end
@@ -124,7 +124,7 @@ module NewRelic
124
124
  config['transaction_tracer']['transaction_threshold'].to_s =~ /apdex_f/i
125
125
  # when value is "apdex_f" remove the config and defer to default
126
126
  config['transaction_tracer'].delete('transaction_threshold')
127
- elsif config['transaction_tracer.transaction_threshold'].to_s =~ /apdex_f/i
127
+ elsif /apdex_f/i.match?(config['transaction_tracer.transaction_threshold'].to_s)
128
128
  config.delete('transaction_tracer.transaction_threshold')
129
129
  end
130
130
  end
@@ -135,7 +135,7 @@ module NewRelic
135
135
  if 'auto' == config[option]
136
136
  config.delete(option)
137
137
  elsif !config[option].nil? && !is_boolean?(config[option])
138
- coerced_value = !!(config[option].to_s =~ /yes|on|true/i)
138
+ coerced_value = config[option].to_s.match?(/yes|on|true/i)
139
139
  if !coerced_value
140
140
  log_failure("Unexpected value (#{config[option]}) for '#{option}' in #{@path}")
141
141
  end
@@ -48,7 +48,7 @@ module NewRelic
48
48
 
49
49
  def environment_metadata
50
50
  env_copy = {}
51
- ENV.keys.each { |k| env_copy[k] = ENV[k] if k =~ /^NEW_RELIC_METADATA_/ }
51
+ ENV.keys.each { |k| env_copy[k] = ENV[k] if /^NEW_RELIC_METADATA_/.match?(k) }
52
52
  env_copy
53
53
  end
54
54
 
@@ -37,7 +37,7 @@ module NewRelic
37
37
 
38
38
  def add_server_side_config(config_data)
39
39
  if config_data['agent_config']
40
- ::NewRelic::Agent.logger.debug("Using config from server")
40
+ ::NewRelic::Agent.logger.debug('Using config from server')
41
41
  end
42
42
 
43
43
  ::NewRelic::Agent.logger.debug("Server provided config: #{config_data.inspect}")
@@ -27,7 +27,7 @@ module NewRelic
27
27
  return unless enabled?
28
28
 
29
29
  type = @type_strings[type]
30
- unless type =~ EVENT_TYPE_REGEX
30
+ unless EVENT_TYPE_REGEX.match?(type)
31
31
  note_dropped_event(type)
32
32
  return false
33
33
  end
@@ -71,9 +71,9 @@ module NewRelic
71
71
 
72
72
  def record_supportability_metrics(total_count, captured_count, dropped_count)
73
73
  engine = NewRelic::Agent.instance.stats_engine
74
- engine.tl_record_supportability_metric_count("Events/Customer/Seen", total_count)
75
- engine.tl_record_supportability_metric_count("Events/Customer/Sent", captured_count)
76
- engine.tl_record_supportability_metric_count("Events/Customer/Dropped", dropped_count)
74
+ engine.tl_record_supportability_metric_count('Events/Customer/Seen', total_count)
75
+ engine.tl_record_supportability_metric_count('Events/Customer/Sent', captured_count)
76
+ engine.tl_record_supportability_metric_count('Events/Customer/Dropped', dropped_count)
77
77
  end
78
78
 
79
79
  def note_dropped_event(type)
@@ -36,7 +36,7 @@ module NewRelic
36
36
  rescue => e
37
37
  begin
38
38
  # guarantees no throw from explain_sql
39
- ::NewRelic::Agent.logger.error("Error getting query plan:", e)
39
+ ::NewRelic::Agent.logger.error('Error getting query plan:', e)
40
40
  nil
41
41
  rescue
42
42
  # double exception. throw up your hands
@@ -49,10 +49,10 @@ module NewRelic
49
49
  }
50
50
 
51
51
  PLACEHOLDER = '?'.freeze
52
- FAILED_TO_OBFUSCATE_MESSAGE = "Failed to obfuscate SQL query - quote characters remained after obfuscation".freeze
52
+ FAILED_TO_OBFUSCATE_MESSAGE = 'Failed to obfuscate SQL query - quote characters remained after obfuscation'.freeze
53
53
 
54
54
  def obfuscate_single_quote_literals(sql)
55
- return sql unless sql =~ COMPONENTS_REGEX_MAP[:single_quotes]
55
+ return sql unless sql&.match?(COMPONENTS_REGEX_MAP[:single_quotes])
56
56
 
57
57
  sql.gsub(COMPONENTS_REGEX_MAP[:single_quotes], PLACEHOLDER)
58
58
  end
@@ -13,8 +13,8 @@ module NewRelic
13
13
 
14
14
  attr_reader :obfuscator
15
15
 
16
- QUERY_TOO_LARGE_MESSAGE = "Query too large (over 16k characters) to safely obfuscate".freeze
17
- ELLIPSIS = "...".freeze
16
+ QUERY_TOO_LARGE_MESSAGE = 'Query too large (over 16k characters) to safely obfuscate'.freeze
17
+ ELLIPSIS = '...'.freeze
18
18
 
19
19
  def initialize
20
20
  reset