newrelic_rpm 8.2.0 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1936 -0
  3. data/CHANGELOG.md +17 -2
  4. data/CONTRIBUTING.md +14 -2
  5. data/Guardfile +8 -8
  6. data/Rakefile +5 -7
  7. data/bin/mongrel_rpm +8 -9
  8. data/bin/newrelic +1 -1
  9. data/bin/nrdebug +14 -14
  10. data/init.rb +0 -2
  11. data/lefthook.yml +9 -0
  12. data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
  13. data/lib/new_relic/agent/agent.rb +38 -40
  14. data/lib/new_relic/agent/agent_logger.rb +8 -9
  15. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  16. data/lib/new_relic/agent/attributes.rb +2 -2
  17. data/lib/new_relic/agent/autostart.rb +6 -7
  18. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  19. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  20. data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
  21. data/lib/new_relic/agent/configuration/default_source.rb +318 -324
  22. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  23. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  24. data/lib/new_relic/agent/configuration/event_harvest_config.rb +2 -4
  25. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  26. data/lib/new_relic/agent/configuration/manager.rb +57 -57
  27. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  28. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  29. data/lib/new_relic/agent/configuration/server_source.rb +10 -10
  30. data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
  31. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  32. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  33. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
  34. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  35. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  36. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  37. data/lib/new_relic/agent/database.rb +20 -24
  38. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  39. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  40. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  41. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  42. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  43. data/lib/new_relic/agent/datastores.rb +1 -3
  44. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  45. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
  46. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
  47. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
  48. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  49. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  50. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +23 -23
  51. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  52. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  53. data/lib/new_relic/agent/error_collector.rb +17 -17
  54. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  55. data/lib/new_relic/agent/error_filter.rb +6 -8
  56. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  57. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  58. data/lib/new_relic/agent/event_buffer.rb +6 -7
  59. data/lib/new_relic/agent/event_listener.rb +0 -1
  60. data/lib/new_relic/agent/event_loop.rb +10 -10
  61. data/lib/new_relic/agent/external.rb +1 -2
  62. data/lib/new_relic/agent/guid_generator.rb +1 -3
  63. data/lib/new_relic/agent/harvester.rb +3 -4
  64. data/lib/new_relic/agent/heap.rb +1 -3
  65. data/lib/new_relic/agent/hostname.rb +3 -3
  66. data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
  67. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  68. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  69. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  70. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  71. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +2 -3
  72. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  73. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  74. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  75. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
  76. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  77. data/lib/new_relic/agent/instrumentation/active_job.rb +4 -3
  78. data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
  79. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  80. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
  81. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  82. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  83. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
  84. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  85. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  86. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
  87. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
  88. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  89. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  90. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  91. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  92. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  93. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -6
  94. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  95. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  96. data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
  97. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  98. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  99. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  100. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  101. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  102. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  103. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  104. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  105. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  106. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  107. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +0 -1
  108. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  109. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -1
  110. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
  111. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -0
  112. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  113. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
  114. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
  115. data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
  116. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
  117. data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
  118. data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
  119. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
  120. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
  121. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
  122. data/lib/new_relic/agent/instrumentation/padrino.rb +0 -5
  123. data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
  124. data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
  125. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
  126. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  127. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
  128. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  129. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
  130. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  131. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  132. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  133. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  134. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  135. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  136. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  137. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  138. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  139. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  140. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
  142. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  143. data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
  144. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  145. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  146. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
  147. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  148. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
  149. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  150. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +0 -1
  151. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  152. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  153. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  154. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  155. data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
  156. data/lib/new_relic/agent/logging.rb +8 -4
  157. data/lib/new_relic/agent/memory_logger.rb +1 -1
  158. data/lib/new_relic/agent/messaging.rb +42 -43
  159. data/lib/new_relic/agent/method_tracer.rb +9 -12
  160. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  161. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +13 -12
  162. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  163. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  164. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  165. data/lib/new_relic/agent/monitors.rb +1 -2
  166. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  167. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  168. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  169. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  170. data/lib/new_relic/agent/new_relic_service.rb +20 -20
  171. data/lib/new_relic/agent/noticible_error.rb +0 -2
  172. data/lib/new_relic/agent/null_logger.rb +6 -2
  173. data/lib/new_relic/agent/obfuscator.rb +6 -8
  174. data/lib/new_relic/agent/parameter_filtering.rb +3 -5
  175. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  176. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  177. data/lib/new_relic/agent/pipe_service.rb +1 -1
  178. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  179. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  180. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  181. data/lib/new_relic/agent/rules_engine.rb +2 -2
  182. data/lib/new_relic/agent/sampler.rb +2 -3
  183. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  184. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +3 -3
  185. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  186. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  187. data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
  188. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  189. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  190. data/lib/new_relic/agent/stats.rb +16 -16
  191. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  192. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  193. data/lib/new_relic/agent/stats_engine.rb +6 -6
  194. data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
  195. data/lib/new_relic/agent/system_info.rb +22 -20
  196. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  197. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  198. data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
  199. data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
  200. data/lib/new_relic/agent/tracer.rb +37 -43
  201. data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
  202. data/lib/new_relic/agent/transaction/datastore_segment.rb +5 -7
  203. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -9
  204. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  205. data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -5
  206. data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
  207. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  208. data/lib/new_relic/agent/transaction/segment.rb +3 -3
  209. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  210. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  211. data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
  212. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  213. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  214. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  215. data/lib/new_relic/agent/transaction.rb +79 -81
  216. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  217. data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
  218. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  219. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  220. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  221. data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
  222. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  223. data/lib/new_relic/agent/utilization_data.rb +3 -4
  224. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  225. data/lib/new_relic/agent/vm/snapshot.rb +3 -3
  226. data/lib/new_relic/agent/worker_loop.rb +3 -5
  227. data/lib/new_relic/agent.rb +22 -22
  228. data/lib/new_relic/cli/command.rb +15 -17
  229. data/lib/new_relic/cli/commands/deployments.rb +20 -22
  230. data/lib/new_relic/cli/commands/install.rb +6 -10
  231. data/lib/new_relic/coerce.rb +5 -8
  232. data/lib/new_relic/collection_helper.rb +48 -47
  233. data/lib/new_relic/control/class_methods.rb +2 -2
  234. data/lib/new_relic/control/frameworks/external.rb +1 -1
  235. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  236. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  237. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  238. data/lib/new_relic/control/instance_methods.rb +4 -5
  239. data/lib/new_relic/control/instrumentation.rb +4 -5
  240. data/lib/new_relic/control/server_methods.rb +2 -3
  241. data/lib/new_relic/control.rb +0 -1
  242. data/lib/new_relic/dependency_detection.rb +6 -8
  243. data/lib/new_relic/environment_report.rb +16 -18
  244. data/lib/new_relic/helper.rb +5 -5
  245. data/lib/new_relic/language_support.rb +1 -1
  246. data/lib/new_relic/latest_changes.rb +2 -2
  247. data/lib/new_relic/local_environment.rb +7 -7
  248. data/lib/new_relic/metric_data.rb +6 -7
  249. data/lib/new_relic/metric_spec.rb +3 -3
  250. data/lib/new_relic/noticed_error.rb +14 -15
  251. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  252. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  253. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  254. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  255. data/lib/new_relic/supportability_helper.rb +1 -2
  256. data/lib/new_relic/version.rb +3 -4
  257. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  258. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  259. data/lib/tasks/all.rb +1 -1
  260. data/lib/tasks/config.rake +21 -21
  261. data/lib/tasks/multiverse.rb +4 -6
  262. data/lib/tasks/tests.rake +3 -7
  263. data/newrelic_rpm.gemspec +13 -12
  264. data/recipes/newrelic.rb +1 -1
  265. data/test/agent_helper.rb +55 -55
  266. metadata +33 -4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v8.3.0
4
+
5
+ * **Updated the agent to support Ruby 3.1.0**
6
+
7
+ Most of the changes involved updating the multiverse suite to exclude runs for older versions of instrumented gems that are not compatible with Ruby 3.1.0. In addition, Infinite Tracing testing was updated to accommodate `YAML::unsafe_load` for Psych 4 support.
8
+
9
+ * **Bugfix: Update AdaptiveSampler#sampled? algorithm**
10
+
11
+ One of the clauses in `AdaptiveSampler#sampled?` would always return false due to Integer division returning a result of zero. This method has been updated to use Float division instead, to exponentially back off the number of samples required. This may increase the number of traces collected for transactions. A huge thank you to @romul for bringing this to our attention and breaking down the problem!
12
+
13
+ * **Bugfix: Correctly encode ASCII-8BIT log messages**
14
+
15
+ The encoding update for the DecoratingLogger in v8.2.0 did not account for ASCII-8BIT encoded characters qualifying as `valid_encoding?`. Now, ASCII-8BIT characters will be encoded as UTF-8 and include replacement characters as needed. We're very grateful for @nikajukic's collaboration and submission of a test case to resolve this issue.
16
+
17
+
3
18
  ## v8.2.0
4
19
 
5
20
  * **New Instrumentation for Tilt gem**
@@ -21,7 +36,7 @@
21
36
  * **Bugfix: Span Events recorded when using newrelic_ignore**
22
37
 
23
38
  Previously, the agent was incorrectly recording span events only on transactions that should be ignored. This fix will prevent any span events from being created for transactions using newrelic_ignore, or ignored through the `rules.ignore_url_regexes` configuration option.
24
-
39
+
25
40
  * **Bugfix: Print deprecation warning for Cross-Application Tracing if enabled**
26
41
 
27
42
  Prior to this change, the deprecation warning would log whenever the agent started up, regardless of configuration. Thank you @alpha-san for bringing this to our attention!
@@ -29,7 +44,7 @@
29
44
  * **Bugfix: Scrub non-unicode characters from DecoratingLogger**
30
45
 
31
46
  To prevent `JSON::GeneratorErrors`, the DecoratingLogger replaces non-unicode characters with the replacement character: �. Thank you @jdelStrother for bringing this to our attention!
32
-
47
+
33
48
  * **Bugfix: Distributed tracing headers emitted errors when agent was not connected**
34
49
 
35
50
  Previously, when the agent had not yet connected it would fail to create a trace context payload and emit an error, "TypeError: no implicit conversion of nil into String," to the agent logs. The correct behavior in this situation is to not create these headers due to the lack of required information. Now, the agent will not attempt to create trace context payloads until it has connected. Thank you @Izzette for bringing this to our attention!
data/CONTRIBUTING.md CHANGED
@@ -66,7 +66,8 @@ issues](../../issues?q=is%3Aissue+is%3Aclosed).
66
66
  ### Pull Requests
67
67
 
68
68
  We can only accept PRs for version v6.12.0 or greater due to open source
69
- licensing restrictions.
69
+ licensing restrictions. Please set the merge branch to `dev` unless the issue
70
+ states otherwise.
70
71
 
71
72
  ### Code of Conduct
72
73
 
@@ -84,18 +85,29 @@ release from this repo, use the appropriate tag. New Relic usually pushes beta
84
85
  versions of a release to a working branch before tagging them for General
85
86
  Availability.
86
87
 
88
+ The `main` branch houses the code from the latest release. The `dev` branch
89
+ includes unreleased work. Please create all new branches off of `dev`.
90
+
87
91
  ## Development Environment Setup
88
92
 
89
93
  1. Fork and clone the repo locally
90
94
  - Fork the repository inside GitHub
91
95
  - `git clone git@github.com:<gh username>/newrelic-ruby-agent.git`
92
96
  1. Pick a Ruby version
93
- - Use rbenv or rvm to install any version of Ruby between 2.2 up to 3.0.1
97
+ - Use rbenv or rvm to install any version of Ruby between 2.2 up to 3.1
94
98
  1. Install development dependencies
95
99
  - `bundle install`
96
100
  1. Check that your env is setup correctly
97
101
  - `bundle exec rake`
98
102
 
103
+ **Optional:** Install [lefthook](https://github.com/evilmartians/lefthook) to
104
+ integrate our team's git hooks, such as [rubocop](https://github.com/rubocop/rubocop)
105
+ linting into your workflow.
106
+
107
+ **Note:** These setup instructions will not allow you to run the entire test
108
+ suite. Some of our suites require services such as MySQL, Postgres, Redis, and
109
+ others to run.
110
+
99
111
  ## Testing
100
112
 
101
113
  The agent includes a suite of unit and functional tests which should be used to
data/Guardfile CHANGED
@@ -1,24 +1,24 @@
1
1
  require './test/multiverse/lib/multiverse/bundler_patch'
2
2
 
3
- test_folders = Dir.glob("test/new_relic/*").select{|f| File.directory?(f)}
4
- test_folders += Dir.glob("test/new_relic/**/*").select{|f| File.directory?(f)}
3
+ test_folders = Dir.glob("test/new_relic/*").select { |f| File.directory?(f) }
4
+ test_folders += Dir.glob("test/new_relic/**/*").select { |f| File.directory?(f) }
5
5
 
6
- rake_lib_path = Bundler.with_unbundled_env{ `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
7
- ruby_options = %{-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb"}
6
+ rake_lib_path = Bundler.with_unbundled_env { `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
7
+ ruby_options = %(-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb")
8
8
 
9
9
  guard_options = {
10
10
  spring: "bundle exec ruby #{ruby_options} ",
11
- test_folders: ['test/new_relic'] + test_folders,
11
+ test_folders: ['test/new_relic'] + test_folders,
12
12
  all_after_pass: false,
13
13
  all_on_start: false
14
14
  }
15
15
 
16
16
  guard :minitest, guard_options do
17
- watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
17
+ watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
18
18
  watch(%r{^test/.+_test\.rb$})
19
- watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
19
+ watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
20
20
  watch(%r{^test/fixtures/cross_agent_tests/distributed_tracing/(.+).json}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
21
- watch('test/test_helper.rb') { "test/new_relic" }
21
+ watch('test/test_helper.rb') { "test/new_relic" }
22
22
  watch('test/agent_helper.rb') { "test/new_relic" }
23
23
  watch('lib/new_relic/agent/configuration/default_source.rb') { "test/new_relic/agent/configuration/orphan_configuration_test.rb" }
24
24
  watch(%r{^lib/new_relic/agent/transaction/(.+).rb}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ task :test => ['test:newrelic']
10
10
 
11
11
  namespace :test do
12
12
  desc "Run all tests"
13
- task :all => %w{newrelic multiverse}
13
+ task :all => %w[newrelic multiverse]
14
14
 
15
15
  begin
16
16
  require 'test_bisect'
@@ -27,14 +27,14 @@ namespace :test do
27
27
  require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'performance', 'lib', 'performance'))
28
28
  options = {}
29
29
  options[:suite] = args[:suite] if args[:suite]
30
- options[:name] = args[:name] if args[:name]
30
+ options[:name] = args[:name] if args[:name]
31
31
  Performance::Runner.new(options).run_and_report
32
32
  end
33
33
 
34
34
  desc "Run agent within existing mini environments"
35
35
  task :env, [:env1, :env2, :env3, :env4, :env5, :env6] => [] do |t, args|
36
36
  require File.expand_path(File.join(File.dirname(__FILE__), 'test', 'environments', 'lib', 'environments', 'runner'))
37
- Environments::Runner.new(args.map{|_,v| v}).run_and_report
37
+ Environments::Runner.new(args.map { |_, v| v }).run_and_report
38
38
  end
39
39
 
40
40
  Rake::TestTask.new(:intentional_fail) do |t|
@@ -51,11 +51,10 @@ namespace :test do
51
51
 
52
52
  # Note unit testing task is defined in lib/tasks/tests.rake to facilitate
53
53
  # running them in a rails application environment.
54
-
55
54
  end
56
55
 
57
56
  desc 'Record build number and stage'
58
- task :record_build, [ :build_number, :stage ] do |t, args|
57
+ task :record_build, [:build_number, :stage] do |t, args|
59
58
  build_string = args.build_number
60
59
  build_string << ".#{args.stage}" unless args.stage.nil? || args.stage.empty?
61
60
 
@@ -111,7 +110,7 @@ end
111
110
 
112
111
  namespace :cross_agent_tests do
113
112
  cross_agent_tests_upstream_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'cross_agent_tests'))
114
- cross_agent_tests_local_path = File.expand_path(File.join(File.dirname(__FILE__), 'test', 'fixtures', 'cross_agent_tests'))
113
+ cross_agent_tests_local_path = File.expand_path(File.join(File.dirname(__FILE__), 'test', 'fixtures', 'cross_agent_tests'))
115
114
 
116
115
  # Note: before you pull, make sure your local repo is on the correct, synced branch!
117
116
  desc 'Pull latest changes from cross_agent_tests repo'
@@ -137,4 +136,3 @@ task :console do
137
136
  ARGV.clear
138
137
  Pry.start
139
138
  end
140
-
data/bin/mongrel_rpm CHANGED
@@ -5,14 +5,14 @@ require 'rack/handler/mongrel'
5
5
  require 'optparse'
6
6
 
7
7
  port = 3000
8
- options = { }
8
+ options = {}
9
9
  appname = nil
10
10
  OptionParser.new do |opts|
11
11
  opts.banner = "Usage: #{File.basename($0)} [options] [app_name]"
12
- opts.on("-p", "--port=port", Integer, "default: #{port}") { | port | }
13
- opts.on("--[no-]logging", "turn off request logging" ) { | l | options[:logging] = l }
14
- opts.on("--license=license_key", "override license key" ) { | l | options[:license_key] = l }
15
- opts.on("--install", "install a newrelic.yml template" ) { | l | options[:install] = true }
12
+ opts.on("-p", "--port=port", Integer, "default: #{port}") { |port| }
13
+ opts.on("--[no-]logging", "turn off request logging") { |l| options[:logging] = l }
14
+ opts.on("--license=license_key", "override license key") { |l| options[:license_key] = l }
15
+ opts.on("--install", "install a newrelic.yml template") { |l| options[:install] = true }
16
16
  opts.separator ""
17
17
  opts.separator "app_name is the name of the application where the metrics will be stored"
18
18
  opts.separator ""
@@ -26,8 +26,7 @@ ru_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "new_r
26
26
  rackup_code = File.read ru_file
27
27
  builder = Rack::Builder.new { eval rackup_code, binding, ru_file }
28
28
 
29
- options = { :Host => '127.0.0.1', :Port => port }
30
- Rack::Handler::Mongrel.run(builder.to_app, options) do | server |
31
- NewRelic::Agent.logger.info "Started Mongrel listening for '#{NewRelic::Control.instance.app_names.join(" and ")}' data at #{server.host}:#{server.port}"
29
+ options = {:Host => '127.0.0.1', :Port => port}
30
+ Rack::Handler::Mongrel.run(builder.to_app, options) do |server|
31
+ NewRelic::Agent.logger.info "Started Mongrel listening for '#{NewRelic::Control.instance.app_names.join(" and ")}' data at #{server.host}:#{server.port}"
32
32
  end
33
-
data/bin/newrelic CHANGED
@@ -2,7 +2,7 @@
2
2
  # executes one of the commands in the new_relic/commands directory
3
3
  # pass the name of the command as an argument
4
4
 
5
- $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..','lib'))
5
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  require 'new_relic/cli/command'
7
7
  begin
8
8
  NewRelic::Cli::Command.run
data/bin/nrdebug CHANGED
@@ -7,7 +7,7 @@
7
7
  require 'tempfile'
8
8
  require 'rbconfig'
9
9
 
10
- def fail(msg, opts={})
10
+ def fail(msg, opts = {})
11
11
  $stderr.puts(msg)
12
12
  usage() if opts[:usage]
13
13
  exit(-1)
@@ -84,7 +84,7 @@ class ProcessDataProvider
84
84
 
85
85
  def self.for_process(pid)
86
86
  case RbConfig::CONFIG['target_os']
87
- when /linux/ then LinuxProcessDataProvider.new(pid)
87
+ when /linux/ then LinuxProcessDataProvider.new(pid)
88
88
  when /darwin/ then DarwinProcessDataProvider.new(pid)
89
89
  end
90
90
  end
@@ -170,7 +170,7 @@ end
170
170
  class ProcessReport
171
171
  attr_reader :target, :path
172
172
 
173
- def initialize(target, path=nil)
173
+ def initialize(target, path = nil)
174
174
  @target = target
175
175
  @path = path
176
176
  end
@@ -185,7 +185,7 @@ class ProcessReport
185
185
  end
186
186
  end
187
187
 
188
- def section(f, name=nil)
188
+ def section(f, name = nil)
189
189
  content = begin
190
190
  yield
191
191
  rescue StandardError => e
@@ -200,13 +200,13 @@ class ProcessReport
200
200
 
201
201
  def generate
202
202
  open do |f|
203
- section(f, "Time") { Time.now }
204
- section(f, "PID") { @target.pid }
205
- section(f, "Command") { @target.procline }
206
- section(f, "RSS") { @target.rss }
207
- section(f, "CPU") { @target.cpu }
208
- section(f, "Parent PID") { @target.ppid }
209
- section(f, "OS") { ShellWrapper.execute('uname -a') }
203
+ section(f, "Time") { Time.now }
204
+ section(f, "PID") { @target.pid }
205
+ section(f, "Command") { @target.procline }
206
+ section(f, "RSS") { @target.rss }
207
+ section(f, "CPU") { @target.cpu }
208
+ section(f, "Parent PID") { @target.ppid }
209
+ section(f, "OS") { ShellWrapper.execute('uname -a') }
210
210
  section(f, "Environment") { @target.environment }
211
211
 
212
212
  section(f) do
@@ -214,13 +214,13 @@ class ProcessReport
214
214
  if c_backtraces.match(/could not attach/i)
215
215
  fail("Failed to attach to target process. Please try again with sudo.")
216
216
  end
217
- section(f, "C Backtraces") { c_backtraces }
217
+ section(f, "C Backtraces") { c_backtraces }
218
218
  section(f, "Ruby Backtrace(s)") { ruby_backtraces }
219
219
  end
220
220
 
221
221
  section(f, "Open files") { @target.open_files }
222
222
  section(f, "Log") do
223
- commands = Logger.messages.map { |(_,msg)| msg }
223
+ commands = Logger.messages.map { |(_, msg)| msg }
224
224
  commands.join("\n")
225
225
  end
226
226
  end
@@ -243,7 +243,7 @@ def prompt_for_confirmation(target_pid, target_cmd)
243
243
  puts ''
244
244
  puts "To continue, type 'continue':"
245
245
 
246
- until ($stdin.gets.strip == 'continue') do
246
+ until $stdin.gets.strip == 'continue'
247
247
  puts "Please type 'continue' to continue, or ctrl-c to abort."
248
248
  end
249
249
  end
data/init.rb CHANGED
@@ -18,7 +18,6 @@ require 'new_relic/control'
18
18
  # We need it to add dev mode routes after initialization finished.
19
19
 
20
20
  begin
21
-
22
21
  current_config = if defined?(config)
23
22
  config
24
23
  elsif defined?(Rails.configuration)
@@ -26,7 +25,6 @@ begin
26
25
  end
27
26
 
28
27
  NewRelic::Control.instance.init_plugin :config => current_config
29
-
30
28
  rescue => e
31
29
  ::NewRelic::Agent.logger.error "Error initializing New Relic plugin. Agent is disabled.", e
32
30
  end
data/lefthook.yml ADDED
@@ -0,0 +1,9 @@
1
+ # Lefthook (https://github.com/evilmartians/lefthook) is a git hooks manager
2
+ # Install it on your machine by running `gem install lefthook`
3
+ pre-commit:
4
+ parallel: true
5
+ commands:
6
+ rubocop:
7
+ files: git diff --name-only --staged
8
+ glob: "*.rb"
9
+ run: rubocop --force-exclusion {files}
@@ -5,7 +5,6 @@
5
5
  module NewRelic
6
6
  module Agent
7
7
  class AdaptiveSampler
8
-
9
8
  def initialize target_samples = 10, period_duration = 60
10
9
  @target = target_samples
11
10
  @seen = 0
@@ -29,7 +28,8 @@ module NewRelic
29
28
  elsif @sampled_count < @target
30
29
  rand(@seen_last) < @target
31
30
  else
32
- rand(@seen) < (@target ** (@target / @sampled_count) - @target ** 0.5)
31
+ # you've met the target and need to exponentially back off
32
+ rand(@seen) < exponential_backoff
33
33
  end
34
34
 
35
35
  @sampled_count += 1 if sampled
@@ -39,6 +39,10 @@ module NewRelic
39
39
  end
40
40
  end
41
41
 
42
+ def exponential_backoff
43
+ @target**(@target.to_f / @sampled_count) - @target**0.5
44
+ end
45
+
42
46
  def stats
43
47
  @lock.synchronize do
44
48
  {
@@ -57,7 +61,7 @@ module NewRelic
57
61
  return unless @period_start + @period_duration <= now
58
62
 
59
63
  elapsed_periods = Integer((now - @period_start) / @period_duration)
60
- @period_start = @period_start + elapsed_periods * @period_duration
64
+ @period_start += elapsed_periods * @period_duration
61
65
 
62
66
  @first_period = false
63
67
  @seen_last = elapsed_periods > 1 ? 0 : @seen
@@ -37,7 +37,6 @@ require 'new_relic/agent/connect/response_handler'
37
37
 
38
38
  module NewRelic
39
39
  module Agent
40
-
41
40
  # The Agent is a singleton that is instantiated when the plugin is
42
41
  # activated. It collects performance data from ruby applications
43
42
  # in realtime as the application runs, and periodically sends that
@@ -54,31 +53,31 @@ module NewRelic
54
53
 
55
54
  @service = NewRelicService.new
56
55
 
57
- @events = EventListener.new
58
- @stats_engine = StatsEngine.new
59
- @transaction_sampler = TransactionSampler.new
60
- @sql_sampler = SqlSampler.new
61
- @agent_command_router = Commands::AgentCommandRouter.new @events
62
- @monitors = Monitors.new @events
63
- @error_collector = ErrorCollector.new @events
64
- @transaction_rules = RulesEngine.new
65
- @harvest_samplers = SamplerCollection.new @events
66
- @monotonic_gc_profiler = VM::MonotonicGCProfiler.new
67
- @javascript_instrumentor = JavascriptInstrumentor.new @events
68
- @adaptive_sampler = AdaptiveSampler.new(Agent.config[:sampling_target],
69
- Agent.config[:sampling_target_period_in_seconds])
70
-
71
- @harvester = Harvester.new @events
56
+ @events = EventListener.new
57
+ @stats_engine = StatsEngine.new
58
+ @transaction_sampler = TransactionSampler.new
59
+ @sql_sampler = SqlSampler.new
60
+ @agent_command_router = Commands::AgentCommandRouter.new @events
61
+ @monitors = Monitors.new @events
62
+ @error_collector = ErrorCollector.new @events
63
+ @transaction_rules = RulesEngine.new
64
+ @harvest_samplers = SamplerCollection.new @events
65
+ @monotonic_gc_profiler = VM::MonotonicGCProfiler.new
66
+ @javascript_instrumentor = JavascriptInstrumentor.new @events
67
+ @adaptive_sampler = AdaptiveSampler.new(Agent.config[:sampling_target],
68
+ Agent.config[:sampling_target_period_in_seconds])
69
+
70
+ @harvester = Harvester.new @events
72
71
  @after_fork_lock = Mutex.new
73
72
 
74
73
  @transaction_event_recorder = TransactionEventRecorder.new @events
75
- @custom_event_aggregator = CustomEventAggregator.new @events
76
- @span_event_aggregator = SpanEventAggregator.new @events
74
+ @custom_event_aggregator = CustomEventAggregator.new @events
75
+ @span_event_aggregator = SpanEventAggregator.new @events
77
76
 
78
- @connect_state = :pending
79
- @connect_attempts = 0
80
- @waited_on_connect = nil
81
- @connected_pid = nil
77
+ @connect_state = :pending
78
+ @connect_attempts = 0
79
+ @waited_on_connect = nil
80
+ @connected_pid = nil
82
81
 
83
82
  @wait_on_connect_mutex = Mutex.new
84
83
  @wait_on_connect_condition = ConditionVariable.new
@@ -110,7 +109,6 @@ module NewRelic
110
109
  # Holds all the methods defined on NewRelic::Agent::Agent
111
110
  # instances
112
111
  module InstanceMethods
113
-
114
112
  # the statistics engine that holds all the timeslice data
115
113
  attr_reader :stats_engine
116
114
  # the transaction sampler that handles recording transactions
@@ -184,7 +182,7 @@ module NewRelic
184
182
  # * <tt>:keep_retrying => false</tt> if we try to initiate a new
185
183
  # connection, this tells me to only try it once so this method returns
186
184
  # quickly if there is some kind of latency with the server.
187
- def after_fork(options={})
185
+ def after_fork(options = {})
188
186
  needs_restart = false
189
187
  @after_fork_lock.synchronize do
190
188
  needs_restart = @harvester.needs_restart?
@@ -284,7 +282,7 @@ module NewRelic
284
282
  # Sets a thread local variable as to whether we should or
285
283
  # should not record sql in the current thread. Returns the
286
284
  # previous value, if there is one
287
- def set_record_sql(should_record) #THREAD_LOCAL_ACCESS
285
+ def set_record_sql(should_record) # THREAD_LOCAL_ACCESS
288
286
  state = Tracer.state
289
287
  prev = state.record_sql
290
288
  state.record_sql = should_record
@@ -295,13 +293,13 @@ module NewRelic
295
293
  # thread. This uses a stack which allows us to disable tracing
296
294
  # children of a transaction without affecting the tracing of
297
295
  # the whole transaction
298
- def push_trace_execution_flag(should_trace=false) #THREAD_LOCAL_ACCESS
296
+ def push_trace_execution_flag(should_trace = false) # THREAD_LOCAL_ACCESS
299
297
  Tracer.state.push_traced(should_trace)
300
298
  end
301
299
 
302
300
  # Pop the current trace execution status. Restore trace execution status
303
301
  # to what it was before we pushed the current flag.
304
- def pop_trace_execution_flag #THREAD_LOCAL_ACCESS
302
+ def pop_trace_execution_flag # THREAD_LOCAL_ACCESS
305
303
  Tracer.state.pop_traced
306
304
  end
307
305
 
@@ -492,7 +490,7 @@ module NewRelic
492
490
  # after_fork call restarting the thread in deferred dispatchers.
493
491
  #
494
492
  # Treatment of @started and env report is important to get right.
495
- def setup_and_start_agent(options={})
493
+ def setup_and_start_agent(options = {})
496
494
  @started = true
497
495
  @harvester.mark_started
498
496
 
@@ -755,7 +753,7 @@ module NewRelic
755
753
  # Don't connect if we're already connected, or if we tried to connect
756
754
  # and were rejected with prejudice because of a license issue, unless
757
755
  # we're forced to by force_reconnect.
758
- def should_connect?(force=false)
756
+ def should_connect?(force = false)
759
757
  force || (!connected? && !disconnected?)
760
758
  end
761
759
 
@@ -788,7 +786,8 @@ module NewRelic
788
786
  def handle_license_error(error)
789
787
  ::NewRelic::Agent.logger.error( \
790
788
  error.message, \
791
- "Visit NewRelic.com to obtain a valid license key, or to upgrade your account.")
789
+ "Visit NewRelic.com to obtain a valid license key, or to upgrade your account."
790
+ )
792
791
  disconnect
793
792
  end
794
793
 
@@ -881,20 +880,19 @@ module NewRelic
881
880
  raise WaitOnConnectTimeout, "Agent was unable to connect in #{timeout} seconds."
882
881
  end
883
882
  end
884
-
885
883
  end
886
884
  include Connect
887
885
 
888
886
  def container_for_endpoint(endpoint)
889
887
  case endpoint
890
- when :metric_data then @stats_engine
888
+ when :metric_data then @stats_engine
891
889
  when :transaction_sample_data then @transaction_sampler
892
- when :error_data then @error_collector.error_trace_aggregator
893
- when :error_event_data then @error_collector.error_event_aggregator
894
- when :analytic_event_data then transaction_event_aggregator
895
- when :custom_event_data then @custom_event_aggregator
896
- when :span_event_data then span_event_aggregator
897
- when :sql_trace_data then @sql_sampler
890
+ when :error_data then @error_collector.error_trace_aggregator
891
+ when :error_event_data then @error_collector.error_event_aggregator
892
+ when :analytic_event_data then transaction_event_aggregator
893
+ when :custom_event_data then @custom_event_aggregator
894
+ when :span_event_data then span_event_aggregator
895
+ when :sql_trace_data then @sql_sampler
898
896
  end
899
897
  end
900
898
 
@@ -931,7 +929,7 @@ module NewRelic
931
929
  # This is useful primarily when re-establishing a new connection after
932
930
  # forking off from a parent process.
933
931
  #
934
- def connect(options={})
932
+ def connect(options = {})
935
933
  defaults = {
936
934
  :keep_retrying => Agent.config[:keep_retrying],
937
935
  :force_reconnect => Agent.config[:force_reconnect]
@@ -1067,7 +1065,7 @@ module NewRelic
1067
1065
 
1068
1066
  def harvest_and_send_analytic_event_data
1069
1067
  harvest_and_send_from_container(transaction_event_aggregator, :analytic_event_data)
1070
- harvest_and_send_from_container(synthetics_event_aggregator, :analytic_event_data)
1068
+ harvest_and_send_from_container(synthetics_event_aggregator, :analytic_event_data)
1071
1069
  end
1072
1070
 
1073
1071
  def harvest_and_send_custom_event_data
@@ -12,7 +12,7 @@ module NewRelic
12
12
  class AgentLogger
13
13
  include LogOnce
14
14
 
15
- def initialize(root = "", override_logger=nil)
15
+ def initialize(root = "", override_logger = nil)
16
16
  @already_logged_lock = Mutex.new
17
17
  clear_already_logged
18
18
  create_log(root, override_logger)
@@ -50,8 +50,8 @@ module NewRelic
50
50
  # the log level that the backtrace is logged at. If you just want the
51
51
  # default behavior of backtraces logged at debug, use one of the methods
52
52
  # above and pass an Exception as one of the args.
53
- def log_exception(level, e, backtrace_level=level)
54
- @log.send(level, "%p: %s" % [ e.class, e.message ])
53
+ def log_exception(level, e, backtrace_level = level)
54
+ @log.send(level, "%p: %s" % [e.class, e.message])
55
55
  @log.send(backtrace_level) do
56
56
  backtrace = backtrace_from_exception(e)
57
57
  if backtrace
@@ -136,8 +136,8 @@ module NewRelic
136
136
  end
137
137
 
138
138
  def find_or_create_file_path(path_setting, root)
139
- for abs_path in [ File.expand_path(path_setting),
140
- File.expand_path(File.join(root, path_setting)) ] do
139
+ for abs_path in [File.expand_path(path_setting),
140
+ File.expand_path(File.join(root, path_setting))] do
141
141
  if File.directory?(abs_path) || (Dir.mkdir(abs_path) rescue nil)
142
142
  return abs_path[%r{^(.*?)/?$}]
143
143
  end
@@ -151,10 +151,10 @@ module NewRelic
151
151
 
152
152
  LOG_LEVELS = {
153
153
  "debug" => ::Logger::DEBUG,
154
- "info" => ::Logger::INFO,
155
- "warn" => ::Logger::WARN,
154
+ "info" => ::Logger::INFO,
155
+ "warn" => ::Logger::WARN,
156
156
  "error" => ::Logger::ERROR,
157
- "fatal" => ::Logger::FATAL,
157
+ "fatal" => ::Logger::FATAL
158
158
  }
159
159
 
160
160
  def self.log_level_for(level)
@@ -176,7 +176,6 @@ module NewRelic
176
176
  def self.format_fatal_error message
177
177
  "** [NewRelic] FATAL : #{message}\n"
178
178
  end
179
-
180
179
  end
181
180
 
182
181
  # In an effort to not lose messages during startup, we trap them in memory