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
@@ -10,16 +10,16 @@ module NewRelic
10
10
 
11
11
  # Intrinsic Keys
12
12
  INTRINSIC_KEYS = [
13
- PARENT_TYPE_KEY = "parent.type",
14
- PARENT_APP_KEY = "parent.app",
15
- PARENT_ACCOUNT_ID_KEY = "parent.account",
16
- PARENT_TRANSPORT_TYPE_KEY = "parent.transportType",
17
- PARENT_TRANSPORT_DURATION_KEY = "parent.transportDuration",
18
- GUID_KEY = "guid",
19
- TRACE_ID_KEY = "traceId",
20
- PARENT_TRANSACTION_ID_KEY = "parentId",
21
- PARENT_SPAN_ID_KEY = "parentSpanId",
22
- SAMPLED_KEY = "sampled",
13
+ PARENT_TYPE_KEY = "parent.type",
14
+ PARENT_APP_KEY = "parent.app",
15
+ PARENT_ACCOUNT_ID_KEY = "parent.account",
16
+ PARENT_TRANSPORT_TYPE_KEY = "parent.transportType",
17
+ PARENT_TRANSPORT_DURATION_KEY = "parent.transportDuration",
18
+ GUID_KEY = "guid",
19
+ TRACE_ID_KEY = "traceId",
20
+ PARENT_TRANSACTION_ID_KEY = "parentId",
21
+ PARENT_SPAN_ID_KEY = "parentSpanId",
22
+ SAMPLED_KEY = "sampled"
23
23
  ].freeze
24
24
 
25
25
  # This method extracts intrinsics from the transaction_payload and
@@ -77,7 +77,6 @@ module NewRelic
77
77
  def enabled?
78
78
  return Agent.config[:'distributed_tracing.enabled']
79
79
  end
80
-
81
80
  end
82
81
  end
83
82
  end
@@ -17,26 +17,25 @@ module NewRelic
17
17
  class DistributedTracePayload
18
18
  extend Coerce
19
19
 
20
- VERSION = [0, 1].freeze
20
+ VERSION = [0, 1].freeze
21
21
  PARENT_TYPE = "App"
22
- POUND = '#'
22
+ POUND = '#'
23
23
 
24
24
  # Key names for serialization
25
- VERSION_KEY = 'v'
26
- DATA_KEY = 'd'
27
- PARENT_TYPE_KEY = 'ty'
25
+ VERSION_KEY = 'v'
26
+ DATA_KEY = 'd'
27
+ PARENT_TYPE_KEY = 'ty'
28
28
  PARENT_ACCOUNT_ID_KEY = 'ac'
29
- PARENT_APP_KEY = 'ap'
30
- TRUSTED_ACCOUNT_KEY = 'tk'
31
- ID_KEY = 'id'
32
- TX_KEY = 'tx'
33
- TRACE_ID_KEY = 'tr'
34
- SAMPLED_KEY = 'sa'
35
- TIMESTAMP_KEY = 'ti'
36
- PRIORITY_KEY = 'pr'
29
+ PARENT_APP_KEY = 'ap'
30
+ TRUSTED_ACCOUNT_KEY = 'tk'
31
+ ID_KEY = 'id'
32
+ TX_KEY = 'tx'
33
+ TRACE_ID_KEY = 'tr'
34
+ SAMPLED_KEY = 'sa'
35
+ TIMESTAMP_KEY = 'ti'
36
+ PRIORITY_KEY = 'pr'
37
37
 
38
38
  class << self
39
-
40
39
  def for_transaction transaction
41
40
  return nil unless connected?
42
41
 
@@ -64,17 +63,17 @@ module NewRelic
64
63
  payload_data = raw_payload[DATA_KEY]
65
64
 
66
65
  payload = new
67
- payload.version = raw_payload[VERSION_KEY]
68
- payload.parent_type = payload_data[PARENT_TYPE_KEY]
69
- payload.parent_account_id = payload_data[PARENT_ACCOUNT_ID_KEY]
70
- payload.parent_app_id = payload_data[PARENT_APP_KEY]
66
+ payload.version = raw_payload[VERSION_KEY]
67
+ payload.parent_type = payload_data[PARENT_TYPE_KEY]
68
+ payload.parent_account_id = payload_data[PARENT_ACCOUNT_ID_KEY]
69
+ payload.parent_app_id = payload_data[PARENT_APP_KEY]
71
70
  payload.trusted_account_key = payload_data[TRUSTED_ACCOUNT_KEY]
72
- payload.timestamp = payload_data[TIMESTAMP_KEY]
73
- payload.id = payload_data[ID_KEY]
74
- payload.transaction_id = payload_data[TX_KEY]
75
- payload.trace_id = payload_data[TRACE_ID_KEY]
76
- payload.sampled = payload_data[SAMPLED_KEY]
77
- payload.priority = payload_data[PRIORITY_KEY]
71
+ payload.timestamp = payload_data[TIMESTAMP_KEY]
72
+ payload.id = payload_data[ID_KEY]
73
+ payload.transaction_id = payload_data[TX_KEY]
74
+ payload.trace_id = payload_data[TRACE_ID_KEY]
75
+ payload.sampled = payload_data[SAMPLED_KEY]
76
+ payload.priority = payload_data[PRIORITY_KEY]
78
77
 
79
78
  payload
80
79
  end
@@ -110,16 +109,16 @@ module NewRelic
110
109
  end
111
110
 
112
111
  attr_accessor :version,
113
- :parent_type,
114
- :parent_account_id,
115
- :parent_app_id,
116
- :trusted_account_key,
117
- :id,
118
- :transaction_id,
119
- :trace_id,
120
- :sampled,
121
- :priority,
122
- :timestamp
112
+ :parent_type,
113
+ :parent_account_id,
114
+ :parent_app_id,
115
+ :trusted_account_key,
116
+ :id,
117
+ :transaction_id,
118
+ :trace_id,
119
+ :sampled,
120
+ :priority,
121
+ :timestamp
123
122
 
124
123
  alias_method :sampled?, :sampled
125
124
 
@@ -134,17 +133,17 @@ module NewRelic
134
133
  }
135
134
 
136
135
  result[DATA_KEY] = {
137
- PARENT_TYPE_KEY => parent_type,
136
+ PARENT_TYPE_KEY => parent_type,
138
137
  PARENT_ACCOUNT_ID_KEY => parent_account_id,
139
- PARENT_APP_KEY => parent_app_id,
140
- TX_KEY => transaction_id,
141
- TRACE_ID_KEY => trace_id,
142
- SAMPLED_KEY => sampled,
143
- PRIORITY_KEY => priority,
144
- TIMESTAMP_KEY => timestamp,
138
+ PARENT_APP_KEY => parent_app_id,
139
+ TX_KEY => transaction_id,
140
+ TRACE_ID_KEY => trace_id,
141
+ SAMPLED_KEY => sampled,
142
+ PRIORITY_KEY => priority,
143
+ TIMESTAMP_KEY => timestamp
145
144
  }
146
145
 
147
- result[DATA_KEY][ID_KEY] = id if id
146
+ result[DATA_KEY][ID_KEY] = id if id
148
147
  result[DATA_KEY][TRUSTED_ACCOUNT_KEY] = trusted_account_key if trusted_account_key
149
148
 
150
149
  JSON.dump(result)
@@ -17,12 +17,12 @@ module NewRelic
17
17
  "IronMQ",
18
18
  "AMQP",
19
19
  "Queue",
20
- "Other",
20
+ "Other"
21
21
  ].freeze
22
22
 
23
23
  URL_SCHEMES = {
24
- 'http' => NewRelic::HTTP,
25
- 'https' => NewRelic::HTTPS,
24
+ 'http' => NewRelic::HTTP,
25
+ 'https' => NewRelic::HTTPS
26
26
  }.freeze
27
27
 
28
28
  RACK_URL_SCHEME = 'rack.url_scheme'
@@ -11,24 +11,24 @@ module NewRelic
11
11
  class TraceContext
12
12
  VERSION = 0x0
13
13
 
14
- COMMA = ','
15
- EQUALS = '='
16
- INVALID_TRACE_ID = ('0' * 32)
14
+ COMMA = ','
15
+ EQUALS = '='
16
+ INVALID_TRACE_ID = ('0' * 32)
17
17
  INVALID_PARENT_ID = ('0' * 16)
18
- INVALID_VERSION = 'ff'
19
-
20
- TRACE_ID_KEY = 'trace_id'
21
- TRACE_FLAGS_KEY = 'trace_flags'
22
- PARENT_ID_KEY = 'parent_id'
23
- VERSION_KEY = 'version'
24
- UNDEFINED_FIELDS_KEY = 'undefined_fields'
25
-
26
- TP_VERSION = "(?<#{VERSION_KEY}>[a-f\\d]{2})"
27
- TP_TRACE_ID = "(?<#{TRACE_ID_KEY}>[a-f\\d]{32})"
28
- TP_PARENT_ID = "(?<#{PARENT_ID_KEY}>[a-f\\d]{16})"
29
- TP_TRACE_FLAGS = "(?<#{TRACE_FLAGS_KEY}>\\d{2})"
18
+ INVALID_VERSION = 'ff'
19
+
20
+ TRACE_ID_KEY = 'trace_id'
21
+ TRACE_FLAGS_KEY = 'trace_flags'
22
+ PARENT_ID_KEY = 'parent_id'
23
+ VERSION_KEY = 'version'
24
+ UNDEFINED_FIELDS_KEY = 'undefined_fields'
25
+
26
+ TP_VERSION = "(?<#{VERSION_KEY}>[a-f\\d]{2})"
27
+ TP_TRACE_ID = "(?<#{TRACE_ID_KEY}>[a-f\\d]{32})"
28
+ TP_PARENT_ID = "(?<#{PARENT_ID_KEY}>[a-f\\d]{16})"
29
+ TP_TRACE_FLAGS = "(?<#{TRACE_FLAGS_KEY}>\\d{2})"
30
30
  TP_UNDEFINED_FIELDS = "(?<#{UNDEFINED_FIELDS_KEY}>-[a-zA-Z\\d-]*)"
31
- TRACE_PARENT_REGEX = /\A#{TP_VERSION}-#{TP_TRACE_ID}-#{TP_PARENT_ID}-#{TP_TRACE_FLAGS}#{TP_UNDEFINED_FIELDS}?\z/
31
+ TRACE_PARENT_REGEX = /\A#{TP_VERSION}-#{TP_TRACE_ID}-#{TP_PARENT_ID}-#{TP_TRACE_FLAGS}#{TP_UNDEFINED_FIELDS}?\z/
32
32
 
33
33
  TRACE_PARENT_FORMAT_STRING = "%02x-%s-%s-%02x"
34
34
 
@@ -36,16 +36,16 @@ module NewRelic
36
36
  MAX_TRACE_STATE_ENTRY_SIZE = 128 # bytes
37
37
 
38
38
  SUPPORTABILITY_TRACE_PARENT_PARSE_EXCEPTION = "Supportability/TraceContext/TraceParent/Parse/Exception"
39
- SUPPORTABILITY_TRACE_STATE_PARSE_EXCEPTION = "Supportability/TraceContext/TraceState/Parse/Exception"
39
+ SUPPORTABILITY_TRACE_STATE_PARSE_EXCEPTION = "Supportability/TraceContext/TraceState/Parse/Exception"
40
40
  SUPPORTABILITY_TRACE_STATE_INVALID_NR_ENTRY = "Supportability/TraceContext/TraceState/InvalidNrEntry"
41
41
 
42
42
  class << self
43
43
  def insert format: NewRelic::FORMAT_NON_RACK,
44
- carrier: nil,
45
- parent_id: nil,
46
- trace_id: nil,
47
- trace_flags: nil,
48
- trace_state: nil
44
+ carrier: nil,
45
+ parent_id: nil,
46
+ trace_id: nil,
47
+ trace_flags: nil,
48
+ trace_state: nil
49
49
 
50
50
  trace_parent_header = trace_parent_header_for_format format
51
51
  carrier[trace_parent_header] = format_trace_parent \
@@ -58,8 +58,8 @@ module NewRelic
58
58
  end
59
59
 
60
60
  def parse format: NewRelic::FORMAT_NON_RACK,
61
- carrier: nil,
62
- trace_state_entry_key: nil
61
+ carrier: nil,
62
+ trace_state_entry_key: nil
63
63
  trace_parent = extract_traceparent(format, carrier)
64
64
  unless trace_parent_valid? trace_parent
65
65
  NewRelic::Agent.increment_metric SUPPORTABILITY_TRACE_PARENT_PARSE_EXCEPTION
@@ -84,13 +84,13 @@ module NewRelic
84
84
  private
85
85
 
86
86
  def format_trace_parent trace_id: nil,
87
- parent_id: nil,
88
- trace_flags: nil
87
+ parent_id: nil,
88
+ trace_flags: nil
89
89
  sprintf TRACE_PARENT_FORMAT_STRING,
90
- VERSION,
91
- trace_id,
92
- parent_id,
93
- trace_flags
90
+ VERSION,
91
+ trace_id,
92
+ parent_id,
93
+ trace_flags
94
94
  end
95
95
 
96
96
  def extract_traceparent format, carrier
@@ -158,9 +158,9 @@ module NewRelic
158
158
  trace_state_vendors.chomp! COMMA
159
159
 
160
160
  HeaderData.create trace_state_payload: payload ? decode_payload(payload) : nil,
161
- trace_state_entries: trace_state,
162
- trace_state_size: trace_state_size,
163
- trace_state_vendors: trace_state_vendors
161
+ trace_state_entries: trace_state,
162
+ trace_state_size: trace_state_size,
163
+ trace_state_vendors: trace_state_vendors
164
164
  end
165
165
 
166
166
  def decode_payload payload
@@ -176,15 +176,15 @@ module NewRelic
176
176
  class HeaderData
177
177
  class << self
178
178
  def create trace_parent: nil,
179
- trace_state_payload: nil,
180
- trace_state_entries: nil,
181
- trace_state_size: 0,
182
- trace_state_vendors: nil
179
+ trace_state_payload: nil,
180
+ trace_state_entries: nil,
181
+ trace_state_size: 0,
182
+ trace_state_vendors: nil
183
183
  new trace_parent, \
184
- trace_state_payload, \
185
- trace_state_entries, \
186
- trace_state_size, \
187
- trace_state_vendors
184
+ trace_state_payload, \
185
+ trace_state_entries, \
186
+ trace_state_size, \
187
+ trace_state_vendors
188
188
  end
189
189
  end
190
190
 
@@ -237,9 +237,7 @@ module NewRelic
237
237
 
238
238
  joined_trace_state
239
239
  end
240
-
241
240
  end
242
-
243
241
  end
244
242
  end
245
243
  end
@@ -15,21 +15,21 @@ module NewRelic
15
15
  TRUE_CHAR = '1'.freeze
16
16
  FALSE_CHAR = '0'.freeze
17
17
 
18
- PARENT_TYPES = %w(App Browser Mobile).map(&:freeze).freeze
18
+ PARENT_TYPES = %w[App Browser Mobile].map(&:freeze).freeze
19
19
 
20
20
  class << self
21
21
  def create version: VERSION,
22
- parent_type: PARENT_TYPE,
23
- parent_account_id: nil,
24
- parent_app_id: nil,
25
- id: nil,
26
- transaction_id: nil,
27
- sampled: nil,
28
- priority: nil,
29
- timestamp: now_ms
22
+ parent_type: PARENT_TYPE,
23
+ parent_account_id: nil,
24
+ parent_app_id: nil,
25
+ id: nil,
26
+ transaction_id: nil,
27
+ sampled: nil,
28
+ priority: nil,
29
+ timestamp: now_ms
30
30
 
31
31
  new version, parent_type, parent_account_id, parent_app_id, id,
32
- transaction_id, sampled, priority, timestamp
32
+ transaction_id, sampled, priority, timestamp
33
33
  end
34
34
 
35
35
  include NewRelic::Coerce
@@ -71,19 +71,19 @@ module NewRelic
71
71
  end
72
72
 
73
73
  attr_accessor :version,
74
- :parent_type_id,
75
- :parent_account_id,
76
- :parent_app_id,
77
- :id,
78
- :transaction_id,
79
- :sampled,
80
- :priority,
81
- :timestamp
74
+ :parent_type_id,
75
+ :parent_account_id,
76
+ :parent_app_id,
77
+ :id,
78
+ :transaction_id,
79
+ :sampled,
80
+ :priority,
81
+ :timestamp
82
82
 
83
83
  alias_method :sampled?, :sampled
84
84
 
85
85
  def initialize version, parent_type_id, parent_account_id, parent_app_id,
86
- id, transaction_id, sampled, priority, timestamp
86
+ id, transaction_id, sampled, priority, timestamp
87
87
  @version = version
88
88
  @parent_type_id = parent_type_id
89
89
  @parent_account_id = parent_account_id
@@ -111,14 +111,14 @@ module NewRelic
111
111
 
112
112
  def to_s
113
113
  result = version.to_s # required
114
- result << DELIMITER << parent_type_id.to_s # required
115
- result << DELIMITER << parent_account_id # required
116
- result << DELIMITER << parent_app_id # required
114
+ result << DELIMITER << parent_type_id.to_s # required
115
+ result << DELIMITER << parent_account_id # required
116
+ result << DELIMITER << parent_app_id # required
117
117
  result << DELIMITER << (id || NewRelic::EMPTY_STR)
118
118
  result << DELIMITER << (transaction_id || NewRelic::EMPTY_STR)
119
119
  result << DELIMITER << (sampled ? TRUE_CHAR : FALSE_CHAR)
120
120
  result << DELIMITER << sprintf("%.6f", priority)
121
- result << DELIMITER << timestamp.to_s # required
121
+ result << DELIMITER << timestamp.to_s # required
122
122
  result
123
123
  end
124
124
  end
@@ -23,7 +23,7 @@ module NewRelic
23
23
  module DistributedTracing
24
24
  extend NewRelic::SupportabilityHelper
25
25
  extend self
26
-
26
+
27
27
  # Adds the Distributed Trace headers so that the downstream service can participate in a
28
28
  # distributed trace. This method should be called every time an outbound call is made
29
29
  # since the header payload contains a timestamp.
@@ -34,7 +34,7 @@ module NewRelic
34
34
  # New Relic distributed tracing header by default. New Relic headers may be suppressed by
35
35
  # setting +exclude_new_relic_header+ to +true+ in your configuration file.
36
36
  #
37
- # @param headers [Hash] Is a Hash to which the distributed trace headers
37
+ # @param headers [Hash] Is a Hash to which the distributed trace headers
38
38
  # will be inserted.
39
39
  #
40
40
  # @return {Transaction} The transaction the headers were inserted from,
@@ -42,7 +42,7 @@ module NewRelic
42
42
  #
43
43
  # @api public
44
44
  #
45
- def insert_distributed_trace_headers headers={}
45
+ def insert_distributed_trace_headers headers = {}
46
46
  record_api_supportability_metric(:insert_distributed_trace_headers)
47
47
 
48
48
  unless Agent.config[:'distributed_tracing.enabled']
@@ -61,11 +61,11 @@ module NewRelic
61
61
  nil
62
62
  end
63
63
 
64
- # Accepts distributed tracing headers from any source that has been packaged
64
+ # Accepts distributed tracing headers from any source that has been packaged
65
65
  # as a Ruby Hash, thereby allowing the user to manually inject distributed
66
- # tracing headers. It is optimized to process +HTTP_TRACEPARENT+, +HTTP_TRACESTATE+,
67
- # and +HTTP_NEWRELIC+ as the given Hash keys. which is the most common scenario
68
- # from Rack middleware in most Ruby applications. However, the Hash keys are
66
+ # tracing headers. It is optimized to process +HTTP_TRACEPARENT+, +HTTP_TRACESTATE+,
67
+ # and +HTTP_NEWRELIC+ as the given Hash keys. which is the most common scenario
68
+ # from Rack middleware in most Ruby applications. However, the Hash keys are
69
69
  # case-insensitive and the "HTTP_" prefixes may also be omitted.
70
70
  #
71
71
  # Calling this method is not necessary in a typical HTTP trace as
@@ -75,13 +75,13 @@ module NewRelic
75
75
  # as calling after the headers are already created will have no effect.
76
76
  #
77
77
  # This method accepts both W3C trace context and New Relic distributed tracing headers.
78
- # When both are present, only the W3C headers are utilized. When W3C trace context
78
+ # When both are present, only the W3C headers are utilized. When W3C trace context
79
79
  # headers are present, New Relic headers are ignored regardless if W3C trace context
80
- # headers are valid and parsable.
80
+ # headers are valid and parsable.
81
81
  #
82
- # @param headers [Hash] Incoming distributed trace headers as a Ruby
82
+ # @param headers [Hash] Incoming distributed trace headers as a Ruby
83
83
  # Hash object. Hash keys are expected to be one of
84
- # +TRACEPARENT+, +TRACESTATE+, +NEWRELIC+ and are
84
+ # +TRACEPARENT+, +TRACESTATE+, +NEWRELIC+ and are
85
85
  # case-insensitive, with or without "HTTP_" prefixes.
86
86
  #
87
87
  # either as a JSON string or as a
@@ -113,14 +113,14 @@ module NewRelic
113
113
  # otherwise, fish for key/value pairs regardless of prefix and case-sensitivity.
114
114
  hdr = if transport_type.start_with? NewRelic::HTTP
115
115
  headers
116
- else
116
+ else
117
117
  # start with the most common case first
118
118
  hdr = {
119
119
  NewRelic::HTTP_TRACEPARENT_KEY => headers[NewRelic::TRACEPARENT_KEY],
120
- NewRelic::HTTP_TRACESTATE_KEY => headers[NewRelic::TRACESTATE_KEY],
120
+ NewRelic::HTTP_TRACESTATE_KEY => headers[NewRelic::TRACESTATE_KEY],
121
121
  NewRelic::HTTP_NEWRELIC_KEY => headers[NewRelic::NEWRELIC_KEY]
122
- }
123
-
122
+ }
123
+
124
124
  # when not found, search for any casing for trace context headers, ignoring potential prefixes
125
125
  hdr[NewRelic::HTTP_TRACEPARENT_KEY] ||= variant_key_value headers, NewRelic::TRACEPARENT_KEY
126
126
  hdr[NewRelic::HTTP_TRACESTATE_KEY] ||= variant_key_value headers, NewRelic::TRACESTATE_KEY
@@ -134,7 +134,7 @@ module NewRelic
134
134
  NewRelic::Agent.logger.error 'error during accept_distributed_trace_headers', e
135
135
  nil
136
136
  end
137
-
137
+
138
138
  private
139
139
 
140
140
  def has_variant_key? key, variants
@@ -142,9 +142,8 @@ module NewRelic
142
142
  end
143
143
 
144
144
  def variant_key_value headers, variants
145
- (headers.detect{|k, v| has_variant_key?(k, variants)} || NewRelic::EMPTY_ARRAY)[1]
145
+ (headers.detect { |k, v| has_variant_key?(k, variants) } || NewRelic::EMPTY_ARRAY)[1]
146
146
  end
147
-
148
147
  end
149
148
  end
150
149
  end
@@ -24,7 +24,7 @@ module NewRelic
24
24
  return object if object.empty?
25
25
  hash = {}
26
26
  object.each_pair do |k, v|
27
- k = normalize_string(k) if k.is_a?(String)
27
+ k = normalize_string(k) if k.is_a?(String)
28
28
  k = normalize_string(k.to_s) if k.is_a?(Symbol)
29
29
  hash[k] = normalize_object(v)
30
30
  end
@@ -24,10 +24,10 @@ module NewRelic
24
24
 
25
25
  @error_filter = NewRelic::Agent::ErrorFilter.new
26
26
 
27
- %w(
27
+ %w[
28
28
  ignore_errors ignore_classes ignore_messages ignore_status_codes
29
29
  expected_classes expected_messages expected_status_codes
30
- ).each do |w|
30
+ ].each do |w|
31
31
  Agent.config.register_callback(:"error_collector.#{w}") do |value|
32
32
  @error_filter.load_from_config(w, value)
33
33
  end
@@ -165,10 +165,10 @@ module NewRelic
165
165
  end
166
166
 
167
167
  # Increments a statistic that tracks total error rate
168
- def increment_error_count!(state, exception, options={})
168
+ def increment_error_count!(state, exception, options = {})
169
169
  txn = state.current_transaction
170
170
 
171
- metric_names = aggregated_metric_names(txn)
171
+ metric_names = aggregated_metric_names(txn)
172
172
  blamed_metric = blamed_metric_name(txn, options)
173
173
  metric_names << blamed_metric if blamed_metric
174
174
 
@@ -187,9 +187,9 @@ module NewRelic
187
187
 
188
188
  def skip_notice_error?(exception, status_code = nil)
189
189
  disabled? ||
190
- exception.nil? ||
191
- exception_tagged_with?(EXCEPTION_TAG_IVAR, exception) ||
192
- error_is_ignored?(exception, status_code)
190
+ exception.nil? ||
191
+ exception_tagged_with?(EXCEPTION_TAG_IVAR, exception) ||
192
+ error_is_ignored?(exception, status_code)
193
193
  end
194
194
 
195
195
  # calls a method on an object, if it responds to it - used for
@@ -202,14 +202,14 @@ module NewRelic
202
202
  # extracts a stack trace from the exception for debugging purposes
203
203
  def extract_stack_trace(exception)
204
204
  actual_exception = if defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR < 5
205
- sense_method(exception, :original_exception) || exception
206
- else
207
- exception
208
- end
205
+ sense_method(exception, :original_exception) || exception
206
+ else
207
+ exception
208
+ end
209
209
  sense_method(actual_exception, :backtrace) || '<no stack trace>'
210
210
  end
211
211
 
212
- def notice_segment_error(segment, exception, options={})
212
+ def notice_segment_error(segment, exception, options = {})
213
213
  return if skip_notice_error?(exception)
214
214
 
215
215
  segment.set_noticed_error create_noticed_error(exception, options)
@@ -220,7 +220,7 @@ module NewRelic
220
220
  end
221
221
 
222
222
  # See NewRelic::Agent.notice_error for options and commentary
223
- def notice_error(exception, options={}, span_id=nil)
223
+ def notice_error(exception, options = {}, span_id = nil)
224
224
  state = ::NewRelic::Agent::Tracer.state
225
225
  transaction = state.current_transaction
226
226
  status_code = transaction ? transaction.http_response_code : nil
@@ -239,7 +239,7 @@ module NewRelic
239
239
  error_trace_aggregator.add_to_error_queue(noticed_error)
240
240
  transaction = state.current_transaction
241
241
  payload = transaction ? transaction.payload : nil
242
- span_id ||= (transaction && transaction.current_segment) ? transaction.current_segment.guid : nil
242
+ span_id ||= transaction && transaction.current_segment ? transaction.current_segment.guid : nil
243
243
  error_event_aggregator.record(noticed_error, payload, span_id)
244
244
  exception
245
245
  rescue => e
@@ -247,7 +247,7 @@ module NewRelic
247
247
  nil
248
248
  end
249
249
 
250
- def truncate_trace(trace, keep_frames=nil)
250
+ def truncate_trace(trace, keep_frames = nil)
251
251
  keep_frames ||= Agent.config[:'error_collector.max_backtrace_frames']
252
252
  return trace if !keep_frames || trace.length < keep_frames || trace.length == 0
253
253
 
@@ -267,9 +267,9 @@ module NewRelic
267
267
  noticed_error = NewRelic::NoticedError.new(error_metric, exception)
268
268
  noticed_error.request_uri = options.delete(:uri) || NewRelic::EMPTY_STR
269
269
  noticed_error.request_port = options.delete(:port)
270
- noticed_error.attributes = options.delete(:attributes)
270
+ noticed_error.attributes = options.delete(:attributes)
271
271
 
272
- noticed_error.file_name = sense_method(exception, :file_name)
272
+ noticed_error.file_name = sense_method(exception, :file_name)
273
273
  noticed_error.line_number = sense_method(exception, :line_number)
274
274
  noticed_error.stack_trace = truncate_trace(extract_stack_trace(exception))
275
275
 
@@ -16,7 +16,7 @@ module NewRelic
16
16
  named :ErrorEventAggregator
17
17
  capacity_key :'error_collector.max_event_samples_stored'
18
18
  enabled_keys :'error_collector.enabled',
19
- :'error_collector.capture_events'
19
+ :'error_collector.capture_events'
20
20
  buffer_class PrioritySampledBuffer
21
21
 
22
22
  def record noticed_error, transaction_payload = nil, span_id = nil
@@ -4,11 +4,9 @@
4
4
 
5
5
  module NewRelic
6
6
  module Agent
7
-
8
7
  # Handles loading of ignored and expected errors from the agent configuration, and
9
8
  # determining at runtime whether an exception is ignored or expected.
10
9
  class ErrorFilter
11
-
12
10
  def initialize
13
11
  reset
14
12
  end
@@ -20,10 +18,10 @@ module NewRelic
20
18
  end
21
19
 
22
20
  def load_all
23
- %i(
21
+ %i[
24
22
  ignore_errors ignore_classes ignore_messages ignore_status_codes
25
23
  expected_classes expected_messages expected_status_codes
26
- ).each { |setting| load_from_config(setting) }
24
+ ].each { |setting| load_from_config(setting) }
27
25
  end
28
26
 
29
27
  def load_from_config(setting, value = nil)
@@ -127,7 +125,7 @@ module NewRelic
127
125
  ::NewRelic::Agent.logger.debug("Ignoring errors of type '#{error}'")
128
126
  end
129
127
  when :ignore_messages
130
- errors.each do |error,messages|
128
+ errors.each do |error, messages|
131
129
  ::NewRelic::Agent.logger.debug("Ignoring errors of type '#{error}' with messages: #{messages.join(',')}")
132
130
  end
133
131
  when :ignore_status_codes
@@ -137,7 +135,7 @@ module NewRelic
137
135
  ::NewRelic::Agent.logger.debug("Expecting errors of type '#{error}'")
138
136
  end
139
137
  when :expected_messages
140
- errors.each do |error,messages|
138
+ errors.each do |error, messages|
141
139
  ::NewRelic::Agent.logger.debug("Expecting errors of type '#{error}' with messages: #{messages.join(',')}")
142
140
  end
143
141
  when :expected_status_codes
@@ -153,7 +151,7 @@ module NewRelic
153
151
  [codes]
154
152
  else
155
153
  codes
156
- end
154
+ end
157
155
  result = []
158
156
  code_list.each do |code|
159
157
  result << code && next if code.is_a?(Integer)
@@ -172,4 +170,4 @@ module NewRelic
172
170
  end
173
171
  end
174
172
  end
175
- end
173
+ end