newrelic_rpm 6.2.0.354 → 6.7.0.359

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +27 -5
  3. data/CHANGELOG.md +157 -6
  4. data/lib/new_relic/agent.rb +49 -0
  5. data/lib/new_relic/agent/agent.rb +110 -146
  6. data/lib/new_relic/agent/commands/agent_command_router.rb +2 -21
  7. data/lib/new_relic/agent/configuration/default_source.rb +103 -41
  8. data/lib/new_relic/agent/configuration/environment_source.rb +4 -2
  9. data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
  10. data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
  11. data/lib/new_relic/agent/configuration/manager.rb +13 -9
  12. data/lib/new_relic/agent/configuration/server_source.rb +35 -1
  13. data/lib/new_relic/agent/connect/request_builder.rb +69 -0
  14. data/lib/new_relic/agent/connect/response_handler.rb +61 -0
  15. data/lib/new_relic/agent/cross_app_monitor.rb +1 -1
  16. data/lib/new_relic/agent/error_collector.rb +2 -2
  17. data/lib/new_relic/agent/error_event_aggregator.rb +2 -1
  18. data/lib/new_relic/agent/error_trace_aggregator.rb +1 -0
  19. data/lib/new_relic/agent/event_aggregator.rb +26 -32
  20. data/lib/new_relic/agent/hostname.rb +1 -1
  21. data/lib/new_relic/agent/inbound_request_monitor.rb +2 -2
  22. data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +24 -42
  23. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +46 -74
  24. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +70 -53
  25. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +168 -0
  26. data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +40 -47
  27. data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +4 -4
  28. data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
  29. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +76 -0
  30. data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_cable.rb +5 -6
  31. data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_controller.rb +3 -3
  32. data/lib/new_relic/agent/instrumentation/{rails4 → rails_notifications}/action_view.rb +3 -3
  33. data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
  34. data/lib/new_relic/agent/logging.rb +125 -0
  35. data/lib/new_relic/agent/new_relic_service.rb +0 -4
  36. data/lib/new_relic/agent/parameter_filtering.rb +18 -5
  37. data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -0
  38. data/lib/new_relic/agent/span_event_aggregator.rb +2 -5
  39. data/lib/new_relic/agent/threading/backtrace_service.rb +3 -3
  40. data/lib/new_relic/agent/threading/thread_profile.rb +9 -23
  41. data/lib/new_relic/agent/tracer.rb +32 -0
  42. data/lib/new_relic/agent/transaction.rb +0 -2
  43. data/lib/new_relic/agent/transaction/trace.rb +3 -8
  44. data/lib/new_relic/agent/transaction/trace_builder.rb +0 -1
  45. data/lib/new_relic/agent/transaction_event_recorder.rb +3 -3
  46. data/lib/new_relic/agent/transaction_sampler.rb +1 -5
  47. data/lib/new_relic/cli/commands/deployments.rb +1 -1
  48. data/lib/new_relic/control/class_methods.rb +7 -1
  49. data/lib/new_relic/control/frameworks/{rails5.rb → rails_notifications.rb} +1 -1
  50. data/lib/new_relic/rack/browser_monitoring.rb +10 -8
  51. data/lib/new_relic/version.rb +1 -1
  52. data/lib/tasks/config.rake +1 -2
  53. data/newrelic_rpm.gemspec +7 -0
  54. data/test/agent_helper.rb +18 -5
  55. metadata +17 -16
  56. data/lib/new_relic/agent/commands/xray_session.rb +0 -55
  57. data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
  58. data/lib/new_relic/agent/instrumentation/active_record_4.rb +0 -42
  59. data/lib/new_relic/agent/instrumentation/active_record_5.rb +0 -41
  60. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +0 -104
  61. data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -32
  62. data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +0 -27
  63. data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
  64. data/lib/new_relic/control/frameworks/rails6.rb +0 -14
@@ -39,6 +39,38 @@ module NewRelic
39
39
  state.current_transaction
40
40
  end
41
41
 
42
+ # Returns the trace_id of the current_transaction, or +nil+ if
43
+ # none exists.
44
+ #
45
+ # @api public
46
+ def current_trace_id
47
+ if txn = current_transaction
48
+ txn.trace_id
49
+ end
50
+ end
51
+ alias_method :trace_id, :current_trace_id
52
+
53
+ # Returns the id of the current span, or +nil+ if none exists.
54
+ #
55
+ # @api public
56
+ def current_span_id
57
+ if span = current_segment
58
+ span.guid
59
+ end
60
+ end
61
+ alias_method :span_id, :current_span_id
62
+
63
+ # Returns a boolean indicating whether the current_transaction
64
+ # is sampled, or +nil+ if there is no current transaction.
65
+ #
66
+ # @api public
67
+ def transaction_sampled?
68
+ if txn = current_transaction
69
+ txn.sampled?
70
+ end
71
+ end
72
+ alias_method :sampled?, :transaction_sampled?
73
+
42
74
  # Runs the given block of code in a transaction.
43
75
  #
44
76
  # @param [String] name reserved for New Relic internal use
@@ -355,8 +355,6 @@ module NewRelic
355
355
 
356
356
  # For common interface with Trace
357
357
  alias_method :transaction_name, :best_name
358
-
359
- attr_accessor :xray_session_id
360
358
  # End common interface
361
359
 
362
360
  def promoted_transaction_name(name)
@@ -11,7 +11,7 @@ module NewRelic
11
11
  class FinishedTraceError < StandardError; end
12
12
 
13
13
  attr_reader :start_time, :root_node
14
- attr_accessor :transaction_name, :guid, :xray_session_id, :attributes,
14
+ attr_accessor :transaction_name, :guid, :attributes,
15
15
  :node_count, :finished, :threshold, :profile
16
16
 
17
17
  ROOT = "ROOT".freeze
@@ -40,11 +40,6 @@ module NewRelic
40
40
  self.root_node.duration
41
41
  end
42
42
 
43
- def forced?
44
- return true if NewRelic::Coerce.int_or_nil(xray_session_id)
45
- false
46
- end
47
-
48
43
  def synthetics_resource_id
49
44
  intrinsic_attributes = attributes.intrinsic_attributes_for(NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER)
50
45
  intrinsic_attributes[:synthetics_resource_id]
@@ -148,8 +143,8 @@ module NewRelic
148
143
  encoder.encode(trace_tree(attributes_hash)),
149
144
  NewRelic::Coerce.string(self.guid),
150
145
  nil,
151
- forced?,
152
- NewRelic::Coerce.int_or_nil(xray_session_id),
146
+ false, # forced?,
147
+ nil, # NewRelic::Coerce.int_or_nil(xray_session_id),
153
148
  NewRelic::Coerce.string(self.synthetics_resource_id)
154
149
  ]
155
150
  end
@@ -48,7 +48,6 @@ module NewRelic
48
48
  trace.guid = transaction.guid
49
49
  trace.attributes = transaction.attributes
50
50
  trace.threshold = transaction.threshold
51
- trace.xray_session_id = transaction.xray_session_id
52
51
  trace.finished = true
53
52
  end
54
53
  end
@@ -14,9 +14,9 @@ module NewRelic
14
14
  attr_reader :transaction_event_aggregator
15
15
  attr_reader :synthetics_event_aggregator
16
16
 
17
- def initialize
18
- @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
19
- @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
17
+ def initialize events
18
+ @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new events
19
+ @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new events
20
20
  end
21
21
 
22
22
  def record payload
@@ -4,7 +4,6 @@
4
4
 
5
5
  require 'new_relic/agent/transaction/slowest_sample_buffer'
6
6
  require 'new_relic/agent/transaction/synthetics_sample_buffer'
7
- require 'new_relic/agent/transaction/xray_sample_buffer'
8
7
  require 'new_relic/agent/transaction/trace_builder'
9
8
 
10
9
  module NewRelic
@@ -19,13 +18,10 @@ module NewRelic
19
18
  #
20
19
  # @api public
21
20
  class TransactionSampler
22
- attr_reader :last_sample, :xray_sample_buffer
21
+ attr_reader :last_sample
23
22
 
24
23
  def initialize
25
- @xray_sample_buffer = NewRelic::Agent::Transaction::XraySampleBuffer.new
26
-
27
24
  @sample_buffers = []
28
- @sample_buffers << @xray_sample_buffer
29
25
  @sample_buffers << NewRelic::Agent::Transaction::SlowestSampleBuffer.new
30
26
  @sample_buffers << NewRelic::Agent::Transaction::SyntheticsSampleBuffer.new
31
27
 
@@ -39,7 +39,7 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
39
39
  control.env = @environment if @environment
40
40
 
41
41
  load_yaml_from_env(control.env)
42
- @appname ||= NewRelic::Agent.config.app_names[0] || control.env || 'development'
42
+ @appname ||= NewRelic::Agent.config[:app_name][0] || control.env || 'development'
43
43
  @license_key ||= NewRelic::Agent.config[:license_key]
44
44
 
45
45
  setup_logging(control.env)
@@ -49,13 +49,19 @@ module NewRelic
49
49
  # maybe it is already loaded by some external system
50
50
  # i.e. rpm_contrib or user extensions?
51
51
  end
52
- NewRelic::Control::Frameworks.const_get(framework.to_s.capitalize)
52
+ NewRelic::Control::Frameworks.const_get(camelize(framework.to_s))
53
53
  end
54
54
 
55
55
  # The root directory for the plugin or gem
56
56
  def newrelic_root
57
57
  File.expand_path(File.join("..", "..", "..", ".."), __FILE__)
58
58
  end
59
+
60
+ def camelize(snake_case_name)
61
+ snake_case_name.gsub(/(\_|^)[a-z]/) do |substring|
62
+ substring[-1].capitalize!
63
+ end
64
+ end
59
65
  end
60
66
  extend ClassMethods
61
67
  end
@@ -7,7 +7,7 @@ require 'new_relic/control/frameworks/rails4'
7
7
  module NewRelic
8
8
  class Control
9
9
  module Frameworks
10
- class Rails5 < NewRelic::Control::Frameworks::Rails4
10
+ class RailsNotifications < NewRelic::Control::Frameworks::Rails4
11
11
  end
12
12
  end
13
13
  end
@@ -29,15 +29,16 @@ module NewRelic::Rack
29
29
  GT = ">".freeze
30
30
 
31
31
  def traced_call(env)
32
- result = @app.call(env) # [status, headers, response]
32
+ result = @app.call(env)
33
+ (status, headers, response) = result
33
34
 
34
35
  js_to_inject = NewRelic::Agent.browser_timing_header
35
- if (js_to_inject != "") && should_instrument?(env, result[0], result[1])
36
- response_string = autoinstrument_source(result[2], result[1], js_to_inject)
36
+ if (js_to_inject != "") && should_instrument?(env, status, headers)
37
+ response_string = autoinstrument_source(response, headers, js_to_inject)
37
38
 
38
39
  env[ALREADY_INSTRUMENTED_KEY] = true
39
40
  if response_string
40
- response = Rack::Response.new(response_string, result[0], result[1])
41
+ response = Rack::Response.new(response_string, status, headers)
41
42
  response.finish
42
43
  else
43
44
  result
@@ -55,7 +56,7 @@ module NewRelic::Rack
55
56
  !env[ALREADY_INSTRUMENTED_KEY] &&
56
57
  is_html?(headers) &&
57
58
  !is_attachment?(headers) &&
58
- !is_streaming?(env)
59
+ !is_streaming?(env, headers)
59
60
  end
60
61
 
61
62
  def is_html?(headers)
@@ -66,10 +67,11 @@ module NewRelic::Rack
66
67
  headers[CONTENT_DISPOSITION] && headers[CONTENT_DISPOSITION].include?(ATTACHMENT)
67
68
  end
68
69
 
69
- def is_streaming?(env)
70
- return false unless defined?(ActionController::Live)
70
+ def is_streaming?(env, headers)
71
+ return true if headers && headers['Transfer-Encoding'] == 'chunked'
71
72
 
72
- env['action_controller.instance'].class.included_modules.include?(ActionController::Live)
73
+ defined?(ActionController::Live) &&
74
+ env['action_controller.instance'].class.included_modules.include?(ActionController::Live)
73
75
  end
74
76
 
75
77
  CHARSET_RE = /<\s*meta[^>]+charset\s*=[^>]*>/im.freeze
@@ -11,7 +11,7 @@ module NewRelic
11
11
  end
12
12
 
13
13
  MAJOR = 6
14
- MINOR = 2
14
+ MINOR = 7
15
15
  TINY = 0
16
16
 
17
17
  begin
@@ -17,8 +17,7 @@ namespace :newrelic do
17
17
  }
18
18
 
19
19
  NAME_OVERRIDES = {
20
- "slow_sql" => "Slow SQL",
21
- "xray_session" => "X-Ray Session"
20
+ "slow_sql" => "Slow SQL"
22
21
  }
23
22
 
24
23
  def output(format)
@@ -31,6 +31,13 @@ EOS
31
31
  "newrelic.yml"
32
32
  ]
33
33
 
34
+ s.metadata = {
35
+ 'bug_tracker_uri' => 'https://support.newrelic.com/',
36
+ 'changelog_uri' => 'https://github.com/newrelic/rpm/blob/master/CHANGELOG.md',
37
+ 'documentation_uri' => 'https://docs.newrelic.com/docs/agents/ruby-agent',
38
+ 'source_code_uri' => 'https://github.com/newrelic/rpm'
39
+ }
40
+
34
41
  file_list = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/(?!agent_helper.rb)}) }
35
42
  build_file_path = 'lib/new_relic/build.rb'
36
43
  file_list << build_file_path if File.exist?(build_file_path)
@@ -452,6 +452,13 @@ def with_config(config_hash, at_start=true)
452
452
  end
453
453
  end
454
454
 
455
+ def with_server_source config_hash, at_start=true
456
+ with_config config_hash, at_start do
457
+ NewRelic::Agent.config.notify_server_source_added
458
+ yield
459
+ end
460
+ end
461
+
455
462
  def with_config_low_priority(config_hash)
456
463
  with_config(config_hash, false) do
457
464
  yield
@@ -521,7 +528,7 @@ def constant_path(name, opts={})
521
528
  path = [Object]
522
529
  parts = name.gsub(/^::/, '').split('::')
523
530
  parts.each do |part|
524
- if !path.last.const_defined?(part)
531
+ if !path.last.constants.include?(part.to_sym)
525
532
  return allow_partial ? path : nil
526
533
  end
527
534
  path << path.last.const_get(part)
@@ -529,11 +536,17 @@ def constant_path(name, opts={})
529
536
  path
530
537
  end
531
538
 
539
+ def get_parent(constant_name)
540
+ parent_name = constant_name.gsub(/::[^:]*$/, '')
541
+ const_path = constant_path(parent_name)
542
+ const_path ? const_path[-1] : nil
543
+ end
544
+
532
545
  def undefine_constant(constant_symbol)
533
- const_path = constant_path(constant_symbol.to_s)
534
- return yield unless const_path
535
- parent = const_path[-2]
536
- const_name = constant_symbol.to_s.gsub(/.*::/, '')
546
+ const_str = constant_symbol.to_s
547
+ parent = get_parent(const_str)
548
+ const_name = const_str.gsub(/.*::/, '')
549
+ return yield unless parent && parent.constants.include?(const_name.to_sym)
537
550
  removed_constant = parent.send(:remove_const, const_name)
538
551
  yield
539
552
  ensure
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: 6.2.0.354
4
+ version: 6.7.0.359
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-03-12 00:00:00.000000000 Z
14
+ date: 2019-09-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -178,12 +178,11 @@ files:
178
178
  - lib/new_relic/agent/commands/agent_command.rb
179
179
  - lib/new_relic/agent/commands/agent_command_router.rb
180
180
  - lib/new_relic/agent/commands/thread_profiler_session.rb
181
- - lib/new_relic/agent/commands/xray_session.rb
182
- - lib/new_relic/agent/commands/xray_session_collection.rb
183
181
  - lib/new_relic/agent/configuration.rb
184
182
  - lib/new_relic/agent/configuration/default_source.rb
185
183
  - lib/new_relic/agent/configuration/dotted_hash.rb
186
184
  - lib/new_relic/agent/configuration/environment_source.rb
185
+ - lib/new_relic/agent/configuration/event_harvest_config.rb
187
186
  - lib/new_relic/agent/configuration/high_security_source.rb
188
187
  - lib/new_relic/agent/configuration/manager.rb
189
188
  - lib/new_relic/agent/configuration/manual_source.rb
@@ -191,6 +190,8 @@ files:
191
190
  - lib/new_relic/agent/configuration/security_policy_source.rb
192
191
  - lib/new_relic/agent/configuration/server_source.rb
193
192
  - lib/new_relic/agent/configuration/yaml_source.rb
193
+ - lib/new_relic/agent/connect/request_builder.rb
194
+ - lib/new_relic/agent/connect/response_handler.rb
194
195
  - lib/new_relic/agent/cross_app_monitor.rb
195
196
  - lib/new_relic/agent/cross_app_payload.rb
196
197
  - lib/new_relic/agent/cross_app_tracing.rb
@@ -240,9 +241,8 @@ files:
240
241
  - lib/new_relic/agent/instrumentation/active_job.rb
241
242
  - lib/new_relic/agent/instrumentation/active_merchant.rb
242
243
  - lib/new_relic/agent/instrumentation/active_record.rb
243
- - lib/new_relic/agent/instrumentation/active_record_4.rb
244
- - lib/new_relic/agent/instrumentation/active_record_5.rb
245
244
  - lib/new_relic/agent/instrumentation/active_record_helper.rb
245
+ - lib/new_relic/agent/instrumentation/active_record_notifications.rb
246
246
  - lib/new_relic/agent/instrumentation/active_record_prepend.rb
247
247
  - lib/new_relic/agent/instrumentation/active_record_subscriber.rb
248
248
  - lib/new_relic/agent/instrumentation/active_storage.rb
@@ -254,7 +254,6 @@ files:
254
254
  - lib/new_relic/agent/instrumentation/curb.rb
255
255
  - lib/new_relic/agent/instrumentation/data_mapper.rb
256
256
  - lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
257
- - lib/new_relic/agent/instrumentation/evented_subscriber.rb
258
257
  - lib/new_relic/agent/instrumentation/excon.rb
259
258
  - lib/new_relic/agent/instrumentation/excon/connection.rb
260
259
  - lib/new_relic/agent/instrumentation/excon/middleware.rb
@@ -271,6 +270,7 @@ files:
271
270
  - lib/new_relic/agent/instrumentation/mongo.rb
272
271
  - lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb
273
272
  - lib/new_relic/agent/instrumentation/net.rb
273
+ - lib/new_relic/agent/instrumentation/notifications_subscriber.rb
274
274
  - lib/new_relic/agent/instrumentation/padrino.rb
275
275
  - lib/new_relic/agent/instrumentation/passenger_instrumentation.rb
276
276
  - lib/new_relic/agent/instrumentation/queue_time.rb
@@ -278,12 +278,10 @@ files:
278
278
  - lib/new_relic/agent/instrumentation/rails/action_controller.rb
279
279
  - lib/new_relic/agent/instrumentation/rails/action_web_service.rb
280
280
  - lib/new_relic/agent/instrumentation/rails3/action_controller.rb
281
- - lib/new_relic/agent/instrumentation/rails4/action_controller.rb
282
- - lib/new_relic/agent/instrumentation/rails4/action_view.rb
283
- - lib/new_relic/agent/instrumentation/rails5/action_cable.rb
284
- - lib/new_relic/agent/instrumentation/rails5/action_controller.rb
285
- - lib/new_relic/agent/instrumentation/rails5/action_view.rb
286
281
  - lib/new_relic/agent/instrumentation/rails_middleware.rb
282
+ - lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb
283
+ - lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb
284
+ - lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb
287
285
  - lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb
288
286
  - lib/new_relic/agent/instrumentation/rake.rb
289
287
  - lib/new_relic/agent/instrumentation/redis.rb
@@ -299,6 +297,7 @@ files:
299
297
  - lib/new_relic/agent/internal_agent_error.rb
300
298
  - lib/new_relic/agent/javascript_instrumentor.rb
301
299
  - lib/new_relic/agent/log_once.rb
300
+ - lib/new_relic/agent/logging.rb
302
301
  - lib/new_relic/agent/memory_logger.rb
303
302
  - lib/new_relic/agent/messaging.rb
304
303
  - lib/new_relic/agent/method_tracer.rb
@@ -360,7 +359,6 @@ files:
360
359
  - lib/new_relic/agent/transaction/trace_node.rb
361
360
  - lib/new_relic/agent/transaction/tracing.rb
362
361
  - lib/new_relic/agent/transaction/transaction_sample_buffer.rb
363
- - lib/new_relic/agent/transaction/xray_sample_buffer.rb
364
362
  - lib/new_relic/agent/transaction_error_primitive.rb
365
363
  - lib/new_relic/agent/transaction_event_aggregator.rb
366
364
  - lib/new_relic/agent/transaction_event_primitive.rb
@@ -394,8 +392,7 @@ files:
394
392
  - lib/new_relic/control/frameworks/rails.rb
395
393
  - lib/new_relic/control/frameworks/rails3.rb
396
394
  - lib/new_relic/control/frameworks/rails4.rb
397
- - lib/new_relic/control/frameworks/rails5.rb
398
- - lib/new_relic/control/frameworks/rails6.rb
395
+ - lib/new_relic/control/frameworks/rails_notifications.rb
399
396
  - lib/new_relic/control/frameworks/ruby.rb
400
397
  - lib/new_relic/control/frameworks/sinatra.rb
401
398
  - lib/new_relic/control/instance_methods.rb
@@ -445,7 +442,11 @@ files:
445
442
  homepage: https://github.com/newrelic/rpm
446
443
  licenses:
447
444
  - New Relic
448
- metadata: {}
445
+ metadata:
446
+ bug_tracker_uri: https://support.newrelic.com/
447
+ changelog_uri: https://github.com/newrelic/rpm/blob/master/CHANGELOG.md
448
+ documentation_uri: https://docs.newrelic.com/docs/agents/ruby-agent
449
+ source_code_uri: https://github.com/newrelic/rpm
449
450
  post_install_message:
450
451
  rdoc_options: []
451
452
  require_paths:
@@ -1,55 +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
- require 'forwardable'
6
-
7
- module NewRelic
8
- module Agent
9
- module Commands
10
- class XraySession
11
- extend Forwardable
12
-
13
- attr_reader :id, :command_arguments
14
- attr_reader :xray_session_name, :key_transaction_name,
15
- :requested_trace_count, :duration, :sample_period
16
-
17
- def initialize(command_arguments)
18
- @command_arguments = command_arguments
19
- @id = command_arguments.fetch("x_ray_id", nil)
20
- @xray_session_name = command_arguments.fetch("xray_session_name", "")
21
- @key_transaction_name = command_arguments.fetch("key_transaction_name", "")
22
- @requested_trace_count = command_arguments.fetch("requested_trace_count", 100)
23
- @duration = command_arguments.fetch("duration", 86400)
24
- @sample_period = command_arguments.fetch("sample_period", 0.1)
25
- @run_profiler = command_arguments.fetch("run_profiler", true)
26
- end
27
-
28
- def active?
29
- @active
30
- end
31
-
32
- def run_profiler?
33
- @run_profiler && NewRelic::Agent.config[:'xray_session.allow_profiles']
34
- end
35
-
36
- def activate
37
- @active = true
38
- @start_time = Time.now
39
- end
40
-
41
- def deactivate
42
- @active = false
43
- end
44
-
45
- def requested_period
46
- @sample_period
47
- end
48
-
49
- def finished?
50
- @start_time + @duration < Time.now
51
- end
52
- end
53
- end
54
- end
55
- end