newrelic_rpm 9.0.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +7 -81
  4. data/.rubocop_todo.yml +4 -43
  5. data/.simplecov +2 -1
  6. data/Brewfile +1 -0
  7. data/CHANGELOG.md +74 -2
  8. data/Gemfile +1 -1
  9. data/Guardfile +8 -7
  10. data/README.md +1 -2
  11. data/Rakefile +8 -8
  12. data/Thorfile +1 -1
  13. data/bin/newrelic +1 -0
  14. data/bin/newrelic_cmd +1 -0
  15. data/bin/nrdebug +20 -20
  16. data/init.rb +1 -1
  17. data/lib/new_relic/agent/agent.rb +3 -16
  18. data/lib/new_relic/agent/agent_helpers/connect.rb +4 -9
  19. data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
  20. data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
  21. data/lib/new_relic/agent/agent_helpers/special_startup.rb +2 -2
  22. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
  23. data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
  24. data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
  25. data/lib/new_relic/agent/agent_logger.rb +9 -9
  26. data/lib/new_relic/agent/attribute_filter.rb +2 -2
  27. data/lib/new_relic/agent/attribute_processing.rb +2 -2
  28. data/lib/new_relic/agent/audit_logger.rb +5 -5
  29. data/lib/new_relic/agent/autostart.rb +1 -1
  30. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  31. data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
  32. data/lib/new_relic/agent/commands/thread_profiler_session.rb +5 -5
  33. data/lib/new_relic/agent/configuration/default_source.rb +57 -80
  34. data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
  35. data/lib/new_relic/agent/configuration/high_security_source.rb +3 -3
  36. data/lib/new_relic/agent/configuration/manager.rb +2 -2
  37. data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -10
  38. data/lib/new_relic/agent/configuration/server_source.rb +24 -24
  39. data/lib/new_relic/agent/configuration/yaml_source.rb +4 -4
  40. data/lib/new_relic/agent/connect/request_builder.rb +1 -1
  41. data/lib/new_relic/agent/connect/response_handler.rb +1 -1
  42. data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
  43. data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
  44. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
  45. data/lib/new_relic/agent/database/obfuscator.rb +2 -2
  46. data/lib/new_relic/agent/database.rb +4 -4
  47. data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
  48. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
  49. data/lib/new_relic/agent/datastores/redis.rb +6 -6
  50. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +7 -8
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
  52. data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
  53. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
  54. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
  55. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
  56. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
  57. data/lib/new_relic/agent/distributed_tracing.rb +5 -5
  58. data/lib/new_relic/agent/error_collector.rb +35 -7
  59. data/lib/new_relic/agent/error_filter.rb +2 -2
  60. data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
  61. data/lib/new_relic/agent/event_loop.rb +3 -3
  62. data/lib/new_relic/agent/external.rb +1 -1
  63. data/lib/new_relic/agent/harvester.rb +1 -3
  64. data/lib/new_relic/agent/heap.rb +2 -1
  65. data/lib/new_relic/agent/hostname.rb +1 -1
  66. data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
  67. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
  68. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
  69. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
  70. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
  71. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
  72. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
  73. data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
  74. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +5 -2
  75. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
  76. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +3 -3
  77. data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
  78. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  79. data/lib/new_relic/agent/instrumentation/active_record.rb +3 -2
  80. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -35
  81. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
  82. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
  83. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
  84. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  85. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +3 -3
  86. data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
  87. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +5 -3
  88. data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
  89. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +5 -5
  90. data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
  91. data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
  92. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
  93. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +1 -1
  94. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
  95. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +2 -2
  96. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +4 -3
  97. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +2 -2
  98. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -1
  99. data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
  100. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
  101. data/lib/new_relic/agent/instrumentation/fiber.rb +1 -1
  102. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -4
  103. data/lib/new_relic/agent/instrumentation/grape.rb +3 -3
  104. data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
  105. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +3 -2
  106. data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
  107. data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
  108. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +4 -4
  109. data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
  110. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  111. data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
  113. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  114. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
  115. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +2 -2
  116. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
  117. data/lib/new_relic/agent/instrumentation/memcache.rb +8 -8
  118. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
  119. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
  120. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +6 -6
  121. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  122. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +1 -1
  123. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -3
  124. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
  125. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +1 -1
  126. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +3 -2
  127. data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
  128. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +7 -7
  129. data/lib/new_relic/agent/instrumentation/rake.rb +2 -2
  130. data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
  131. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -1
  132. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  133. data/lib/new_relic/agent/instrumentation/sequel.rb +4 -4
  134. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
  135. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  136. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +1 -1
  137. data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -0
  138. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  139. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +6 -5
  140. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +2 -1
  142. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -5
  143. data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
  144. data/lib/new_relic/agent/linking_metadata.rb +2 -2
  145. data/lib/new_relic/agent/log_event_aggregator.rb +15 -15
  146. data/lib/new_relic/agent/logging.rb +73 -33
  147. data/lib/new_relic/agent/messaging.rb +7 -5
  148. data/lib/new_relic/agent/method_tracer.rb +7 -7
  149. data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
  150. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -4
  151. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
  152. data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
  153. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
  154. data/lib/new_relic/agent/new_relic_service.rb +14 -15
  155. data/lib/new_relic/agent/obfuscator.rb +1 -1
  156. data/lib/new_relic/agent/parameter_filtering.rb +6 -6
  157. data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
  158. data/lib/new_relic/agent/pipe_service.rb +5 -3
  159. data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
  160. data/lib/new_relic/agent/sampler.rb +2 -1
  161. data/lib/new_relic/agent/sampler_collection.rb +1 -1
  162. data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
  163. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
  164. data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
  165. data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
  166. data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
  167. data/lib/new_relic/agent/span_event_primitive.rb +2 -2
  168. data/lib/new_relic/agent/sql_sampler.rb +2 -2
  169. data/lib/new_relic/agent/stats.rb +1 -1
  170. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
  171. data/lib/new_relic/agent/system_info.rb +10 -10
  172. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  173. data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
  174. data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
  175. data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
  176. data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
  177. data/lib/new_relic/agent/tracer.rb +8 -7
  178. data/lib/new_relic/agent/transaction/abstract_segment.rb +52 -46
  179. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  180. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
  181. data/lib/new_relic/agent/transaction/distributed_tracing.rb +13 -14
  182. data/lib/new_relic/agent/transaction/external_request_segment.rb +11 -11
  183. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
  184. data/lib/new_relic/agent/transaction/request_attributes.rb +2 -2
  185. data/lib/new_relic/agent/transaction/segment.rb +1 -1
  186. data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
  187. data/lib/new_relic/agent/transaction/trace.rb +1 -1
  188. data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
  189. data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
  190. data/lib/new_relic/agent/transaction/tracing.rb +2 -2
  191. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
  192. data/lib/new_relic/agent/transaction.rb +39 -36
  193. data/lib/new_relic/agent/transaction_error_primitive.rb +5 -5
  194. data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
  195. data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
  196. data/lib/new_relic/agent/transaction_sampler.rb +3 -3
  197. data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
  198. data/lib/new_relic/agent/utilization/aws.rb +1 -1
  199. data/lib/new_relic/agent/utilization/azure.rb +3 -3
  200. data/lib/new_relic/agent/utilization/gcp.rb +3 -3
  201. data/lib/new_relic/agent/utilization/pcf.rb +1 -1
  202. data/lib/new_relic/agent/utilization/vendor.rb +1 -1
  203. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  204. data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
  205. data/lib/new_relic/agent/worker_loop.rb +1 -1
  206. data/lib/new_relic/agent.rb +78 -16
  207. data/lib/new_relic/cli/command.rb +3 -3
  208. data/lib/new_relic/cli/commands/deployments.rb +26 -25
  209. data/lib/new_relic/cli/commands/install.rb +14 -14
  210. data/lib/new_relic/collection_helper.rb +2 -2
  211. data/lib/new_relic/constants.rb +7 -8
  212. data/lib/new_relic/control/class_methods.rb +3 -3
  213. data/lib/new_relic/control/frameworks/rails.rb +30 -18
  214. data/lib/new_relic/control/instance_methods.rb +5 -5
  215. data/lib/new_relic/control/instrumentation.rb +1 -1
  216. data/lib/new_relic/control/private_instance_methods.rb +1 -1
  217. data/lib/new_relic/dependency_detection.rb +4 -17
  218. data/lib/new_relic/environment_report.rb +4 -4
  219. data/lib/new_relic/helper.rb +2 -1
  220. data/lib/new_relic/language_support.rb +1 -1
  221. data/lib/new_relic/latest_changes.rb +5 -5
  222. data/lib/new_relic/noticed_error.rb +20 -18
  223. data/lib/new_relic/rack/browser_monitoring.rb +20 -16
  224. data/lib/new_relic/recipes/capistrano3.rb +1 -1
  225. data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
  226. data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
  227. data/lib/new_relic/supportability_helper.rb +2 -0
  228. data/lib/new_relic/version.rb +1 -1
  229. data/lib/newrelic_rpm.rb +3 -3
  230. data/lib/sequel/extensions/new_relic_instrumentation.rb +3 -3
  231. data/lib/sequel/plugins/new_relic_instrumentation.rb +1 -1
  232. data/lib/tasks/config.rake +12 -12
  233. data/lib/tasks/coverage_report.rake +4 -4
  234. data/lib/tasks/helpers/format.rb +9 -9
  235. data/lib/tasks/helpers/removers.rb +5 -5
  236. data/lib/tasks/install.rake +4 -4
  237. data/lib/tasks/instrumentation_generator/instrumentation.thor +8 -8
  238. data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
  239. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
  240. data/lib/tasks/multiverse.rb +13 -6
  241. data/lib/tasks/newrelic.rb +1 -0
  242. data/lib/tasks/tests.rake +6 -6
  243. data/newrelic.yml +3 -3
  244. data/newrelic_rpm.gemspec +13 -13
  245. data/test/agent_helper.rb +25 -24
  246. metadata +73 -4
  247. data/lib/new_relic/agent/range_extensions.rb +0 -27
@@ -25,12 +25,12 @@ module NewRelic
25
25
  end
26
26
 
27
27
  def handle_stop_command(agent_command)
28
- report_data = agent_command.arguments.fetch("report_data", true)
28
+ report_data = agent_command.arguments.fetch('report_data', true)
29
29
  stop(report_data)
30
30
  end
31
31
 
32
32
  def start(agent_command)
33
- NewRelic::Agent.logger.debug("Starting Thread Profiler.")
33
+ NewRelic::Agent.logger.debug('Starting Thread Profiler.')
34
34
  profile = @backtrace_service.subscribe(
35
35
  NewRelic::Agent::Threading::BacktraceService::ALL_TRANSACTIONS,
36
36
  agent_command.arguments
@@ -43,7 +43,7 @@ module NewRelic
43
43
  def stop(report_data)
44
44
  return unless running?
45
45
 
46
- NewRelic::Agent.logger.debug("Stopping Thread Profiler.")
46
+ NewRelic::Agent.logger.debug('Stopping Thread Profiler.')
47
47
  @finished_profile = @backtrace_service.harvest(NewRelic::Agent::Threading::BacktraceService::ALL_TRANSACTIONS)
48
48
  @backtrace_service.unsubscribe(NewRelic::Agent::Threading::BacktraceService::ALL_TRANSACTIONS)
49
49
  @finished_profile = nil if !report_data
@@ -51,7 +51,7 @@ module NewRelic
51
51
 
52
52
  def harvest
53
53
  NewRelic::Agent.logger.debug(
54
- "Harvesting from Thread Profiler #{@finished_profile.to_log_description unless @finished_profile.nil?}"
54
+ "Harvesting from Thread Profiler #{@finished_profile&.to_log_description}"
55
55
  )
56
56
  profile = @finished_profile
57
57
  @backtrace_service.profile_agent_code = false
@@ -102,7 +102,7 @@ module NewRelic
102
102
  end
103
103
 
104
104
  def raise_already_started_error
105
- msg = "Profile already in progress. Ignoring agent command to start another."
105
+ msg = 'Profile already in progress. Ignoring agent command to start another.'
106
106
  raise_command_error(msg)
107
107
  end
108
108
  end
@@ -14,30 +14,6 @@ module NewRelic
14
14
  end
15
15
  end
16
16
 
17
- # Combines potentially two properties into one.
18
- # Given the example:
19
- # :disable_net_http and :prepend_net_instrumentation
20
- # if :disable_net_http is true, then returned value is "disabled"
21
- # if :prepend_net_instrumentation is false, then returned value is "chain"
22
- # otherwise, "auto" is returned.
23
- #
24
- # Intent is:
25
- # - if user sets disable_xxx property, then don't instrument
26
- # - if user set prepend to `false` then we use method_alias chaining
27
- # - auto, when returned means, try to use prepend unless conflicting gems discovered
28
- #
29
- def self.instrumentation_value_of(disable_key, prepend_key = nil)
30
- proc do
31
- if NewRelic::Agent.config[disable_key]
32
- "disabled"
33
- elsif prepend_key && !NewRelic::Agent.config[prepend_key]
34
- "chain"
35
- else
36
- "auto"
37
- end
38
- end
39
- end
40
-
41
17
  def self.instrumentation_value_from_boolean(key)
42
18
  proc do
43
19
  NewRelic::Agent.config[key] ? 'auto' : 'disabled'
@@ -47,7 +23,7 @@ module NewRelic
47
23
  # Marks the config option as deprecated in the documentation once generated.
48
24
  # Does not appear in logs.
49
25
  def self.deprecated_description(new_setting, description)
50
- link_ref = new_setting.to_s.tr(".", "-")
26
+ link_ref = new_setting.to_s.tr('.', '-')
51
27
  %{Please see: [#{new_setting}](docs/agents/ruby-agent/configuration/ruby-agent-configuration##{link_ref}). \n\n#{description}}
52
28
  end
53
29
 
@@ -80,34 +56,35 @@ module NewRelic
80
56
  default_settings[:transform] if default_settings
81
57
  end
82
58
 
83
- def self.config_search_paths
59
+ def self.config_search_paths # rubocop:disable Metrics/AbcSize
84
60
  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
- ]
61
+ yaml = 'newrelic.yml'
62
+ config_yaml = File.join('config', yaml)
63
+ erb = 'newrelic.yml.erb'
64
+ config_erb = File.join('config', erb)
65
+
66
+ paths = [config_yaml, yaml, config_erb, erb]
91
67
 
92
68
  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")
69
+ paths << File.join(NewRelic::Control.instance.root, config_yaml)
70
+ paths << File.join(NewRelic::Control.instance.root, yaml)
71
+ paths << File.join(NewRelic::Control.instance.root, config_erb)
72
+ paths << File.join(NewRelic::Control.instance.root, erb)
97
73
  end
98
74
 
99
75
  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")
76
+ paths << File.join(ENV['HOME'], '.newrelic', yaml)
77
+ paths << File.join(ENV['HOME'], yaml)
78
+ paths << File.join(ENV['HOME'], '.newrelic', erb)
79
+ paths << File.join(ENV['HOME'], erb)
104
80
  end
105
81
 
106
82
  # 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")
83
+ # the following line needs else branch coverage
84
+ if ENV['GEM_HOME'] && ENV['GEM_HOME'].end_with?('.jar!') # rubocop:disable Style/SafeNavigation
85
+ app_name = File.basename(ENV['GEM_HOME'], '.jar!')
86
+ paths << File.join(ENV['GEM_HOME'], app_name, config_yaml)
87
+ paths << File.join(ENV['GEM_HOME'], app_name, config_erb)
111
88
  end
112
89
 
113
90
  paths
@@ -206,11 +183,11 @@ module NewRelic
206
183
  # only used for deployment task
207
184
  proc do
208
185
  api_version = if NewRelic::Agent.config[:api_key].nil? || NewRelic::Agent.config[:api_key].empty?
209
- "rpm"
186
+ 'rpm'
210
187
  else
211
- "api"
188
+ 'api'
212
189
  end
213
- api_region = "eu." if String(NewRelic::Agent.config[:license_key]).start_with?('eu')
190
+ api_region = 'eu.' if String(NewRelic::Agent.config[:license_key]).start_with?('eu')
214
191
 
215
192
  "#{api_version}.#{api_region}newrelic.com"
216
193
  end
@@ -432,7 +409,7 @@ module NewRelic
432
409
  :public => true,
433
410
  :type => Boolean,
434
411
  :allowed_from_server => true,
435
- :description => "Allows newrelic distributed tracing headers to be suppressed on outbound requests."
412
+ :description => 'Allows newrelic distributed tracing headers to be suppressed on outbound requests.'
436
413
  },
437
414
  :force_install_exit_handler => {
438
415
  :default => false,
@@ -959,7 +936,7 @@ module NewRelic
959
936
  :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
937
  },
961
938
  :'audit_log.endpoints' => {
962
- :default => [".*"],
939
+ :default => ['.*'],
963
940
  :public => true,
964
941
  :type => Array,
965
942
  :allowed_from_server => false,
@@ -1281,10 +1258,10 @@ module NewRelic
1281
1258
  :type => String,
1282
1259
  :allowed_from_server => false,
1283
1260
  :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."
1261
+ :description => 'Configures the hostname for the trace observer Host. ' \
1262
+ 'When configured, enables tail-based sampling by sending all recorded spans ' \
1263
+ 'to a trace observer for further sampling decisions, irrespective of any usual ' \
1264
+ 'agent sampling decision.'
1288
1265
  },
1289
1266
  :'infinite_tracing.trace_observer.port' => {
1290
1267
  :default => 443,
@@ -1292,7 +1269,7 @@ module NewRelic
1292
1269
  :type => Integer,
1293
1270
  :allowed_from_server => false,
1294
1271
  :external => :infinite_tracing,
1295
- :description => "Configures the TCP/IP port for the trace observer Host"
1272
+ :description => 'Configures the TCP/IP port for the trace observer Host'
1296
1273
  },
1297
1274
  # Instrumentation
1298
1275
  :'instrumentation.active_support_logger' => {
@@ -1361,7 +1338,7 @@ module NewRelic
1361
1338
  :type => String,
1362
1339
  :dynamic_name => true,
1363
1340
  :allowed_from_server => false,
1364
- :description => "Controls auto-instrumentation of Excon at start up. May be one of [enabled|disabled]."
1341
+ :description => 'Controls auto-instrumentation of Excon at start up. May be one of [enabled|disabled].'
1365
1342
  },
1366
1343
  :'instrumentation.grape' => {
1367
1344
  :default => 'auto',
@@ -1369,10 +1346,10 @@ module NewRelic
1369
1346
  :type => String,
1370
1347
  :dynamic_name => true,
1371
1348
  :allowed_from_server => false,
1372
- :description => "Controls auto-instrumentation of Grape at start up. May be one of [auto|prepend|chain|disabled]."
1349
+ :description => 'Controls auto-instrumentation of Grape at start up. May be one of [auto|prepend|chain|disabled].'
1373
1350
  },
1374
1351
  :'instrumentation.grpc_client' => {
1375
- :default => instrumentation_value_of(:disable_grpc_client),
1352
+ :default => 'auto',
1376
1353
  :documentation_default => 'auto',
1377
1354
  :public => true,
1378
1355
  :type => String,
@@ -1389,7 +1366,7 @@ module NewRelic
1389
1366
  :description => %Q(Specifies a list of hostname patterns separated by commas that will match gRPC hostnames that traffic is to be ignored by New Relic for. New Relic's gRPC client instrumentation will ignore traffic streamed to a host matching any of these patterns, and New Relic's gRPC server instrumentation will ignore traffic for a server running on a host whose hostname matches any of these patterns. By default, no traffic is ignored when gRPC instrumentation is itself enabled. For example, "private.com$,exception.*")
1390
1367
  },
1391
1368
  :'instrumentation.grpc_server' => {
1392
- :default => instrumentation_value_of(:disable_grpc_server),
1369
+ :default => 'auto',
1393
1370
  :documentation_default => 'auto',
1394
1371
  :public => true,
1395
1372
  :type => String,
@@ -1404,7 +1381,7 @@ module NewRelic
1404
1381
  :type => String,
1405
1382
  :dynamic_name => true,
1406
1383
  :allowed_from_server => false,
1407
- :description => "Controls auto-instrumentation of HTTPClient at start up. May be one of [auto|prepend|chain|disabled]."
1384
+ :description => 'Controls auto-instrumentation of HTTPClient at start up. May be one of [auto|prepend|chain|disabled].'
1408
1385
  },
1409
1386
  :'instrumentation.httprb' => {
1410
1387
  :default => 'auto',
@@ -1442,7 +1419,7 @@ module NewRelic
1442
1419
  :description => 'Controls auto-instrumentation of memcached gem for Memcache at start up. May be one of [auto|prepend|chain|disabled].'
1443
1420
  },
1444
1421
  :'instrumentation.memcache_client' => {
1445
- :default => instrumentation_value_of(:disable_memcache_client),
1422
+ :default => 'auto',
1446
1423
  :documentation_default => 'auto',
1447
1424
  :public => true,
1448
1425
  :type => String,
@@ -1457,7 +1434,7 @@ module NewRelic
1457
1434
  :type => String,
1458
1435
  :dynamic_name => true,
1459
1436
  :allowed_from_server => false,
1460
- :description => "Controls auto-instrumentation of Mongo at start up. May be one of [enabled|disabled]."
1437
+ :description => 'Controls auto-instrumentation of Mongo at start up. May be one of [enabled|disabled].'
1461
1438
  },
1462
1439
  :'instrumentation.net_http' => {
1463
1440
  :default => 'auto',
@@ -1466,7 +1443,7 @@ module NewRelic
1466
1443
  :type => String,
1467
1444
  :dynamic_name => true,
1468
1445
  :allowed_from_server => false,
1469
- :description => "Controls auto-instrumentation of Net::HTTP at start up. May be one of [auto|prepend|chain|disabled]."
1446
+ :description => 'Controls auto-instrumentation of Net::HTTP at start up. May be one of [auto|prepend|chain|disabled].'
1470
1447
  },
1471
1448
  :'instrumentation.puma_rack' => {
1472
1449
  :default => value_of(:'instrumentation.rack'),
@@ -1475,9 +1452,9 @@ module NewRelic
1475
1452
  :type => String,
1476
1453
  :dynamic_name => true,
1477
1454
  :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]."
1455
+ :description => 'Controls auto-instrumentation of Puma::Rack. When enabled, the agent hooks into the ' \
1456
+ '`to_app` method in Puma::Rack::Builder to find gems to instrument during ' \
1457
+ 'application startup. May be one of [auto|prepend|chain|disabled].'
1481
1458
  },
1482
1459
  :'instrumentation.puma_rack_urlmap' => {
1483
1460
  :default => value_of(:'instrumentation.rack_urlmap'),
@@ -1495,9 +1472,9 @@ module NewRelic
1495
1472
  :type => String,
1496
1473
  :dynamic_name => true,
1497
1474
  :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]."
1475
+ :description => 'Controls auto-instrumentation of Rack. When enabled, the agent hooks into the ' \
1476
+ '`to_app` method in Rack::Builder to find gems to instrument during ' \
1477
+ 'application startup. May be one of [auto|prepend|chain|disabled].'
1501
1478
  },
1502
1479
  :'instrumentation.rack_urlmap' => {
1503
1480
  :default => 'auto',
@@ -1514,7 +1491,7 @@ module NewRelic
1514
1491
  :type => String,
1515
1492
  :dynamic_name => true,
1516
1493
  :allowed_from_server => false,
1517
- :description => "Controls auto-instrumentation of rake at start up. May be one of [auto|prepend|chain|disabled]."
1494
+ :description => 'Controls auto-instrumentation of rake at start up. May be one of [auto|prepend|chain|disabled].'
1518
1495
  },
1519
1496
  :'instrumentation.redis' => {
1520
1497
  :default => 'auto',
@@ -1522,7 +1499,7 @@ module NewRelic
1522
1499
  :type => String,
1523
1500
  :dynamic_name => true,
1524
1501
  :allowed_from_server => false,
1525
- :description => "Controls auto-instrumentation of Redis at start up. May be one of [auto|prepend|chain|disabled]."
1502
+ :description => 'Controls auto-instrumentation of Redis at start up. May be one of [auto|prepend|chain|disabled].'
1526
1503
  },
1527
1504
  :'instrumentation.resque' => {
1528
1505
  :default => 'auto',
@@ -1531,7 +1508,7 @@ module NewRelic
1531
1508
  :type => String,
1532
1509
  :dynamic_name => true,
1533
1510
  :allowed_from_server => false,
1534
- :description => "Controls auto-instrumentation of resque at start up. May be one of [auto|prepend|chain|disabled]."
1511
+ :description => 'Controls auto-instrumentation of resque at start up. May be one of [auto|prepend|chain|disabled].'
1535
1512
  },
1536
1513
  :'instrumentation.sinatra' => {
1537
1514
  :default => 'auto',
@@ -1539,7 +1516,7 @@ module NewRelic
1539
1516
  :type => String,
1540
1517
  :dynamic_name => true,
1541
1518
  :allowed_from_server => false,
1542
- :description => "Controls auto-instrumentation of Sinatra at start up. May be one of [auto|prepend|chain|disabled]."
1519
+ :description => 'Controls auto-instrumentation of Sinatra at start up. May be one of [auto|prepend|chain|disabled].'
1543
1520
  },
1544
1521
  :'instrumentation.thread' => {
1545
1522
  :default => 'auto',
@@ -1547,24 +1524,24 @@ module NewRelic
1547
1524
  :type => String,
1548
1525
  :dynamic_name => true,
1549
1526
  :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]."
1527
+ :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
1528
  },
1552
1529
  :'instrumentation.thread.tracing' => {
1553
1530
  :default => true,
1554
1531
  :public => true,
1555
1532
  :type => Boolean,
1556
1533
  :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."
1534
+ :description => 'Controls auto-instrumentation of the Thread class at start up to automatically add tracing to all Threads created in the application.'
1558
1535
  },
1559
1536
  :'thread_ids_enabled' => {
1560
1537
  :default => false,
1561
1538
  :public => false,
1562
1539
  :type => Boolean,
1563
1540
  :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"
1541
+ :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
1542
  },
1566
1543
  :'instrumentation.tilt' => {
1567
- :default => "auto",
1544
+ :default => 'auto',
1568
1545
  :public => true,
1569
1546
  :type => String,
1570
1547
  :dynamic_name => true,
@@ -1578,7 +1555,7 @@ module NewRelic
1578
1555
  :type => String,
1579
1556
  :dynamic_name => true,
1580
1557
  :allowed_from_server => false,
1581
- :description => "Controls auto-instrumentation of Typhoeus at start up. May be one of [auto|prepend|chain|disabled]."
1558
+ :description => 'Controls auto-instrumentation of Typhoeus at start up. May be one of [auto|prepend|chain|disabled].'
1582
1559
  },
1583
1560
  # Message tracer
1584
1561
  :'message_tracer.segment_parameters.enabled' => {
@@ -1709,7 +1686,7 @@ module NewRelic
1709
1686
  :type => Integer,
1710
1687
  :allowed_from_server => false,
1711
1688
  :external => :infinite_tracing,
1712
- :description => "Sets the maximum number of span events to buffer when streaming to the trace observer."
1689
+ :description => 'Sets the maximum number of span events to buffer when streaming to the trace observer.'
1713
1690
  },
1714
1691
  :'span_events.max_samples_stored' => {
1715
1692
  :default => 2000,
@@ -2016,7 +1993,7 @@ module NewRelic
2016
1993
  :public => false,
2017
1994
  :type => String,
2018
1995
  :allowed_from_server => false,
2019
- :description => "URI for the New Relic data collection service."
1996
+ :description => 'URI for the New Relic data collection service.'
2020
1997
  },
2021
1998
  :'infinite_tracing.batching' => {
2022
1999
  :default => true,
@@ -2025,7 +2002,7 @@ module NewRelic
2025
2002
  :allowed_from_server => false,
2026
2003
  :external => :infinite_tracing,
2027
2004
  :description => "If `true` (the default), data sent to the trace observer is batched\ninstead of sending " \
2028
- "each span individually."
2005
+ 'each span individually.'
2029
2006
  },
2030
2007
  :'infinite_tracing.compression_level' => {
2031
2008
  :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}")