newrelic_rpm 8.2.0 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +1938 -0
  4. data/Brewfile +10 -0
  5. data/CHANGELOG.md +80 -2
  6. data/CONTRIBUTING.md +19 -3
  7. data/DOCKER.md +167 -0
  8. data/Dockerfile +10 -0
  9. data/Guardfile +8 -8
  10. data/Rakefile +14 -9
  11. data/bin/mongrel_rpm +8 -9
  12. data/bin/newrelic +1 -1
  13. data/bin/nrdebug +14 -14
  14. data/docker-compose.yml +85 -0
  15. data/init.rb +0 -2
  16. data/lefthook.yml +9 -0
  17. data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
  18. data/lib/new_relic/agent/agent.rb +38 -40
  19. data/lib/new_relic/agent/agent_logger.rb +8 -9
  20. data/lib/new_relic/agent/attribute_filter.rb +31 -31
  21. data/lib/new_relic/agent/attributes.rb +2 -2
  22. data/lib/new_relic/agent/autostart.rb +6 -7
  23. data/lib/new_relic/agent/commands/agent_command.rb +2 -2
  24. data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
  25. data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
  26. data/lib/new_relic/agent/configuration/default_source.rb +347 -330
  27. data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
  28. data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
  29. data/lib/new_relic/agent/configuration/event_harvest_config.rb +11 -6
  30. data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
  31. data/lib/new_relic/agent/configuration/manager.rb +74 -63
  32. data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
  33. data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
  34. data/lib/new_relic/agent/configuration/server_source.rb +11 -11
  35. data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
  36. data/lib/new_relic/agent/connect/request_builder.rb +13 -16
  37. data/lib/new_relic/agent/connect/response_handler.rb +0 -3
  38. data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
  39. data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
  40. data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
  41. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
  42. data/lib/new_relic/agent/database.rb +20 -24
  43. data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
  44. data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
  45. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
  46. data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
  47. data/lib/new_relic/agent/datastores/redis.rb +2 -4
  48. data/lib/new_relic/agent/datastores.rb +1 -3
  49. data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
  50. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
  51. data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
  52. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
  53. data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
  54. data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
  55. data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +23 -23
  56. data/lib/new_relic/agent/distributed_tracing.rb +17 -18
  57. data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
  58. data/lib/new_relic/agent/error_collector.rb +17 -17
  59. data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
  60. data/lib/new_relic/agent/error_filter.rb +6 -8
  61. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
  62. data/lib/new_relic/agent/event_aggregator.rb +1 -1
  63. data/lib/new_relic/agent/event_buffer.rb +6 -7
  64. data/lib/new_relic/agent/event_listener.rb +0 -1
  65. data/lib/new_relic/agent/event_loop.rb +10 -10
  66. data/lib/new_relic/agent/external.rb +1 -2
  67. data/lib/new_relic/agent/guid_generator.rb +2 -9
  68. data/lib/new_relic/agent/harvester.rb +3 -4
  69. data/lib/new_relic/agent/heap.rb +1 -3
  70. data/lib/new_relic/agent/hostname.rb +3 -3
  71. data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
  72. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
  73. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
  74. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
  75. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
  76. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +2 -3
  77. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
  78. data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
  79. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
  80. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
  81. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
  82. data/lib/new_relic/agent/instrumentation/active_job.rb +4 -4
  83. data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
  84. data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
  85. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
  86. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
  87. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
  88. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
  89. data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
  90. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
  91. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  92. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
  93. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
  94. data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
  95. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
  96. data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
  97. data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
  98. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
  99. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -6
  100. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
  101. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
  102. data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
  103. data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
  104. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
  105. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  106. data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
  107. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
  108. data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
  109. data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
  110. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
  111. data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
  112. data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
  113. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +0 -1
  114. data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
  115. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -1
  116. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
  117. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -0
  118. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
  119. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +5 -6
  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/instrumentation.rb +3 -2
  127. data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
  128. data/lib/new_relic/agent/instrumentation/padrino.rb +0 -5
  129. data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
  130. data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
  131. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
  132. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
  133. data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
  134. data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
  135. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
  136. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
  137. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
  138. data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
  139. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
  140. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  141. data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
  142. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
  143. data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
  144. data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
  145. data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
  146. data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
  147. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
  148. data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
  149. data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
  150. data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
  151. data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
  152. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
  153. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
  154. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
  155. data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
  156. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +0 -1
  157. data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
  158. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
  159. data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
  160. data/lib/new_relic/agent/internal_agent_error.rb +1 -1
  161. data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
  162. data/lib/new_relic/agent/logging.rb +8 -4
  163. data/lib/new_relic/agent/memory_logger.rb +1 -1
  164. data/lib/new_relic/agent/messaging.rb +42 -44
  165. data/lib/new_relic/agent/method_tracer.rb +11 -14
  166. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  167. data/lib/new_relic/agent/monitors/cross_app_monitor.rb +13 -12
  168. data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
  169. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
  170. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
  171. data/lib/new_relic/agent/monitors.rb +1 -2
  172. data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
  173. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
  174. data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
  175. data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
  176. data/lib/new_relic/agent/new_relic_service.rb +20 -20
  177. data/lib/new_relic/agent/noticible_error.rb +0 -2
  178. data/lib/new_relic/agent/null_logger.rb +6 -2
  179. data/lib/new_relic/agent/obfuscator.rb +6 -8
  180. data/lib/new_relic/agent/parameter_filtering.rb +16 -8
  181. data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
  182. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  183. data/lib/new_relic/agent/pipe_service.rb +1 -1
  184. data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
  185. data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
  186. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
  187. data/lib/new_relic/agent/rules_engine.rb +2 -2
  188. data/lib/new_relic/agent/sampler.rb +2 -3
  189. data/lib/new_relic/agent/sampler_collection.rb +2 -3
  190. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +3 -3
  191. data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
  192. data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
  193. data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
  194. data/lib/new_relic/agent/span_event_primitive.rb +39 -39
  195. data/lib/new_relic/agent/sql_sampler.rb +9 -9
  196. data/lib/new_relic/agent/stats.rb +16 -16
  197. data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
  198. data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
  199. data/lib/new_relic/agent/stats_engine.rb +6 -6
  200. data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -2
  201. data/lib/new_relic/agent/system_info.rb +22 -20
  202. data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
  203. data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
  204. data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
  205. data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
  206. data/lib/new_relic/agent/tracer.rb +37 -43
  207. data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
  208. data/lib/new_relic/agent/transaction/datastore_segment.rb +5 -7
  209. data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -9
  210. data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
  211. data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -5
  212. data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
  213. data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
  214. data/lib/new_relic/agent/transaction/segment.rb +3 -3
  215. data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
  216. data/lib/new_relic/agent/transaction/trace.rb +8 -8
  217. data/lib/new_relic/agent/transaction/trace_context.rb +14 -16
  218. data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
  219. data/lib/new_relic/agent/transaction/tracing.rb +1 -3
  220. data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
  221. data/lib/new_relic/agent/transaction.rb +79 -81
  222. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
  223. data/lib/new_relic/agent/transaction_event_aggregator.rb +7 -8
  224. data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
  225. data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
  226. data/lib/new_relic/agent/transaction_metrics.rb +3 -3
  227. data/lib/new_relic/agent/transaction_sampler.rb +0 -1
  228. data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
  229. data/lib/new_relic/agent/utilization/aws.rb +32 -2
  230. data/lib/new_relic/agent/utilization/azure.rb +1 -1
  231. data/lib/new_relic/agent/utilization/vendor.rb +15 -2
  232. data/lib/new_relic/agent/utilization_data.rb +3 -4
  233. data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
  234. data/lib/new_relic/agent/vm/snapshot.rb +3 -3
  235. data/lib/new_relic/agent/worker_loop.rb +3 -5
  236. data/lib/new_relic/agent.rb +22 -22
  237. data/lib/new_relic/cli/command.rb +15 -17
  238. data/lib/new_relic/cli/commands/deployments.rb +20 -22
  239. data/lib/new_relic/cli/commands/install.rb +6 -10
  240. data/lib/new_relic/coerce.rb +5 -8
  241. data/lib/new_relic/collection_helper.rb +48 -47
  242. data/lib/new_relic/control/class_methods.rb +2 -2
  243. data/lib/new_relic/control/frameworks/external.rb +1 -1
  244. data/lib/new_relic/control/frameworks/rails.rb +5 -6
  245. data/lib/new_relic/control/frameworks/rails3.rb +2 -3
  246. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  247. data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
  248. data/lib/new_relic/control/instance_methods.rb +4 -5
  249. data/lib/new_relic/control/instrumentation.rb +4 -5
  250. data/lib/new_relic/control/server_methods.rb +2 -3
  251. data/lib/new_relic/control.rb +0 -1
  252. data/lib/new_relic/dependency_detection.rb +6 -8
  253. data/lib/new_relic/environment_report.rb +16 -18
  254. data/lib/new_relic/helper.rb +5 -5
  255. data/lib/new_relic/language_support.rb +3 -2
  256. data/lib/new_relic/latest_changes.rb +2 -2
  257. data/lib/new_relic/local_environment.rb +7 -7
  258. data/lib/new_relic/metric_data.rb +6 -7
  259. data/lib/new_relic/metric_spec.rb +3 -3
  260. data/lib/new_relic/noticed_error.rb +14 -15
  261. data/lib/new_relic/rack/agent_middleware.rb +2 -2
  262. data/lib/new_relic/rack/browser_monitoring.rb +9 -9
  263. data/lib/new_relic/recipes/capistrano3.rb +11 -13
  264. data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
  265. data/lib/new_relic/supportability_helper.rb +1 -2
  266. data/lib/new_relic/version.rb +4 -15
  267. data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
  268. data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
  269. data/lib/tasks/all.rb +1 -1
  270. data/lib/tasks/config.rake +21 -21
  271. data/lib/tasks/multiverse.rb +4 -6
  272. data/lib/tasks/tests.rake +3 -7
  273. data/newrelic.yml +3 -3
  274. data/newrelic_rpm.gemspec +13 -12
  275. data/recipes/newrelic.rb +1 -1
  276. data/test/agent_helper.rb +55 -55
  277. metadata +38 -4
@@ -12,7 +12,7 @@ module NewRelic
12
12
 
13
13
  attr_reader :start_time, :root_node
14
14
  attr_accessor :transaction_name, :guid, :attributes,
15
- :node_count, :finished, :threshold, :profile
15
+ :node_count, :finished, :threshold, :profile
16
16
 
17
17
  ROOT = "ROOT".freeze
18
18
 
@@ -31,7 +31,7 @@ module NewRelic
31
31
  node_count = 0
32
32
  each_node do |node|
33
33
  next if node == root_node
34
- node_count +=1
34
+ node_count += 1
35
35
  end
36
36
  node_count
37
37
  end
@@ -103,20 +103,20 @@ module NewRelic
103
103
  @root_node.each_node_with_nest_tracking(&block)
104
104
  end
105
105
 
106
- AGENT_ATTRIBUTES_KEY = 'agentAttributes'.freeze
107
- USER_ATTRIBUTES_KEY = 'userAttributes'.freeze
106
+ AGENT_ATTRIBUTES_KEY = 'agentAttributes'.freeze
107
+ USER_ATTRIBUTES_KEY = 'userAttributes'.freeze
108
108
  INTRINSIC_ATTRIBUTES_KEY = 'intrinsics'.freeze
109
109
 
110
110
  def attributes_for_tracer_destination
111
111
  destination = NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER
112
112
 
113
- agent_attributes = self.attributes.agent_attributes_for(destination)
114
- custom_attributes = self.attributes.custom_attributes_for(destination)
113
+ agent_attributes = self.attributes.agent_attributes_for(destination)
114
+ custom_attributes = self.attributes.custom_attributes_for(destination)
115
115
  intrinsic_attributes = self.attributes.intrinsic_attributes_for(destination)
116
116
 
117
117
  {
118
- AGENT_ATTRIBUTES_KEY => agent_attributes,
119
- USER_ATTRIBUTES_KEY => custom_attributes,
118
+ AGENT_ATTRIBUTES_KEY => agent_attributes,
119
+ USER_ATTRIBUTES_KEY => custom_attributes,
120
120
  INTRINSIC_ATTRIBUTES_KEY => intrinsic_attributes
121
121
  }
122
122
  end
@@ -21,24 +21,24 @@ module NewRelic
21
21
  end
22
22
  end
23
23
 
24
- SUPPORTABILITY_PREFIX = "Supportability/TraceContext"
25
- CREATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/Create"
26
- ACCEPT_PREFIX = "#{SUPPORTABILITY_PREFIX}/Accept"
27
- TRACESTATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/TraceState"
24
+ SUPPORTABILITY_PREFIX = "Supportability/TraceContext"
25
+ CREATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/Create"
26
+ ACCEPT_PREFIX = "#{SUPPORTABILITY_PREFIX}/Accept"
27
+ TRACESTATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/TraceState"
28
28
 
29
- CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
30
- CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
29
+ CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
30
+ CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
31
31
 
32
- ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
33
- ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
34
- IGNORE_MULTIPLE_ACCEPT_METRIC = "#{ACCEPT_PREFIX}/Ignored/Multiple"
32
+ ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
33
+ ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
34
+ IGNORE_MULTIPLE_ACCEPT_METRIC = "#{ACCEPT_PREFIX}/Ignored/Multiple"
35
35
  IGNORE_ACCEPT_AFTER_CREATE_METRIC = "#{ACCEPT_PREFIX}/Ignored/CreateBeforeAccept"
36
36
 
37
- NO_NR_ENTRY_TRACESTATE_METRIC = "#{TRACESTATE_PREFIX}/NoNrEntry"
37
+ NO_NR_ENTRY_TRACESTATE_METRIC = "#{TRACESTATE_PREFIX}/NoNrEntry"
38
38
  INVALID_TRACESTATE_PAYLOAD_METRIC = "#{TRACESTATE_PREFIX}/InvalidNrEntry"
39
39
 
40
40
  attr_accessor :trace_context_header_data
41
- attr_reader :trace_state_payload
41
+ attr_reader :trace_state_payload
42
42
 
43
43
  def trace_parent_header_present? request
44
44
  request[NewRelic::HTTP_TRACEPARENT_KEY]
@@ -48,7 +48,7 @@ module NewRelic
48
48
  header_data = NewRelic::Agent::DistributedTracing::TraceContext.parse(
49
49
  format: NewRelic::FORMAT_RACK,
50
50
  carrier: request,
51
- trace_state_entry_key: AccountHelpers.trace_state_entry_key,
51
+ trace_state_entry_key: AccountHelpers.trace_state_entry_key
52
52
  )
53
53
  return if header_data.nil?
54
54
 
@@ -56,7 +56,7 @@ module NewRelic
56
56
  end
57
57
  private :accept_trace_context_incoming_request
58
58
 
59
- def insert_trace_context_header header, format=NewRelic::FORMAT_NON_RACK
59
+ def insert_trace_context_header header, format = NewRelic::FORMAT_NON_RACK
60
60
  return unless Agent.config[:'distributed_tracing.enabled']
61
61
 
62
62
  NewRelic::Agent::DistributedTracing::TraceContext.insert \
@@ -98,9 +98,8 @@ module NewRelic
98
98
  return
99
99
  end
100
100
 
101
-
102
101
  span_guid = Agent.config[:'span_events.enabled'] ? transaction.current_segment.guid : nil
103
- transaction_guid = Agent.config[:'analytics_events.enabled'] ? transaction.guid : nil
102
+ transaction_guid = Agent.config[:'transaction_events.enabled'] ? transaction.guid : nil
104
103
 
105
104
  TraceContextPayload.create \
106
105
  parent_account_id: Agent.config[:account_id],
@@ -161,7 +160,6 @@ module NewRelic
161
160
  def trace_context_inserted?
162
161
  @trace_context_inserted ||= false
163
162
  end
164
-
165
163
  end
166
164
  end
167
165
  end
@@ -17,13 +17,13 @@ module NewRelic
17
17
 
18
18
  UNKNOWN_NODE_NAME = '<unknown>'.freeze
19
19
 
20
- def initialize(metric_name, relative_start, relative_end=nil, params=nil, parent=nil)
20
+ def initialize(metric_name, relative_start, relative_end = nil, params = nil, parent = nil)
21
21
  @entry_timestamp = relative_start
22
- @metric_name = metric_name || UNKNOWN_NODE_NAME
23
- @exit_timestamp = relative_end
24
- @children = nil
25
- @params = select_allowed_params(params)
26
- @parent_node = parent
22
+ @metric_name = metric_name || UNKNOWN_NODE_NAME
23
+ @exit_timestamp = relative_end
24
+ @children = nil
25
+ @params = select_allowed_params(params)
26
+ @parent_node = parent
27
27
  end
28
28
 
29
29
  def select_allowed_params params
@@ -44,23 +44,23 @@ module NewRelic
44
44
  end
45
45
 
46
46
  def to_array
47
- params = @params ? @params : NewRelic::EMPTY_HASH
48
- [ NewRelic::Helper.time_to_millis(@entry_timestamp),
47
+ params = @params || NewRelic::EMPTY_HASH
48
+ [NewRelic::Helper.time_to_millis(@entry_timestamp),
49
49
  NewRelic::Helper.time_to_millis(@exit_timestamp),
50
50
  NewRelic::Coerce.string(@metric_name),
51
- params ] +
52
- [ (@children ? @children.map{|s| s.to_array} : NewRelic::EMPTY_ARRAY) ]
51
+ params] +
52
+ [(@children ? @children.map { |s| s.to_array } : NewRelic::EMPTY_ARRAY)]
53
53
  end
54
54
 
55
55
  def path_string
56
- "#{metric_name}[#{children.collect {|node| node.path_string }.join('')}]"
56
+ "#{metric_name}[#{children.collect { |node| node.path_string }.join('')}]"
57
57
  end
58
58
 
59
59
  def to_s_compact
60
60
  str = ""
61
61
  str << metric_name
62
62
  if children.any?
63
- str << "{#{children.map { | cs | cs.to_s_compact }.join(",")}}"
63
+ str << "{#{children.map { |cs| cs.to_s_compact }.join(",")}}"
64
64
  end
65
65
  str
66
66
  end
@@ -68,9 +68,9 @@ module NewRelic
68
68
  def to_debug_str(depth)
69
69
  tab = " " * depth
70
70
  s = tab.clone
71
- s << ">> #{'%3i ms' % (@entry_timestamp*1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
71
+ s << ">> #{'%3i ms' % (@entry_timestamp * 1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
72
72
  unless params.empty?
73
- params.each do |k,v|
73
+ params.each do |k, v|
74
74
  s << "#{tab} -#{'%-16s' % k}: #{v.to_s[0..80]}\n"
75
75
  end
76
76
  end
@@ -80,7 +80,7 @@ module NewRelic
80
80
  s << tab + "<< "
81
81
  s << case @exit_timestamp
82
82
  when nil then ' n/a'
83
- when Numeric then '%3i ms' % (@exit_timestamp*1000)
83
+ when Numeric then '%3i ms' % (@exit_timestamp * 1000)
84
84
  else @exit_timestamp.to_s
85
85
  end
86
86
  s << " #{metric_name}\n"
@@ -110,7 +110,7 @@ module NewRelic
110
110
 
111
111
  def count_nodes
112
112
  count = 1
113
- children.each { | node | count += node.count_nodes }
113
+ children.each { |node| count += node.count_nodes }
114
114
  count
115
115
  end
116
116
 
@@ -6,7 +6,6 @@ module NewRelic
6
6
  module Agent
7
7
  class Transaction
8
8
  module Tracing
9
-
10
9
  attr_reader :current_segment
11
10
 
12
11
  def async?
@@ -48,8 +47,7 @@ module NewRelic
48
47
  segments.each { |s| s.finalize }
49
48
  end
50
49
 
51
-
52
- WEB_TRANSACTION_TOTAL_TIME = "WebTransactionTotalTime".freeze
50
+ WEB_TRANSACTION_TOTAL_TIME = "WebTransactionTotalTime".freeze
53
51
  OTHER_TRANSACTION_TOTAL_TIME = "OtherTransactionTotalTime".freeze
54
52
 
55
53
  def record_total_time_metrics
@@ -81,7 +81,7 @@ module NewRelic
81
81
  # This doesn't use the more convenient #last and #sort_by to avoid
82
82
  # additional array allocations (and abundant alliteration)
83
83
  def truncate_samples
84
- @samples.sort!{|a,b| a.duration <=> b.duration}
84
+ @samples.sort! { |a, b| a.duration <=> b.duration }
85
85
  @samples.slice!(0..-(max_capacity + 1))
86
86
  end
87
87
 
@@ -98,7 +98,6 @@ module NewRelic
98
98
  def add_sample(sample)
99
99
  @samples << sample
100
100
  end
101
-
102
101
  end
103
102
  end
104
103
  end
@@ -24,33 +24,33 @@ module NewRelic
24
24
  include Tracing
25
25
 
26
26
  # for nested transactions
27
- NESTED_TRANSACTION_PREFIX = "Nested/"
28
- CONTROLLER_PREFIX = "Controller/"
29
- MIDDLEWARE_PREFIX = "Middleware/Rack/"
30
- OTHER_TRANSACTION_PREFIX = "OtherTransaction/"
31
- TASK_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Background/"
32
- RAKE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Rake/"
33
- MESSAGE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Message/"
34
- RACK_PREFIX = "#{CONTROLLER_PREFIX}Rack/"
35
- SINATRA_PREFIX = "#{CONTROLLER_PREFIX}Sinatra/"
36
- GRAPE_PREFIX = "#{CONTROLLER_PREFIX}Grape/"
37
- ACTION_CABLE_PREFIX = "#{CONTROLLER_PREFIX}ActionCable/"
38
-
39
- WEB_TRANSACTION_CATEGORIES = [:web, :controller, :uri, :rack, :sinatra, :grape, :middleware, :action_cable].freeze
40
- TRANSACTION_NAMING_SOURCES = [:child, :api].freeze
41
-
42
- MIDDLEWARE_SUMMARY_METRICS = ["Middleware/all"].freeze
43
- WEB_SUMMARY_METRIC = "HttpDispatcher"
44
- OTHER_SUMMARY_METRIC = "#{OTHER_TRANSACTION_PREFIX}all"
45
- QUEUE_TIME_METRIC = "WebFrontend/QueueTime"
46
-
47
- APDEX_S = "S"
48
- APDEX_T = "T"
49
- APDEX_F = "F"
50
- APDEX_ALL_METRIC = "ApdexAll"
51
- APDEX_METRIC = "Apdex"
52
- APDEX_OTHER_METRIC = "ApdexOther"
53
- APDEX_TXN_METRIC_PREFIX = "Apdex/"
27
+ NESTED_TRANSACTION_PREFIX = "Nested/"
28
+ CONTROLLER_PREFIX = "Controller/"
29
+ MIDDLEWARE_PREFIX = "Middleware/Rack/"
30
+ OTHER_TRANSACTION_PREFIX = "OtherTransaction/"
31
+ TASK_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Background/"
32
+ RAKE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Rake/"
33
+ MESSAGE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Message/"
34
+ RACK_PREFIX = "#{CONTROLLER_PREFIX}Rack/"
35
+ SINATRA_PREFIX = "#{CONTROLLER_PREFIX}Sinatra/"
36
+ GRAPE_PREFIX = "#{CONTROLLER_PREFIX}Grape/"
37
+ ACTION_CABLE_PREFIX = "#{CONTROLLER_PREFIX}ActionCable/"
38
+
39
+ WEB_TRANSACTION_CATEGORIES = [:web, :controller, :uri, :rack, :sinatra, :grape, :middleware, :action_cable].freeze
40
+ TRANSACTION_NAMING_SOURCES = [:child, :api].freeze
41
+
42
+ MIDDLEWARE_SUMMARY_METRICS = ["Middleware/all"].freeze
43
+ WEB_SUMMARY_METRIC = "HttpDispatcher"
44
+ OTHER_SUMMARY_METRIC = "#{OTHER_TRANSACTION_PREFIX}all"
45
+ QUEUE_TIME_METRIC = "WebFrontend/QueueTime"
46
+
47
+ APDEX_S = "S"
48
+ APDEX_T = "T"
49
+ APDEX_F = "F"
50
+ APDEX_ALL_METRIC = "ApdexAll"
51
+ APDEX_METRIC = "Apdex"
52
+ APDEX_OTHER_METRIC = "ApdexOther"
53
+ APDEX_TXN_METRIC_PREFIX = "Apdex/"
54
54
  APDEX_OTHER_TXN_METRIC_PREFIX = "ApdexOther/Transaction/"
55
55
 
56
56
  JRUBY_CPU_TIME_ERROR = "Error calculating JRuby CPU Time"
@@ -67,27 +67,27 @@ module NewRelic
67
67
  attr_accessor :apdex_start
68
68
 
69
69
  attr_accessor :exceptions,
70
- :filtered_params,
71
- :jruby_cpu_start,
72
- :process_cpu_start,
73
- :http_response_code,
74
- :response_content_length,
75
- :response_content_type,
76
- :parent_span_id
70
+ :filtered_params,
71
+ :jruby_cpu_start,
72
+ :process_cpu_start,
73
+ :http_response_code,
74
+ :response_content_length,
75
+ :response_content_type,
76
+ :parent_span_id
77
77
 
78
78
  attr_reader :guid,
79
- :metrics,
80
- :gc_start_snapshot,
81
- :category,
82
- :attributes,
83
- :payload,
84
- :nesting_max_depth,
85
- :segments,
86
- :end_time,
87
- :duration
79
+ :metrics,
80
+ :gc_start_snapshot,
81
+ :category,
82
+ :attributes,
83
+ :payload,
84
+ :nesting_max_depth,
85
+ :segments,
86
+ :end_time,
87
+ :duration
88
88
 
89
89
  attr_writer :sampled,
90
- :priority
90
+ :priority
91
91
 
92
92
  # Populated with the trace sample once this transaction is completed.
93
93
  attr_reader :transaction_trace
@@ -100,13 +100,13 @@ module NewRelic
100
100
  Tracer.current_transaction
101
101
  end
102
102
 
103
- def self.set_default_transaction_name(partial_name, category = nil) #THREAD_LOCAL_ACCESS
104
- txn = tl_current
103
+ def self.set_default_transaction_name(partial_name, category = nil) # THREAD_LOCAL_ACCESS
104
+ txn = tl_current
105
105
  name = name_from_partial(partial_name, category || txn.category)
106
106
  txn.set_default_transaction_name(name, category)
107
107
  end
108
108
 
109
- def self.set_overriding_transaction_name(partial_name, category = nil) #THREAD_LOCAL_ACCESS
109
+ def self.set_overriding_transaction_name(partial_name, category = nil) # THREAD_LOCAL_ACCESS
110
110
  txn = tl_current
111
111
  return unless txn
112
112
 
@@ -143,7 +143,7 @@ module NewRelic
143
143
  end
144
144
 
145
145
  # See NewRelic::Agent.notice_error for options and commentary
146
- def self.notice_error(e, options={})
146
+ def self.notice_error(e, options = {})
147
147
  if txn = Tracer.current_transaction
148
148
  txn.notice_error(e, options)
149
149
  elsif NewRelic::Agent.instance
@@ -156,7 +156,7 @@ module NewRelic
156
156
  #
157
157
  # @api public
158
158
  #
159
- def self.recording_web_transaction? #THREAD_LOCAL_ACCESS
159
+ def self.recording_web_transaction? # THREAD_LOCAL_ACCESS
160
160
  NewRelic::Agent.record_api_supportability_metric(:recording_web_transaction?)
161
161
 
162
162
  txn = tl_current
@@ -220,8 +220,8 @@ module NewRelic
220
220
  @segments = []
221
221
 
222
222
  self.default_name = options[:transaction_name]
223
- @overridden_name = nil
224
- @frozen_name = nil
223
+ @overridden_name = nil
224
+ @frozen_name = nil
225
225
 
226
226
  @category = category
227
227
  @start_time = Process.clock_gettime(Process::CLOCK_REALTIME)
@@ -352,9 +352,9 @@ module NewRelic
352
352
 
353
353
  def best_name
354
354
  @frozen_name ||
355
- @overridden_name ||
356
- @default_name ||
357
- NewRelic::Agent::UNKNOWN_METRIC
355
+ @overridden_name ||
356
+ @default_name ||
357
+ NewRelic::Agent::UNKNOWN_METRIC
358
358
  end
359
359
 
360
360
  # For common interface with Trace
@@ -546,8 +546,8 @@ module NewRelic
546
546
 
547
547
  def assign_agent_attributes
548
548
  default_destinations = AttributeFilter::DST_TRANSACTION_TRACER |
549
- AttributeFilter::DST_TRANSACTION_EVENTS |
550
- AttributeFilter::DST_ERROR_COLLECTOR
549
+ AttributeFilter::DST_TRANSACTION_EVENTS |
550
+ AttributeFilter::DST_ERROR_COLLECTOR
551
551
 
552
552
  if http_response_code
553
553
  add_agent_attribute(:'http.statusCode', http_response_code, default_destinations)
@@ -622,14 +622,14 @@ module NewRelic
622
622
 
623
623
  def generate_payload
624
624
  @payload = {
625
- :name => @frozen_name,
626
- :bucket => recording_web_transaction? ? :request : :background,
627
- :start_timestamp => start_time,
628
- :duration => duration,
629
- :metrics => @metrics,
630
- :attributes => @attributes,
631
- :error => false,
632
- :priority => priority
625
+ :name => @frozen_name,
626
+ :bucket => recording_web_transaction? ? :request : :background,
627
+ :start_timestamp => start_time,
628
+ :duration => duration,
629
+ :metrics => @metrics,
630
+ :attributes => @attributes,
631
+ :error => false,
632
+ :priority => priority
633
633
  }
634
634
 
635
635
  distributed_tracer.append_payload(@payload)
@@ -683,7 +683,6 @@ module NewRelic
683
683
  when :apdex_s then APDEX_S
684
684
  when :apdex_t then APDEX_T
685
685
  when :apdex_f then APDEX_F
686
- else nil
687
686
  end
688
687
  payload[:apdex_perf_zone] = bucket_str if bucket_str
689
688
  end
@@ -692,8 +691,8 @@ module NewRelic
692
691
  return unless is_synthetics_request?
693
692
 
694
693
  payload[:synthetics_resource_id] = synthetics_resource_id
695
- payload[:synthetics_job_id] = synthetics_job_id
696
- payload[:synthetics_monitor_id] = synthetics_monitor_id
694
+ payload[:synthetics_job_id] = synthetics_job_id
695
+ payload[:synthetics_monitor_id] = synthetics_monitor_id
697
696
  end
698
697
 
699
698
  def merge_metrics
@@ -703,9 +702,9 @@ module NewRelic
703
702
  def record_exceptions
704
703
  error_recorded = false
705
704
  @exceptions.each do |exception, options|
706
- options[:uri] ||= request_path if request_path
707
- options[:port] = request_port if request_port
708
- options[:metric] = best_name
705
+ options[:uri] ||= request_path if request_path
706
+ options[:port] = request_port if request_port
707
+ options[:metric] = best_name
709
708
  options[:attributes] = @attributes
710
709
 
711
710
  span_id = options.delete :span_id
@@ -715,8 +714,7 @@ module NewRelic
715
714
  end
716
715
 
717
716
  # Do not call this. Invoke the class method instead.
718
- def notice_error(error, options={}) # :nodoc:
719
-
717
+ def notice_error(error, options = {}) # :nodoc:
720
718
  # Only the last error is kept
721
719
  if @current_segment
722
720
  @current_segment.notice_error error, expected: options[:expected]
@@ -771,8 +769,8 @@ module NewRelic
771
769
  record_apdex_metrics(APDEX_METRIC, APDEX_TXN_METRIC_PREFIX, apdex_t)
772
770
  else
773
771
  record_apdex_metrics(APDEX_OTHER_METRIC,
774
- APDEX_OTHER_TXN_METRIC_PREFIX,
775
- transaction_specific_apdex_t)
772
+ APDEX_OTHER_TXN_METRIC_PREFIX,
773
+ transaction_specific_apdex_t)
776
774
  end
777
775
  end
778
776
  end
@@ -780,9 +778,9 @@ module NewRelic
780
778
  def record_apdex_metrics(rollup_metric, transaction_prefix, current_apdex_t)
781
779
  return unless current_apdex_t
782
780
 
783
- total_duration = end_time - apdex_start
781
+ total_duration = end_time - apdex_start
784
782
  apdex_bucket_global = apdex_bucket(total_duration, current_apdex_t)
785
- apdex_bucket_txn = apdex_bucket(duration, current_apdex_t)
783
+ apdex_bucket_txn = apdex_bucket(duration, current_apdex_t)
786
784
 
787
785
  @metrics.record_unscoped(rollup_metric, apdex_bucket_global, current_apdex_t)
788
786
  @metrics.record_unscoped(APDEX_ALL_METRIC, apdex_bucket_global, current_apdex_t)
@@ -800,7 +798,7 @@ module NewRelic
800
798
  end
801
799
 
802
800
  def threshold
803
- source_class = Agent.config.source(:'transaction_tracer.transaction_threshold').class
801
+ source_class = Agent.config.source(:'transaction_tracer.transaction_threshold').class
804
802
  if source_class == Configuration::DefaultSource
805
803
  apdex_t * 4
806
804
  else
@@ -808,7 +806,7 @@ module NewRelic
808
806
  end
809
807
  end
810
808
 
811
- def with_database_metric_name(model, method, product=nil)
809
+ def with_database_metric_name(model, method, product = nil)
812
810
  previous = self.instrumentation_state[:datastore_override]
813
811
  model_name = case model
814
812
  when Class
@@ -817,7 +815,7 @@ module NewRelic
817
815
  model
818
816
  else
819
817
  model.to_s
820
- end
818
+ end
821
819
  self.instrumentation_state[:datastore_override] = [method, model_name, product]
822
820
  yield
823
821
  ensure
@@ -895,9 +893,9 @@ module NewRelic
895
893
  threadMBean = Java::JavaLangManagement::ManagementFactory.getThreadMXBean()
896
894
 
897
895
  return nil unless threadMBean.isCurrentThreadCpuTimeSupported
898
- java_utime = threadMBean.getCurrentThreadUserTime() # ns
896
+ java_utime = threadMBean.getCurrentThreadUserTime() # ns
899
897
 
900
- -1 == java_utime ? 0.0 : java_utime/1e9
898
+ -1 == java_utime ? 0.0 : java_utime / 1e9
901
899
  rescue => e
902
900
  ::NewRelic::Agent.logger.log_once(:warn, :jruby_cpu_time, JRUBY_CPU_TIME_ERROR, e)
903
901
  ::NewRelic::Agent.logger.debug(JRUBY_CPU_TIME_ERROR, e)
@@ -16,23 +16,23 @@ module NewRelic
16
16
  module TransactionErrorPrimitive
17
17
  extend self
18
18
 
19
- SAMPLE_TYPE = 'TransactionError'.freeze
20
- TYPE_KEY = 'type'.freeze
21
- ERROR_CLASS_KEY = 'error.class'.freeze
22
- ERROR_MESSAGE_KEY = 'error.message'.freeze
23
- ERROR_EXPECTED_KEY = 'error.expected'.freeze
24
- TIMESTAMP_KEY = 'timestamp'.freeze
25
- PORT_KEY = 'port'.freeze
26
- NAME_KEY = 'transactionName'.freeze
27
- DURATION_KEY = 'duration'.freeze
28
- SAMPLED_KEY = 'sampled'.freeze
29
- GUID_KEY = 'nr.transactionGuid'.freeze
19
+ SAMPLE_TYPE = 'TransactionError'.freeze
20
+ TYPE_KEY = 'type'.freeze
21
+ ERROR_CLASS_KEY = 'error.class'.freeze
22
+ ERROR_MESSAGE_KEY = 'error.message'.freeze
23
+ ERROR_EXPECTED_KEY = 'error.expected'.freeze
24
+ TIMESTAMP_KEY = 'timestamp'.freeze
25
+ PORT_KEY = 'port'.freeze
26
+ NAME_KEY = 'transactionName'.freeze
27
+ DURATION_KEY = 'duration'.freeze
28
+ SAMPLED_KEY = 'sampled'.freeze
29
+ GUID_KEY = 'nr.transactionGuid'.freeze
30
30
  REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'.freeze
31
- SYNTHETICS_RESOURCE_ID_KEY = "nr.syntheticsResourceId".freeze
32
- SYNTHETICS_JOB_ID_KEY = "nr.syntheticsJobId".freeze
33
- SYNTHETICS_MONITOR_ID_KEY = "nr.syntheticsMonitorId".freeze
34
- PRIORITY_KEY = "priority".freeze
35
- SPAN_ID_KEY = "spanId".freeze
31
+ SYNTHETICS_RESOURCE_ID_KEY = "nr.syntheticsResourceId".freeze
32
+ SYNTHETICS_JOB_ID_KEY = "nr.syntheticsJobId".freeze
33
+ SYNTHETICS_MONITOR_ID_KEY = "nr.syntheticsMonitorId".freeze
34
+ PRIORITY_KEY = "priority".freeze
35
+ SPAN_ID_KEY = "spanId".freeze
36
36
 
37
37
  def create noticed_error, payload, span_id
38
38
  [
@@ -3,22 +3,21 @@
3
3
  # This file is distributed under New Relic's license terms.
4
4
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
5
5
 
6
- require 'newrelic_rpm' unless defined?( NewRelic )
7
- require 'new_relic/agent' unless defined?( NewRelic::Agent )
6
+ require 'newrelic_rpm' unless defined?(NewRelic)
7
+ require 'new_relic/agent' unless defined?(NewRelic::Agent)
8
8
  require 'new_relic/agent/event_aggregator'
9
9
  require 'new_relic/agent/priority_sampled_buffer'
10
10
 
11
11
  module NewRelic
12
12
  module Agent
13
13
  class TransactionEventAggregator < EventAggregator
14
-
15
14
  named :TransactionEventAggregator
16
- capacity_key :'analytics_events.max_samples_stored'
17
- enabled_key :'analytics_events.enabled'
15
+ capacity_key :'transaction_events.max_samples_stored'
16
+ enabled_key :'transaction_events.enabled'
18
17
  buffer_class PrioritySampledBuffer
19
18
 
20
- def record priority: nil, event:nil, &blk
21
- unless(event || priority && blk)
19
+ def record priority: nil, event: nil, &blk
20
+ unless event || priority && blk
22
21
  raise ArgumentError, "Expected priority and block, or event"
23
22
  end
24
23
 
@@ -37,7 +36,7 @@ module NewRelic
37
36
  record_sampling_rate metadata
38
37
  end
39
38
 
40
- def record_sampling_rate(metadata) #THREAD_LOCAL_ACCESS
39
+ def record_sampling_rate(metadata) # THREAD_LOCAL_ACCESS
41
40
  NewRelic::Agent.logger.debug("Sampled %d / %d (%.1f %%) requests this cycle, %d / %d (%.1f %%) since startup" % [
42
41
  metadata[:captured],
43
42
  metadata[:seen],