newrelic_rpm 8.0.0 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (281) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +1936 -0
  4. data/Brewfile +10 -0
  5. data/CHANGELOG.md +96 -0
  6. data/CONTRIBUTING.md +15 -3
  7. data/Guardfile +8 -8
  8. data/README.md +3 -1
  9. data/Rakefile +7 -9
  10. data/bin/mongrel_rpm +8 -9
  11. data/bin/newrelic +1 -1
  12. data/bin/nrdebug +14 -14
  13. data/init.rb +0 -2
  14. data/lefthook.yml +9 -0
  15. data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
  16. data/lib/new_relic/agent/agent.rb +38 -40
  17. data/lib/new_relic/agent/agent_logger.rb +8 -9
  18. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  19. data/lib/new_relic/agent/attributes.rb +2 -2
  20. data/lib/new_relic/agent/autostart.rb +6 -7
  21. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  22. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  23. data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
  24. data/lib/new_relic/agent/configuration/default_source.rb +343 -337
  25. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  26. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  27. data/lib/new_relic/agent/configuration/event_harvest_config.rb +2 -4
  28. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  29. data/lib/new_relic/agent/configuration/manager.rb +57 -57
  30. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  31. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  32. data/lib/new_relic/agent/configuration/server_source.rb +10 -10
  33. data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
  34. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  35. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  36. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
  37. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  38. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  39. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  40. data/lib/new_relic/agent/database.rb +20 -24
  41. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  42. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  43. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  44. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  45. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  46. data/lib/new_relic/agent/datastores.rb +1 -3
  47. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  48. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
  49. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
  50. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  52. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  53. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +24 -24
  54. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  55. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  56. data/lib/new_relic/agent/error_collector.rb +17 -17
  57. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  58. data/lib/new_relic/agent/error_filter.rb +16 -10
  59. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  60. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  61. data/lib/new_relic/agent/event_buffer.rb +6 -7
  62. data/lib/new_relic/agent/event_listener.rb +0 -1
  63. data/lib/new_relic/agent/event_loop.rb +10 -10
  64. data/lib/new_relic/agent/external.rb +1 -2
  65. data/lib/new_relic/agent/guid_generator.rb +2 -9
  66. data/lib/new_relic/agent/harvester.rb +3 -4
  67. data/lib/new_relic/agent/heap.rb +1 -3
  68. data/lib/new_relic/agent/hostname.rb +3 -3
  69. data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
  70. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  71. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  72. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  73. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  74. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +8 -3
  75. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  76. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  77. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  78. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
  79. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  80. data/lib/new_relic/agent/instrumentation/active_job.rb +4 -3
  81. data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
  82. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  83. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
  84. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  85. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  86. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
  87. data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
  88. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  89. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  90. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
  91. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
  92. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  93. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  94. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  95. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  96. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  97. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +5 -9
  98. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  99. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  100. data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
  101. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  102. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  103. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  104. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  105. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  106. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  107. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  108. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  109. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  110. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  111. data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
  112. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +58 -0
  113. data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
  114. data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
  115. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -2
  116. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -1
  117. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +9 -2
  118. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  119. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
  120. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
  121. data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
  122. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
  123. data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
  124. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  125. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
  126. data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
  127. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
  128. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +2 -2
  129. data/lib/new_relic/agent/instrumentation/padrino.rb +2 -5
  130. data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
  131. data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
  132. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
  133. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  134. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
  135. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  136. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
  137. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  138. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  139. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  140. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  141. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  142. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  143. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  144. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  145. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  146. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  147. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  148. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
  149. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  150. data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
  151. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  152. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  153. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
  154. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  155. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
  156. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  157. data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
  158. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +40 -0
  159. data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
  160. data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
  161. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  162. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  163. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  164. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  165. data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
  166. data/lib/new_relic/agent/logging.rb +11 -8
  167. data/lib/new_relic/agent/memory_logger.rb +1 -1
  168. data/lib/new_relic/agent/messaging.rb +42 -43
  169. data/lib/new_relic/agent/method_tracer.rb +17 -15
  170. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  171. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +19 -16
  172. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  173. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  174. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  175. data/lib/new_relic/agent/monitors.rb +1 -2
  176. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  177. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  178. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  179. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  180. data/lib/new_relic/agent/new_relic_service.rb +26 -33
  181. data/lib/new_relic/agent/noticible_error.rb +0 -2
  182. data/lib/new_relic/agent/null_logger.rb +6 -2
  183. data/lib/new_relic/agent/obfuscator.rb +6 -8
  184. data/lib/new_relic/agent/parameter_filtering.rb +15 -7
  185. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  186. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  187. data/lib/new_relic/agent/pipe_service.rb +1 -1
  188. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  189. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  190. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  191. data/lib/new_relic/agent/rules_engine.rb +2 -2
  192. data/lib/new_relic/agent/sampler.rb +2 -3
  193. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  194. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +10 -7
  195. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  196. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  197. data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
  198. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  199. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  200. data/lib/new_relic/agent/stats.rb +16 -16
  201. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  202. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  203. data/lib/new_relic/agent/stats_engine.rb +6 -6
  204. data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
  205. data/lib/new_relic/agent/system_info.rb +22 -20
  206. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  207. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  208. data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
  209. data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
  210. data/lib/new_relic/agent/tracer.rb +37 -43
  211. data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
  212. data/lib/new_relic/agent/transaction/datastore_segment.rb +7 -6
  213. data/lib/new_relic/agent/transaction/distributed_tracer.rb +8 -9
  214. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  215. data/lib/new_relic/agent/transaction/external_request_segment.rb +6 -5
  216. data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
  217. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  218. data/lib/new_relic/agent/transaction/segment.rb +6 -3
  219. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  220. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  221. data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
  222. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  223. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  224. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  225. data/lib/new_relic/agent/transaction.rb +79 -81
  226. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  227. data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
  228. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  229. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  230. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  231. data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
  232. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  233. data/lib/new_relic/agent/utilization_data.rb +3 -4
  234. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  235. data/lib/new_relic/agent/vm/snapshot.rb +3 -3
  236. data/lib/new_relic/agent/worker_loop.rb +3 -5
  237. data/lib/new_relic/agent.rb +22 -22
  238. data/lib/new_relic/cli/command.rb +15 -17
  239. data/lib/new_relic/cli/commands/deployments.rb +20 -22
  240. data/lib/new_relic/cli/commands/install.rb +6 -10
  241. data/lib/new_relic/coerce.rb +5 -8
  242. data/lib/new_relic/collection_helper.rb +48 -47
  243. data/lib/new_relic/control/class_methods.rb +2 -2
  244. data/lib/new_relic/control/frameworks/external.rb +1 -1
  245. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  246. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  247. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  248. data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
  249. data/lib/new_relic/control/instance_methods.rb +4 -5
  250. data/lib/new_relic/control/instrumentation.rb +4 -5
  251. data/lib/new_relic/control/server_methods.rb +2 -3
  252. data/lib/new_relic/control.rb +0 -1
  253. data/lib/new_relic/dependency_detection.rb +6 -8
  254. data/lib/new_relic/environment_report.rb +16 -18
  255. data/lib/new_relic/helper.rb +5 -5
  256. data/lib/new_relic/language_support.rb +1 -1
  257. data/lib/new_relic/latest_changes.rb +2 -2
  258. data/lib/new_relic/local_environment.rb +7 -7
  259. data/lib/new_relic/metric_data.rb +6 -7
  260. data/lib/new_relic/metric_spec.rb +3 -3
  261. data/lib/new_relic/noticed_error.rb +14 -15
  262. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  263. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  264. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  265. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  266. data/lib/new_relic/supportability_helper.rb +1 -2
  267. data/lib/new_relic/version.rb +3 -4
  268. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  269. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  270. data/lib/tasks/all.rb +1 -1
  271. data/lib/tasks/config.rake +21 -21
  272. data/lib/tasks/multiverse.rb +4 -6
  273. data/lib/tasks/tests.rake +3 -7
  274. data/newrelic.yml +8 -21
  275. data/newrelic_rpm.gemspec +13 -12
  276. data/recipes/newrelic.rb +1 -1
  277. data/test/agent_helper.rb +55 -55
  278. metadata +43 -7
  279. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
  280. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
  281. data/lib/new_relic/agent/supported_versions.rb +0 -275
@@ -8,7 +8,6 @@ require 'new_relic/agent/agent_logger'
8
8
 
9
9
  module NewRelic
10
10
  class Control
11
-
12
11
  # Contains methods that relate to the runtime usage of the control
13
12
  # object. Note that these are subject to override in the
14
13
  # NewRelic::Control::Framework classes that are actually instantiated
@@ -47,7 +46,7 @@ module NewRelic
47
46
  # Subclasses are not allowed to override, but must implement
48
47
  # init_config({}) which is called one or more times.
49
48
  #
50
- def init_plugin(options={})
49
+ def init_plugin(options = {})
51
50
  env = determine_env(options)
52
51
 
53
52
  configure_agent(env, options)
@@ -87,10 +86,10 @@ module NewRelic
87
86
 
88
87
  if @started_in_env && @started_in_env != env
89
88
  Agent.logger.error("Attempted to start agent in #{env.inspect} environment, but agent was already running in #{@started_in_env.inspect}",
90
- "The agent will continue running in #{@started_in_env.inspect}. To alter this, ensure the desired environment is set before the agent starts.")
89
+ "The agent will continue running in #{@started_in_env.inspect}. To alter this, ensure the desired environment is set before the agent starts.")
91
90
  else
92
91
  Agent.logger.info("Starting the New Relic agent version #{NewRelic::VERSION::STRING} in #{env.inspect} environment.",
93
- "To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the #{env.inspect} section of your newrelic.yml.")
92
+ "To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the #{env.inspect} section of your newrelic.yml.")
94
93
  end
95
94
 
96
95
  env
@@ -164,7 +163,7 @@ module NewRelic
164
163
 
165
164
  protected
166
165
 
167
- def initialize(local_env, config_file_override=nil)
166
+ def initialize(local_env, config_file_override = nil)
168
167
  @install_lock = Mutex.new
169
168
  @local_env = local_env
170
169
  @started_in_env = nil
@@ -7,7 +7,6 @@ module NewRelic
7
7
  # Contains methods that relate to adding and executing files that
8
8
  # contain instrumentation for the Ruby Agent
9
9
  module Instrumentation
10
-
11
10
  # Adds a list of files in Dir.glob format
12
11
  # (e.g. '/app/foo/**/*_instrumentation.rb')
13
12
  # This requires the files within a rescue block, so that any
@@ -57,11 +56,11 @@ module NewRelic
57
56
 
58
57
  # Instrumentation for the key code points inside rails for monitoring by NewRelic.
59
58
  # note this file is loaded only if the newrelic agent is enabled (through config/newrelic.yml)
60
- instrumentation_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'agent','instrumentation'))
59
+ instrumentation_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'agent', 'instrumentation'))
61
60
  @instrumentation_files <<
62
- File.join(instrumentation_path, '*.rb') <<
63
- File.join(instrumentation_path, app.to_s, '*.rb')
64
- @instrumentation_files.each { | pattern | load_instrumentation_files pattern }
61
+ File.join(instrumentation_path, '*.rb') <<
62
+ File.join(instrumentation_path, app.to_s, '*.rb')
63
+ @instrumentation_files.each { |pattern| load_instrumentation_files pattern }
65
64
  DependencyDetection.detect!
66
65
  ::NewRelic::Agent.logger.info "Finished instrumentation"
67
66
  end
@@ -4,9 +4,8 @@
4
4
 
5
5
  module NewRelic
6
6
  class Control
7
-
8
7
  # Structs holding info for the remote server and proxy server
9
- class Server < Struct.new :name, :port #:nodoc:
8
+ class Server < Struct.new :name, :port # :nodoc:
10
9
  def to_s; "#{name}:#{port}"; end
11
10
  end
12
11
 
@@ -22,7 +21,7 @@ module NewRelic
22
21
  @api_server ||= NewRelic::Control::Server.new(Agent.config[:api_host], Agent.config[:api_port])
23
22
  end
24
23
 
25
- def server_from_host(hostname=nil)
24
+ def server_from_host(hostname = nil)
26
25
  NewRelic::Control::Server.new(hostname || Agent.config[:host], Agent.config[:port])
27
26
  end
28
27
  end
@@ -23,7 +23,6 @@ require 'new_relic/agent'
23
23
  require 'new_relic/delayed_job_injection'
24
24
 
25
25
  module NewRelic
26
-
27
26
  # The Control is a singleton responsible for the startup and
28
27
  # initialization sequence. The initializer uses a LocalEnvironment to
29
28
  # detect the framework and instantiates the framework specific
@@ -3,7 +3,6 @@
3
3
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
5
  module DependencyDetection
6
-
7
6
  module_function
8
7
 
9
8
  @items = []
@@ -33,7 +32,7 @@ module DependencyDetection
33
32
  end
34
33
 
35
34
  def dependency_by_name(name)
36
- @items.find {|i| i.name == name }
35
+ @items.find { |i| i.name == name }
37
36
  end
38
37
 
39
38
  def installed?(name)
@@ -56,7 +55,6 @@ module DependencyDetection
56
55
  attr_reader :dependencies
57
56
  attr_reader :prepend_conflicts
58
57
 
59
-
60
58
  def executed!
61
59
  @executed = true
62
60
  end
@@ -95,19 +93,19 @@ module DependencyDetection
95
93
  yield
96
94
  end
97
95
 
98
- def prepend_instrument target_class, instrumenting_module, supportability_name=nil
96
+ def prepend_instrument target_class, instrumenting_module, supportability_name = nil
99
97
  log_and_instrument("Prepend", instrumenting_module, supportability_name) do
100
98
  target_class.send :prepend, instrumenting_module
101
99
  end
102
100
  end
103
101
 
104
- def chain_instrument instrumenting_module, supportability_name=nil
102
+ def chain_instrument instrumenting_module, supportability_name = nil
105
103
  log_and_instrument("MethodChaining", instrumenting_module, supportability_name) do
106
104
  instrumenting_module.instrument!
107
105
  end
108
106
  end
109
107
 
110
- def chain_instrument_target target, instrumenting_module, supportability_name=nil
108
+ def chain_instrument_target target, instrumenting_module, supportability_name = nil
111
109
  NewRelic::Agent.logger.info "Installing deferred #{target} instrumentation"
112
110
  log_and_instrument("MethodChaining", instrumenting_module, supportability_name) do
113
111
  instrumenting_module.instrument! target
@@ -134,7 +132,7 @@ module DependencyDetection
134
132
  begin
135
133
  dep.call
136
134
  rescue => err
137
- NewRelic::Agent.logger.error( "Error while detecting #{self.name}:", err )
135
+ NewRelic::Agent.logger.error("Error while detecting #{self.name}:", err)
138
136
  false
139
137
  end
140
138
  end
@@ -222,7 +220,7 @@ module DependencyDetection
222
220
  begin
223
221
  conflict.call
224
222
  rescue => err
225
- NewRelic::Agent.logger.error( "Error while checking prepend conflicts #{self.name}:", err )
223
+ NewRelic::Agent.logger.error("Error while checking prepend conflicts #{self.name}:", err)
226
224
  false # assumes no conflicts exist since `prepend` is preferred method of instrumenting
227
225
  end
228
226
  end
@@ -13,7 +13,6 @@ module NewRelic
13
13
  # Additional logic can be registered by using the EnvironmentReport.report_on
14
14
  # hook.
15
15
  class EnvironmentReport
16
-
17
16
  # This is the main interface for registering logic that should be included
18
17
  # in the Environment Report. For example:
19
18
  #
@@ -57,23 +56,23 @@ module NewRelic
57
56
  end
58
57
  end
59
58
  end
60
- report_on('Plugin List' ) { ::Rails.configuration.plugins.to_a }
61
- report_on('Ruby version' ) { RUBY_VERSION }
62
- report_on('Ruby description' ) { RUBY_DESCRIPTION }
63
- report_on('Ruby platform' ) { RUBY_PLATFORM }
64
- report_on('Ruby patchlevel' ) { RUBY_PATCHLEVEL.to_s }
65
- report_on('JRuby version' ) { JRUBY_VERSION }
66
- report_on('Java VM version' ) { ENV_JAVA['java.vm.version'] }
59
+ report_on('Plugin List') { ::Rails.configuration.plugins.to_a }
60
+ report_on('Ruby version') { RUBY_VERSION }
61
+ report_on('Ruby description') { RUBY_DESCRIPTION }
62
+ report_on('Ruby platform') { RUBY_PLATFORM }
63
+ report_on('Ruby patchlevel') { RUBY_PATCHLEVEL.to_s }
64
+ report_on('JRuby version') { JRUBY_VERSION }
65
+ report_on('Java VM version') { ENV_JAVA['java.vm.version'] }
67
66
  report_on('Logical Processors') { ::NewRelic::Agent::SystemInfo.num_logical_processors }
68
- report_on('Physical Cores' ) { ::NewRelic::Agent::SystemInfo.num_physical_cores }
69
- report_on('Arch' ) { ::NewRelic::Agent::SystemInfo.processor_arch }
70
- report_on('OS version' ) { ::NewRelic::Agent::SystemInfo.os_version }
71
- report_on('OS' ) { ::NewRelic::Agent::SystemInfo.ruby_os_identifier }
72
- report_on('Database adapter' ) { ::NewRelic::Agent::DatabaseAdapter.value }
73
- report_on('Framework' ) { Agent.config[:framework].to_s }
74
- report_on('Dispatcher' ) { Agent.config[:dispatcher].to_s }
75
- report_on('Environment' ) { NewRelic::Control.instance.env }
76
- report_on('Rails version' ) { ::Rails::VERSION::STRING }
67
+ report_on('Physical Cores') { ::NewRelic::Agent::SystemInfo.num_physical_cores }
68
+ report_on('Arch') { ::NewRelic::Agent::SystemInfo.processor_arch }
69
+ report_on('OS version') { ::NewRelic::Agent::SystemInfo.os_version }
70
+ report_on('OS') { ::NewRelic::Agent::SystemInfo.ruby_os_identifier }
71
+ report_on('Database adapter') { ::NewRelic::Agent::DatabaseAdapter.value }
72
+ report_on('Framework') { Agent.config[:framework].to_s }
73
+ report_on('Dispatcher') { Agent.config[:dispatcher].to_s }
74
+ report_on('Environment') { NewRelic::Control.instance.env }
75
+ report_on('Rails version') { ::Rails::VERSION::STRING }
77
76
  report_on('Rails threadsafe') do
78
77
  ::Rails.configuration.action_controller.allow_concurrency
79
78
  end
@@ -88,7 +87,6 @@ module NewRelic
88
87
  # end reporting logic
89
88
  ####################################
90
89
 
91
-
92
90
  attr_reader :data
93
91
  # Generate the report based on the class level logic.
94
92
  def initialize
@@ -19,9 +19,9 @@ module NewRelic
19
19
  end
20
20
 
21
21
  def instance_method_visibility(klass, method_name)
22
- if klass.private_instance_methods.map{|s|s.to_sym}.include? method_name.to_sym
22
+ if klass.private_instance_methods.map { |s| s.to_sym }.include? method_name.to_sym
23
23
  :private
24
- elsif klass.protected_instance_methods.map{|s|s.to_sym}.include? method_name.to_sym
24
+ elsif klass.protected_instance_methods.map { |s| s.to_sym }.include? method_name.to_sym
25
25
  :protected
26
26
  else
27
27
  :public
@@ -31,9 +31,9 @@ module NewRelic
31
31
  def instance_methods_include?(klass, method_name)
32
32
  method_name_sym = method_name.to_sym
33
33
  (
34
- klass.instance_methods.map{ |s| s.to_sym }.include?(method_name_sym) ||
35
- klass.protected_instance_methods.map{ |s|s.to_sym }.include?(method_name_sym) ||
36
- klass.private_instance_methods.map{ |s|s.to_sym }.include?(method_name_sym)
34
+ klass.instance_methods.map { |s| s.to_sym }.include?(method_name_sym) ||
35
+ klass.protected_instance_methods.map { |s| s.to_sym }.include?(method_name_sym) ||
36
+ klass.private_instance_methods.map { |s| s.to_sym }.include?(method_name_sym)
37
37
  )
38
38
  end
39
39
 
@@ -34,7 +34,7 @@ module NewRelic
34
34
  end
35
35
 
36
36
  def constantize(const_name)
37
- const_name.to_s.sub(/\A::/,'').split('::').inject(Object) do |namespace, name|
37
+ const_name.to_s.sub(/\A::/, '').split('::').inject(Object) do |namespace, name|
38
38
  begin
39
39
  result = namespace.const_get(name)
40
40
 
@@ -13,7 +13,7 @@ module NewRelic
13
13
  changes.
14
14
  EOS
15
15
 
16
- def self.read(changelog=default_changelog)
16
+ def self.read(changelog = default_changelog)
17
17
  changes = extract_latest_changes(File.read(changelog))
18
18
  changes << FOOTER
19
19
 
@@ -24,7 +24,7 @@ EOS
24
24
  # precise version number included in the line in parens. For example:
25
25
  #
26
26
  # * This is a patch item (3.7.1.188)
27
- def self.read_patch(patch_level, changelog=default_changelog)
27
+ def self.read_patch(patch_level, changelog = default_changelog)
28
28
  latest = extract_latest_changes(File.read(changelog))
29
29
  changes = ["## v#{patch_level}", ""]
30
30
 
@@ -36,7 +36,7 @@ module NewRelic
36
36
  def initialize
37
37
  # Extend self with any any submodules of LocalEnvironment. These can override
38
38
  # the discover methods to discover new framworks and dispatchers.
39
- NewRelic::LocalEnvironment.constants.each do | const |
39
+ NewRelic::LocalEnvironment.constants.each do |const|
40
40
  mod = NewRelic::LocalEnvironment.const_get const
41
41
  self.extend mod if mod.instance_of? Module
42
42
  end
@@ -77,13 +77,13 @@ module NewRelic
77
77
  unicorn
78
78
  ]
79
79
  while dispatchers.any? && @discovered_dispatcher.nil?
80
- send 'check_for_'+(dispatchers.shift)
80
+ send 'check_for_' + (dispatchers.shift)
81
81
  end
82
82
  end
83
83
 
84
84
  def check_for_torquebox
85
85
  return unless defined?(::JRuby) &&
86
- ( org.torquebox::TorqueBox rescue nil)
86
+ (org.torquebox::TorqueBox rescue nil)
87
87
  @discovered_dispatcher = :torquebox
88
88
  end
89
89
 
@@ -147,9 +147,9 @@ module NewRelic
147
147
  end
148
148
 
149
149
  def check_for_resque
150
- has_queue = ENV['QUEUE'] || ENV['QUEUES']
151
- resque_rake = executable == 'rake' && ARGV.include?('resque:work')
152
- resque_pool_rake = executable == 'rake' && ARGV.include?('resque:pool')
150
+ has_queue = ENV['QUEUE'] || ENV['QUEUES']
151
+ resque_rake = executable == 'rake' && ARGV.include?('resque:work')
152
+ resque_pool_rake = executable == 'rake' && ARGV.include?('resque:pool')
153
153
  resque_pool_executable = executable == 'resque-pool' && defined?(::Resque::Pool)
154
154
 
155
155
  using_resque = defined?(::Resque) &&
@@ -192,6 +192,7 @@ module NewRelic
192
192
  end
193
193
 
194
194
  public
195
+
195
196
  # outputs a human-readable description
196
197
  def to_s
197
198
  s = "LocalEnvironment["
@@ -202,6 +203,5 @@ module NewRelic
202
203
  def executable
203
204
  File.basename($0)
204
205
  end
205
-
206
206
  end
207
207
  end
@@ -18,7 +18,7 @@ module NewRelic
18
18
  end
19
19
 
20
20
  def eql?(o)
21
- (metric_spec.eql? o.metric_spec) && (stats.eql? o.stats)
21
+ (metric_spec.eql? o.metric_spec) && (stats.eql? o.stats)
22
22
  end
23
23
 
24
24
  def original_spec
@@ -37,7 +37,7 @@ module NewRelic
37
37
  end
38
38
 
39
39
  def to_json(*a)
40
- %Q[{"metric_spec":#{metric_spec.to_json},"stats":{"total_exclusive_time":#{stats.total_exclusive_time},"min_call_time":#{stats.min_call_time},"call_count":#{stats.call_count},"sum_of_squares":#{stats.sum_of_squares},"total_call_time":#{stats.total_call_time},"max_call_time":#{stats.max_call_time}}}]
40
+ %Q({"metric_spec":#{metric_spec.to_json},"stats":{"total_exclusive_time":#{stats.total_exclusive_time},"min_call_time":#{stats.min_call_time},"call_count":#{stats.call_count},"sum_of_squares":#{stats.sum_of_squares},"total_call_time":#{stats.total_call_time},"max_call_time":#{stats.max_call_time}}})
41
41
  end
42
42
 
43
43
  def to_s
@@ -50,9 +50,9 @@ module NewRelic
50
50
 
51
51
  include NewRelic::Coerce
52
52
 
53
- def to_collector_array(encoder=nil)
54
- stat_key = { 'name' => metric_spec.name, 'scope' => metric_spec.scope }
55
- [ stat_key,
53
+ def to_collector_array(encoder = nil)
54
+ stat_key = {'name' => metric_spec.name, 'scope' => metric_spec.scope}
55
+ [stat_key,
56
56
  [
57
57
  int(stats.call_count, stat_key),
58
58
  float(stats.total_call_time, stat_key),
@@ -60,8 +60,7 @@ module NewRelic
60
60
  float(stats.min_call_time, stat_key),
61
61
  float(stats.max_call_time, stat_key),
62
62
  float(stats.sum_of_squares, stat_key)
63
- ]
64
- ]
63
+ ]]
65
64
  end
66
65
  end
67
66
  end
@@ -5,14 +5,14 @@
5
5
  # this struct uniquely defines a metric, optionally inside
6
6
  # the call scope of another metric
7
7
  class NewRelic::MetricSpec
8
- attr_reader :name, :scope
8
+ attr_reader :name, :scope
9
9
 
10
10
  # the maximum length of a metric name or metric scope
11
11
  MAX_LENGTH = 255
12
12
  LENGTH_RANGE = (0...MAX_LENGTH)
13
13
  EMPTY_SCOPE = ''.freeze
14
14
 
15
- def initialize(metric_name='', metric_scope=nil)
15
+ def initialize(metric_name = '', metric_scope = nil)
16
16
  if metric_name.to_s.length > MAX_LENGTH
17
17
  @name = metric_name.to_s[LENGTH_RANGE]
18
18
  else
@@ -53,7 +53,7 @@ class NewRelic::MetricSpec
53
53
 
54
54
  def to_json(*a)
55
55
  {'name' => name,
56
- 'scope' => scope}.to_json(*a)
56
+ 'scope' => scope}.to_json(*a)
57
57
  end
58
58
 
59
59
  def <=>(o)
@@ -12,11 +12,11 @@ class NewRelic::NoticedError
12
12
  extend NewRelic::CollectionHelper
13
13
 
14
14
  attr_accessor :path, :timestamp, :message, :exception_class_name,
15
- :request_uri, :request_port, :file_name, :line_number,
16
- :stack_trace, :attributes_from_notice_error, :attributes,
17
- :expected
15
+ :request_uri, :request_port, :file_name, :line_number,
16
+ :stack_trace, :attributes_from_notice_error, :attributes,
17
+ :expected
18
18
 
19
- attr_reader :exception_id, :is_internal
19
+ attr_reader :exception_id, :is_internal
20
20
 
21
21
  STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE = "Message removed by New Relic 'strip_exception_messages' setting"
22
22
  UNKNOWN_ERROR_CLASS_NAME = 'Error'
@@ -28,9 +28,9 @@ class NewRelic::NoticedError
28
28
 
29
29
  DESTINATION = NewRelic::Agent::AttributeFilter::DST_ERROR_COLLECTOR
30
30
 
31
- ERROR_PREFIX_KEY = 'error'
32
- ERROR_MESSAGE_KEY = "#{ERROR_PREFIX_KEY}.message"
33
- ERROR_CLASS_KEY = "#{ERROR_PREFIX_KEY}.class"
31
+ ERROR_PREFIX_KEY = 'error'
32
+ ERROR_MESSAGE_KEY = "#{ERROR_PREFIX_KEY}.message"
33
+ ERROR_CLASS_KEY = "#{ERROR_PREFIX_KEY}.class"
34
34
  ERROR_EXPECTED_KEY = "#{ERROR_PREFIX_KEY}.expected"
35
35
 
36
36
  def initialize(path, exception, timestamp = Process.clock_gettime(Process::CLOCK_REALTIME), expected = false)
@@ -51,7 +51,7 @@ class NewRelic::NoticedError
51
51
 
52
52
  # replace error message if enabled
53
53
  if NewRelic::Agent.config[:'strip_exception_messages.enabled'] &&
54
- !self.class.passes_message_allowlist(exception.class)
54
+ !self.class.passes_message_allowlist(exception.class)
55
55
  @message = STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE
56
56
  end
57
57
 
@@ -77,12 +77,12 @@ class NewRelic::NoticedError
77
77
 
78
78
  include NewRelic::Coerce
79
79
 
80
- def to_collector_array(encoder=nil)
81
- [ NewRelic::Helper.time_to_millis(timestamp),
80
+ def to_collector_array(encoder = nil)
81
+ [NewRelic::Helper.time_to_millis(timestamp),
82
82
  string(path),
83
83
  string(message),
84
84
  string(exception_class_name),
85
- processed_attributes ]
85
+ processed_attributes]
86
86
  end
87
87
 
88
88
  # Note that we process attributes lazily and store the result. This is because
@@ -101,9 +101,9 @@ class NewRelic::NoticedError
101
101
 
102
102
  def base_parameters
103
103
  params = {}
104
- params[:file_name] = file_name if file_name
105
- params[:line_number] = line_number if line_number
106
- params[:stack_trace] = stack_trace if stack_trace
104
+ params[:file_name] = file_name if file_name
105
+ params[:line_number] = line_number if line_number
106
+ params[:stack_trace] = stack_trace if stack_trace
107
107
  params[ERROR_EXPECTED_KEY.to_sym] = expected
108
108
  params
109
109
  end
@@ -200,5 +200,4 @@ class NewRelic::NoticedError
200
200
  @message = exception.to_s
201
201
  end
202
202
  end
203
-
204
203
  end
@@ -13,10 +13,10 @@ module NewRelic
13
13
 
14
14
  attr_reader :transaction_options, :category, :target
15
15
 
16
- def initialize(app, options={})
16
+ def initialize(app, options = {})
17
17
  @app = app
18
18
  @category = :middleware
19
- @target = self
19
+ @target = self
20
20
  @transaction_options = {
21
21
  :transaction_name => build_transaction_name
22
22
  }
@@ -19,15 +19,15 @@ module NewRelic::Rack
19
19
  # examine in order to look for a RUM insertion point.
20
20
  SCAN_LIMIT = 50_000
21
21
 
22
- CONTENT_TYPE = 'Content-Type'.freeze
22
+ CONTENT_TYPE = 'Content-Type'.freeze
23
23
  CONTENT_DISPOSITION = 'Content-Disposition'.freeze
24
- CONTENT_LENGTH = 'Content-Length'.freeze
25
- ATTACHMENT = 'attachment'.freeze
26
- TEXT_HTML = 'text/html'.freeze
24
+ CONTENT_LENGTH = 'Content-Length'.freeze
25
+ ATTACHMENT = 'attachment'.freeze
26
+ TEXT_HTML = 'text/html'.freeze
27
27
 
28
- BODY_START = "<body".freeze
29
- HEAD_START = "<head".freeze
30
- GT = ">".freeze
28
+ BODY_START = "<body".freeze
29
+ HEAD_START = "<head".freeze
30
+ GT = ">".freeze
31
31
 
32
32
  def traced_call(env)
33
33
  result = @app.call(env)
@@ -79,7 +79,7 @@ module NewRelic::Rack
79
79
  env['action_controller.instance'].class.included_modules.include?(ActionController::Live)
80
80
  end
81
81
 
82
- CHARSET_RE = /<\s*meta[^>]+charset\s*=[^>]*>/im.freeze
82
+ CHARSET_RE = /<\s*meta[^>]+charset\s*=[^>]*>/im.freeze
83
83
  X_UA_COMPATIBLE_RE = /<\s*meta[^>]+http-equiv\s*=\s*['"]x-ua-compatible['"][^>]*>/im.freeze
84
84
 
85
85
  def autoinstrument_source(response, headers, js_to_inject)
@@ -123,7 +123,7 @@ module NewRelic::Rack
123
123
 
124
124
  def gather_source(response)
125
125
  source = nil
126
- response.each {|fragment| source ? (source << fragment.to_s) : (source = fragment.to_s)}
126
+ response.each { |fragment| source ? (source << fragment.to_s) : (source = fragment.to_s) }
127
127
  source
128
128
  end
129
129
 
@@ -5,7 +5,6 @@
5
5
  require 'capistrano/framework'
6
6
 
7
7
  namespace :newrelic do
8
-
9
8
  # notifies New Relic of a deployment
10
9
  desc "Record a deployment in New Relic (newrelic.com)"
11
10
  task :notice_deployment do
@@ -23,15 +22,15 @@ namespace :newrelic do
23
22
  def send_deployment_notification_to_newrelic
24
23
  environment = fetch(:newrelic_rails_env, fetch(:rack_env, fetch(:rails_env, fetch(:stage, "production"))))
25
24
 
26
- require 'new_relic/cli/command.rb'
25
+ require 'new_relic/cli/command'
27
26
 
28
27
  begin
29
28
  # allow overrides to be defined for revision, description, changelog, appname, and user
30
- rev = fetch(:newrelic_revision)
29
+ rev = fetch(:newrelic_revision)
31
30
  description = fetch(:newrelic_desc)
32
- changelog = fetch(:newrelic_changelog)
33
- appname = fetch(:newrelic_appname)
34
- user = fetch(:newrelic_user)
31
+ changelog = fetch(:newrelic_changelog)
32
+ appname = fetch(:newrelic_appname)
33
+ user = fetch(:newrelic_user)
35
34
  license_key = fetch(:newrelic_license_key)
36
35
 
37
36
  has_scm_from_plugin = respond_to?(:scm_plugin_installed?) && scm_plugin_installed?
@@ -39,17 +38,17 @@ namespace :newrelic do
39
38
 
40
39
  if has_scm_from_plugin || has_scm_from_config
41
40
  changelog ||= lookup_changelog
42
- rev ||= fetch(:current_revision)
41
+ rev ||= fetch(:current_revision)
43
42
  end
44
43
 
45
44
  new_revision = rev
46
45
  deploy_options = {
47
46
  :environment => environment,
48
- :revision => new_revision,
49
- :changelog => changelog,
47
+ :revision => new_revision,
48
+ :changelog => changelog,
50
49
  :description => description,
51
- :appname => appname,
52
- :user => user,
50
+ :appname => appname,
51
+ :user => user,
53
52
  :license_key => license_key
54
53
  }
55
54
 
@@ -57,7 +56,6 @@ namespace :newrelic do
57
56
  deployment = NewRelic::Cli::Deployments.new deploy_options
58
57
  deployment.run
59
58
  info "Uploaded deployment information to New Relic"
60
-
61
59
  rescue NewRelic::Cli::Command::CommandFailure => e
62
60
  info e.message
63
61
  rescue => e
@@ -74,7 +72,7 @@ namespace :newrelic do
74
72
 
75
73
  if Rake::Task.task_defined?("git:check")
76
74
  log_command = "git --no-pager log --no-color --pretty=format:' * %an: %s' " +
77
- "--abbrev-commit --no-merges #{previous_revision}..#{current_revision}"
75
+ "--abbrev-commit --no-merges #{previous_revision}..#{current_revision}"
78
76
  `#{log_command}`
79
77
  end
80
78
  end
@@ -3,38 +3,36 @@
3
3
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
4
4
 
5
5
  make_notify_task = Proc.new do
6
-
7
6
  namespace :newrelic do
8
-
9
7
  # on all deployments, notify New Relic
10
8
  desc "Record a deployment in New Relic (newrelic.com)"
11
- task :notice_deployment, :roles => :app, :except => {:no_release => true } do
9
+ task :notice_deployment, :roles => :app, :except => {:no_release => true} do
12
10
  rails_env = fetch(:newrelic_rails_env, fetch(:rails_env, "production"))
13
11
 
14
12
  require 'new_relic/cli/command'
15
13
 
16
14
  begin
17
15
  # allow overrides to be defined for revision, description, changelog, appname, and user
18
- rev = fetch(:newrelic_revision) if exists?(:newrelic_revision)
19
- description = fetch(:newrelic_desc) if exists?(:newrelic_desc)
20
- changelog = fetch(:newrelic_changelog) if exists?(:newrelic_changelog)
21
- appname = fetch(:newrelic_appname) if exists?(:newrelic_appname)
22
- user = fetch(:newrelic_user) if exists?(:newrelic_user)
16
+ rev = fetch(:newrelic_revision) if exists?(:newrelic_revision)
17
+ description = fetch(:newrelic_desc) if exists?(:newrelic_desc)
18
+ changelog = fetch(:newrelic_changelog) if exists?(:newrelic_changelog)
19
+ appname = fetch(:newrelic_appname) if exists?(:newrelic_appname)
20
+ user = fetch(:newrelic_user) if exists?(:newrelic_user)
23
21
  license_key = fetch(:newrelic_license_key) if exists?(:newrelic_license_key)
24
22
 
25
23
  unless scm == :none
26
24
  changelog = lookup_changelog(changelog)
27
- rev = lookup_rev(rev)
25
+ rev = lookup_rev(rev)
28
26
  end
29
27
 
30
28
  new_revision = rev
31
29
  deploy_options = {
32
30
  :environment => rails_env,
33
- :revision => new_revision,
34
- :changelog => changelog,
31
+ :revision => new_revision,
32
+ :changelog => changelog,
35
33
  :description => description,
36
- :appname => appname,
37
- :user => user,
34
+ :appname => appname,
35
+ :user => user,
38
36
  :license_key => license_key
39
37
  }
40
38
 
@@ -42,7 +40,6 @@ make_notify_task = Proc.new do
42
40
  deployment = NewRelic::Cli::Deployments.new deploy_options
43
41
  deployment.run
44
42
  logger.info "Uploaded deployment information to New Relic"
45
-
46
43
  rescue NewRelic::Cli::Command::CommandFailure => e
47
44
  logger.info e.message
48
45
  rescue Capistrano::CommandError
@@ -4,7 +4,6 @@
4
4
 
5
5
  module NewRelic
6
6
  module SupportabilityHelper
7
-
8
7
  API_SUPPORTABILITY_PREFIX = 'Supportability/API/'.freeze
9
8
 
10
9
  # pre-instantiate these strings as they may be used multiple times per
@@ -54,7 +53,7 @@ module NewRelic
54
53
  :trace_execution_scoped,
55
54
  :trace_execution_unscoped,
56
55
  :wrap
57
- ].reduce({}) do |h,o|
56
+ ].reduce({}) do |h, o|
58
57
  h[o] = API_SUPPORTABILITY_PREFIX + o.to_s
59
58
  h
60
59
  end