newrelic_rpm 5.7.0.350 → 6.0.0.351

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +41 -0
  5. data/lib/new_relic/agent.rb +3 -3
  6. data/lib/new_relic/agent/agent.rb +4 -4
  7. data/lib/new_relic/agent/configuration/default_source.rb +3 -1
  8. data/lib/new_relic/agent/cross_app_monitor.rb +3 -3
  9. data/lib/new_relic/agent/datastores.rb +6 -8
  10. data/lib/new_relic/agent/datastores/metric_helper.rb +1 -2
  11. data/lib/new_relic/agent/distributed_trace_monitor.rb +1 -2
  12. data/lib/new_relic/agent/error_collector.rb +1 -1
  13. data/lib/new_relic/agent/external.rb +6 -4
  14. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +8 -5
  15. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +12 -8
  16. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
  17. data/lib/new_relic/agent/instrumentation/active_job.rb +6 -7
  18. data/lib/new_relic/agent/instrumentation/active_record.rb +2 -2
  19. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +2 -2
  20. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +1 -1
  21. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +1 -1
  22. data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
  23. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +9 -3
  24. data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -1
  25. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +1 -1
  26. data/lib/new_relic/agent/instrumentation/excon/connection.rb +1 -1
  27. data/lib/new_relic/agent/instrumentation/grape.rb +4 -2
  28. data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -1
  29. data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +11 -4
  30. data/lib/new_relic/agent/instrumentation/net.rb +1 -1
  31. data/lib/new_relic/agent/instrumentation/rake.rb +2 -3
  32. data/lib/new_relic/agent/instrumentation/typhoeus.rb +3 -3
  33. data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
  34. data/lib/new_relic/agent/messaging.rb +9 -8
  35. data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
  36. data/lib/new_relic/agent/sql_sampler.rb +3 -3
  37. data/lib/new_relic/agent/stats_engine.rb +2 -2
  38. data/lib/new_relic/agent/synthetics_monitor.rb +1 -2
  39. data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
  40. data/lib/new_relic/agent/tracer.rb +462 -0
  41. data/lib/new_relic/agent/transaction.rb +40 -87
  42. data/lib/new_relic/agent/transaction/abstract_segment.rb +1 -1
  43. data/lib/new_relic/agent/transaction/distributed_tracing.rb +1 -2
  44. data/lib/new_relic/agent/transaction/tracing.rb +0 -99
  45. data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -2
  46. data/lib/new_relic/control/frameworks/rails6.rb +14 -0
  47. data/lib/new_relic/rack/agent_middleware.rb +1 -1
  48. data/lib/new_relic/version.rb +2 -2
  49. data/test/agent_helper.rb +2 -2
  50. metadata +4 -3
  51. data/lib/new_relic/agent/transaction_state.rb +0 -186
@@ -334,10 +334,10 @@ def in_transaction(*args, &blk)
334
334
  name = opts.key?(:transaction_name) ? opts.delete(:transaction_name) :
335
335
  args.first || 'dummy'
336
336
 
337
- state = NewRelic::Agent::TransactionState.tl_get
337
+ state = NewRelic::Agent::Tracer.state
338
338
  txn = nil
339
339
 
340
- NewRelic::Agent::Transaction.wrap(state, name, category, opts) do
340
+ NewRelic::Agent::Tracer.in_transaction(name: name, category: category, options: opts) do
341
341
  txn = state.current_transaction
342
342
  yield state.current_transaction
343
343
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.0.350
4
+ version: 6.0.0.351
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Wear
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-01-09 00:00:00.000000000 Z
14
+ date: 2019-01-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -371,6 +371,7 @@ files:
371
371
  - lib/new_relic/agent/threading/backtrace_service.rb
372
372
  - lib/new_relic/agent/threading/thread_profile.rb
373
373
  - lib/new_relic/agent/timestamp_sampled_buffer.rb
374
+ - lib/new_relic/agent/tracer.rb
374
375
  - lib/new_relic/agent/transaction.rb
375
376
  - lib/new_relic/agent/transaction/abstract_segment.rb
376
377
  - lib/new_relic/agent/transaction/attributes.rb
@@ -394,7 +395,6 @@ files:
394
395
  - lib/new_relic/agent/transaction_event_recorder.rb
395
396
  - lib/new_relic/agent/transaction_metrics.rb
396
397
  - lib/new_relic/agent/transaction_sampler.rb
397
- - lib/new_relic/agent/transaction_state.rb
398
398
  - lib/new_relic/agent/transaction_time_aggregator.rb
399
399
  - lib/new_relic/agent/utilization/aws.rb
400
400
  - lib/new_relic/agent/utilization/azure.rb
@@ -423,6 +423,7 @@ files:
423
423
  - lib/new_relic/control/frameworks/rails3.rb
424
424
  - lib/new_relic/control/frameworks/rails4.rb
425
425
  - lib/new_relic/control/frameworks/rails5.rb
426
+ - lib/new_relic/control/frameworks/rails6.rb
426
427
  - lib/new_relic/control/frameworks/ruby.rb
427
428
  - lib/new_relic/control/frameworks/sinatra.rb
428
429
  - lib/new_relic/control/instance_methods.rb
@@ -1,186 +0,0 @@
1
- # encoding: utf-8
2
- # This file is distributed under New Relic's license terms.
3
- # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
-
5
- module NewRelic
6
- module Agent
7
-
8
- # This is THE location to store thread local information during a transaction
9
- # Need a new piece of data? Add a method here, NOT a new thread local variable.
10
- class TransactionState
11
- class << self
12
- def tl_get
13
- tl_state_for(Thread.current)
14
- end
15
-
16
- alias_method :trace_state, :tl_get
17
-
18
- def tracing_enabled?
19
- trace_state.tracing_enabled?
20
- end
21
-
22
- def current_transaction
23
- trace_state.current_transaction
24
- end
25
-
26
- # A more ergonomic API would be to have transaction derive the
27
- # category from the transaction name and we should explore this as an
28
- # option.
29
- def start_transaction(name: nil, category: nil, **options)
30
- raise ArgumentError, 'missing required argument: name' if name.nil?
31
- raise ArgumentError, 'missing required argument: category' if category.nil?
32
-
33
- state = trace_state
34
- return state.current_transaction if state.current_transaction
35
-
36
- options[:transaction_name] = name
37
-
38
- Transaction.start_new_transaction(trace_state,
39
- category,
40
- options)
41
- end
42
-
43
- def create_distributed_trace_payload
44
- if txn = current_transaction
45
- txn.create_distributed_trace_payload
46
- end
47
- end
48
-
49
- def accept_distributed_trace_payload(payload)
50
- if txn = current_transaction
51
- txn.accept_distributed_trace_payload(payload)
52
- end
53
- end
54
-
55
- def start_segment(name:nil,
56
- unscoped_metrics:nil,
57
- start_time: nil,
58
- parent: nil)
59
-
60
- Transaction.start_segment(name: name,
61
- unscoped_metrics: unscoped_metrics,
62
- start_time: start_time,
63
- parent: parent)
64
- end
65
-
66
- def start_datastore_segment(product: nil,
67
- operation: nil,
68
- collection: nil,
69
- host: nil,
70
- port_path_or_id: nil,
71
- database_name: nil,
72
- start_time: nil,
73
- parent: nil)
74
-
75
- Transaction.start_datastore_segment(product: product,
76
- operation: operation,
77
- collection: collection,
78
- host: host,
79
- port_path_or_id: port_path_or_id,
80
- database_name: database_name,
81
- start_time: start_time,
82
- parent: parent)
83
- end
84
-
85
- def start_external_request_segment(library: nil,
86
- uri: nil,
87
- procedure: nil,
88
- start_time: nil,
89
- parent: nil)
90
-
91
- Transaction.start_external_request_segment(library: library,
92
- uri: uri,
93
- procedure: procedure,
94
- start_time: start_time,
95
- parent: parent)
96
- end
97
-
98
- def start_message_broker_segment(action: nil,
99
- library: nil,
100
- destination_type: nil,
101
- destination_name: nil,
102
- headers: nil,
103
- parameters: nil,
104
- start_time: nil,
105
- parent: nil)
106
-
107
- Transaction.start_message_broker_segment(action: action,
108
- library: library,
109
- destination_type: destination_type,
110
- destination_name: destination_name,
111
- headers: headers,
112
- parameters: parameters,
113
- start_time: start_time,
114
- parent: parent)
115
- end
116
-
117
- # This method should only be used by TransactionState for access to the
118
- # current thread's state or to provide read-only accessors for other threads
119
- #
120
- # If ever exposed, this requires additional synchronization
121
- def tl_state_for(thread)
122
- state = thread[:newrelic_transaction_state]
123
-
124
- if state.nil?
125
- state = TransactionState.new
126
- thread[:newrelic_transaction_state] = state
127
- end
128
-
129
- state
130
- end
131
-
132
- def tl_clear
133
- Thread.current[:newrelic_transaction_state] = nil
134
- end
135
- end
136
-
137
- def initialize
138
- @untraced = []
139
- @current_transaction = nil
140
- @record_sql = nil
141
- end
142
-
143
- # This starts the timer for the transaction.
144
- def reset(transaction=nil)
145
- # We purposefully don't reset @untraced or @record_sql
146
- # since those are managed by NewRelic::Agent.disable_* calls explicitly
147
- # and (more importantly) outside the scope of a transaction
148
-
149
- @current_transaction = transaction
150
- @sql_sampler_transaction_data = nil
151
- end
152
-
153
- # Current transaction stack
154
- attr_reader :current_transaction
155
-
156
- # Execution tracing on current thread
157
- attr_accessor :untraced
158
-
159
- def push_traced(should_trace)
160
- @untraced << should_trace
161
- end
162
-
163
- def pop_traced
164
- @untraced.pop if @untraced
165
- end
166
-
167
- def is_execution_traced?
168
- @untraced.nil? || @untraced.last != false
169
- end
170
-
171
- alias_method :tracing_enabled?, :is_execution_traced?
172
-
173
- # TT's and SQL
174
- attr_accessor :record_sql
175
-
176
- def is_sql_recorded?
177
- @record_sql != false
178
- end
179
-
180
- # Sql Sampler Transaction Data
181
- attr_accessor :sql_sampler_transaction_data
182
- end
183
-
184
- Tracer = TransactionState
185
- end
186
- end