newrelic_rpm 5.5.0.348 → 6.2.0.354
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +36 -84
- data/.yardopts +1 -0
- data/CHANGELOG.md +149 -0
- data/README.md +1 -1
- data/config.dot +1 -0
- data/lib/new_relic/agent/agent.rb +15 -11
- data/lib/new_relic/agent/attribute_filter.rb +77 -17
- data/lib/new_relic/agent/configuration/default_source.rb +71 -1
- data/lib/new_relic/agent/configuration/security_policy_source.rb +14 -0
- data/lib/new_relic/agent/configuration/server_source.rb +2 -1
- data/lib/new_relic/agent/cross_app_monitor.rb +3 -3
- data/lib/new_relic/agent/datastores/metric_helper.rb +1 -2
- data/lib/new_relic/agent/datastores.rb +6 -8
- data/lib/new_relic/agent/distributed_trace_monitor.rb +1 -2
- data/lib/new_relic/agent/distributed_trace_payload.rb +7 -11
- data/lib/new_relic/agent/error_collector.rb +4 -6
- data/lib/new_relic/agent/external.rb +6 -4
- data/lib/new_relic/agent/hostname.rb +8 -0
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +8 -5
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +12 -8
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job.rb +6 -7
- data/lib/new_relic/agent/instrumentation/active_record.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_storage.rb +23 -0
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +59 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +16 -12
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +9 -3
- data/lib/new_relic/agent/instrumentation/curb.rb +18 -5
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grape.rb +17 -4
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +11 -4
- data/lib/new_relic/agent/instrumentation/net.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +2 -3
- data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +3 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +9 -8
- data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +0 -1
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +5 -26
- data/lib/new_relic/agent/new_relic_service.rb +69 -25
- data/lib/new_relic/agent/span_event_primitive.rb +26 -16
- data/lib/new_relic/agent/sql_sampler.rb +3 -3
- data/lib/new_relic/agent/stats_engine.rb +2 -2
- data/lib/new_relic/agent/synthetics_monitor.rb +1 -2
- data/lib/new_relic/agent/system_info.rb +5 -0
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +462 -0
- data/lib/new_relic/agent/transaction/abstract_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/datastore_segment.rb +0 -2
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +1 -2
- data/lib/new_relic/agent/transaction/trace_node.rb +4 -2
- data/lib/new_relic/agent/transaction/tracing.rb +0 -99
- data/lib/new_relic/agent/transaction.rb +43 -88
- data/lib/new_relic/agent/transaction_time_aggregator.rb +49 -25
- data/lib/new_relic/agent/utilization_data.rb +36 -1
- data/lib/new_relic/agent.rb +8 -4
- data/lib/new_relic/build.rb +2 -2
- data/lib/new_relic/control/frameworks/rails6.rb +14 -0
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/rack/agent_middleware.rb +1 -1
- data/lib/new_relic/version.rb +2 -2
- data/newrelic_rpm.gemspec +2 -9
- data/test/agent_helper.rb +2 -2
- metadata +13 -39
- data/lib/new_relic/agent/transaction_state.rb +0 -186
@@ -7,10 +7,11 @@ require 'new_relic/agent/utilization/gcp'
|
|
7
7
|
require 'new_relic/agent/utilization/azure'
|
8
8
|
require 'new_relic/agent/utilization/pcf'
|
9
9
|
|
10
|
+
|
10
11
|
module NewRelic
|
11
12
|
module Agent
|
12
13
|
class UtilizationData
|
13
|
-
METADATA_VERSION =
|
14
|
+
METADATA_VERSION = 5
|
14
15
|
|
15
16
|
VENDORS = {
|
16
17
|
Utilization::AWS => :'utilization.detect_aws',
|
@@ -23,6 +24,14 @@ module NewRelic
|
|
23
24
|
NewRelic::Agent::Hostname.get
|
24
25
|
end
|
25
26
|
|
27
|
+
def fqdn
|
28
|
+
NewRelic::Agent::Hostname.get_fqdn
|
29
|
+
end
|
30
|
+
|
31
|
+
def ip_addresses
|
32
|
+
::NewRelic::Agent::SystemInfo.ip_addresses
|
33
|
+
end
|
34
|
+
|
26
35
|
def container_id
|
27
36
|
::NewRelic::Agent::SystemInfo.docker_container_id
|
28
37
|
end
|
@@ -69,6 +78,9 @@ module NewRelic
|
|
69
78
|
append_docker_info(result)
|
70
79
|
append_configured_values(result)
|
71
80
|
append_boot_id(result)
|
81
|
+
append_ip_address(result)
|
82
|
+
append_full_hostname(result)
|
83
|
+
append_kubernetes_info(result)
|
72
84
|
|
73
85
|
result
|
74
86
|
end
|
@@ -105,6 +117,29 @@ module NewRelic
|
|
105
117
|
end
|
106
118
|
end
|
107
119
|
|
120
|
+
def append_ip_address(collector_hash)
|
121
|
+
ips = ip_addresses
|
122
|
+
collector_hash[:ip_address] = ips unless ips.empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
KUBERNETES_SERVICE_HOST = 'KUBERNETES_SERVICE_HOST'.freeze
|
126
|
+
|
127
|
+
def append_kubernetes_info(collector_hash)
|
128
|
+
return unless Agent.config[:'utilization.detect_kubernetes']
|
129
|
+
if host = ENV[KUBERNETES_SERVICE_HOST]
|
130
|
+
collector_hash[:vendors] ||= {}
|
131
|
+
collector_hash[:vendors][:kubernetes] = {
|
132
|
+
kubernetes_service_host: host
|
133
|
+
}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def append_full_hostname(collector_hash)
|
138
|
+
full_hostname = fqdn
|
139
|
+
return if full_hostname.nil? || full_hostname.empty?
|
140
|
+
collector_hash[:full_hostname] = full_hostname
|
141
|
+
end
|
142
|
+
|
108
143
|
def config_hash
|
109
144
|
config_hash = {}
|
110
145
|
|
data/lib/new_relic/agent.rb
CHANGED
@@ -76,7 +76,11 @@ module NewRelic
|
|
76
76
|
class ForceDisconnectException < StandardError; end
|
77
77
|
|
78
78
|
# An exception that forces an agent to restart.
|
79
|
-
class ForceRestartException < StandardError
|
79
|
+
class ForceRestartException < StandardError
|
80
|
+
def message
|
81
|
+
"#{super}, restarting."
|
82
|
+
end
|
83
|
+
end
|
80
84
|
|
81
85
|
# Used to blow out of a periodic task without logging a an error, such as for routine
|
82
86
|
# failures.
|
@@ -487,7 +491,7 @@ module NewRelic
|
|
487
491
|
# Yield to the block without collecting any metrics or traces in
|
488
492
|
# any of the subsequent calls. If executed recursively, will keep
|
489
493
|
# track of the first entry point and turn on tracing again after
|
490
|
-
# leaving that block. This uses the thread local
|
494
|
+
# leaving that block. This uses the thread local Tracer::State.
|
491
495
|
#
|
492
496
|
# @api public
|
493
497
|
#
|
@@ -544,13 +548,13 @@ module NewRelic
|
|
544
548
|
|
545
549
|
# Check to see if we are capturing metrics currently on this thread.
|
546
550
|
def tl_is_execution_traced?
|
547
|
-
NewRelic::Agent::
|
551
|
+
NewRelic::Agent::Tracer.state.is_execution_traced?
|
548
552
|
end
|
549
553
|
|
550
554
|
# helper method to check the thread local to determine whether sql
|
551
555
|
# is being recorded or not
|
552
556
|
def tl_is_sql_recorded?
|
553
|
-
NewRelic::Agent::
|
557
|
+
NewRelic::Agent::Tracer.state.is_sql_recorded?
|
554
558
|
end
|
555
559
|
|
556
560
|
# @!group Adding custom attributes to traces
|
data/lib/new_relic/build.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# GITSHA:
|
2
|
-
module NewRelic; module VERSION; BUILD='
|
1
|
+
# GITSHA: aa8729185abae27cfa81e0e908b89b5572b8d365
|
2
|
+
module NewRelic; module VERSION; BUILD='354'; end; end
|
@@ -0,0 +1,14 @@
|
|
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 'new_relic/control/frameworks/rails4'
|
6
|
+
|
7
|
+
module NewRelic
|
8
|
+
class Control
|
9
|
+
module Frameworks
|
10
|
+
class Rails6 < NewRelic::Control::Frameworks::Rails4
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -26,7 +26,7 @@ EOS
|
|
26
26
|
# * This is a patch item (3.7.1.188)
|
27
27
|
def self.read_patch(patch_level, changelog=default_changelog)
|
28
28
|
latest = extract_latest_changes(File.read(changelog))
|
29
|
-
changes = ["## v#{patch_level}
|
29
|
+
changes = ["## v#{patch_level}", ""]
|
30
30
|
|
31
31
|
current_item = nil
|
32
32
|
latest.each do |line|
|
@@ -52,7 +52,7 @@ EOS
|
|
52
52
|
changes = []
|
53
53
|
version_count = 0
|
54
54
|
contents.each_line do |line|
|
55
|
-
if line.match(/##\s+v[\d.]
|
55
|
+
if line.match(/##\s+v[\d.]+/)
|
56
56
|
version_count += 1
|
57
57
|
end
|
58
58
|
break if version_count >= 2
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
4
|
|
5
|
-
require 'new_relic/agent/
|
5
|
+
require 'new_relic/agent/tracer'
|
6
6
|
require 'new_relic/agent/instrumentation/controller_instrumentation'
|
7
7
|
require 'new_relic/agent/instrumentation/middleware_tracing'
|
8
8
|
|
data/lib/new_relic/version.rb
CHANGED
data/newrelic_rpm.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.version = NewRelic::VERSION::STRING
|
11
11
|
s.required_ruby_version = '>= 2.0.0'
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
13
|
-
s.authors = [ "Matthew Wear", "Chris Pine", "
|
13
|
+
s.authors = [ "Matthew Wear", "Chris Pine", "Rachel Klein", "Justin Foote" ]
|
14
14
|
s.date = Time.now.strftime('%Y-%m-%d')
|
15
15
|
s.licenses = ['New Relic']
|
16
16
|
s.description = <<-EOS
|
@@ -45,15 +45,8 @@ EOS
|
|
45
45
|
s.add_development_dependency 'minitest', '~> 4.7.5'
|
46
46
|
s.add_development_dependency 'mocha', '~> 0.13.0'
|
47
47
|
s.add_development_dependency 'yard'
|
48
|
-
s.add_development_dependency 'rails', '~> 3.2.13'
|
49
|
-
s.add_development_dependency 'json', '>= 2.0.2' if RUBY_VERSION >= '2.4.0' # possible bundler issue?
|
50
48
|
s.add_development_dependency 'pry-nav', '~> 0.2.4'
|
51
49
|
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9'
|
52
50
|
s.add_development_dependency 'hometown', '~> 0.2.5'
|
53
|
-
|
54
|
-
if RUBY_PLATFORM == 'java'
|
55
|
-
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter'
|
56
|
-
else
|
57
|
-
s.add_development_dependency 'sqlite3'
|
58
|
-
end
|
51
|
+
s.add_development_dependency 'bundler', '< 2.0'
|
59
52
|
end
|
data/test/agent_helper.rb
CHANGED
@@ -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::
|
337
|
+
state = NewRelic::Agent::Tracer.state
|
338
338
|
txn = nil
|
339
339
|
|
340
|
-
NewRelic::Agent::
|
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,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.2.0.354
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Wear
|
8
8
|
- Chris Pine
|
9
|
-
- Erin Dees
|
10
9
|
- Rachel Klein
|
10
|
+
- Justin Foote
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -69,34 +69,6 @@ dependencies:
|
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: rails
|
74
|
-
requirement: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - "~>"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 3.2.13
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - "~>"
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 3.2.13
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: json
|
88
|
-
requirement: !ruby/object:Gem::Requirement
|
89
|
-
requirements:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 2.0.2
|
93
|
-
type: :development
|
94
|
-
prerelease: false
|
95
|
-
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 2.0.2
|
100
72
|
- !ruby/object:Gem::Dependency
|
101
73
|
name: pry-nav
|
102
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,19 +112,19 @@ dependencies:
|
|
140
112
|
- !ruby/object:Gem::Version
|
141
113
|
version: 0.2.5
|
142
114
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
115
|
+
name: bundler
|
144
116
|
requirement: !ruby/object:Gem::Requirement
|
145
117
|
requirements:
|
146
|
-
- - "
|
118
|
+
- - "<"
|
147
119
|
- !ruby/object:Gem::Version
|
148
|
-
version: '0'
|
120
|
+
version: '2.0'
|
149
121
|
type: :development
|
150
122
|
prerelease: false
|
151
123
|
version_requirements: !ruby/object:Gem::Requirement
|
152
124
|
requirements:
|
153
|
-
- - "
|
125
|
+
- - "<"
|
154
126
|
- !ruby/object:Gem::Version
|
155
|
-
version: '0'
|
127
|
+
version: '2.0'
|
156
128
|
description: |
|
157
129
|
New Relic is a performance management system, developed by New Relic,
|
158
130
|
Inc (http://www.newrelic.com). New Relic provides you with deep
|
@@ -273,6 +245,8 @@ files:
|
|
273
245
|
- lib/new_relic/agent/instrumentation/active_record_helper.rb
|
274
246
|
- lib/new_relic/agent/instrumentation/active_record_prepend.rb
|
275
247
|
- lib/new_relic/agent/instrumentation/active_record_subscriber.rb
|
248
|
+
- lib/new_relic/agent/instrumentation/active_storage.rb
|
249
|
+
- lib/new_relic/agent/instrumentation/active_storage_subscriber.rb
|
276
250
|
- lib/new_relic/agent/instrumentation/acts_as_solr.rb
|
277
251
|
- lib/new_relic/agent/instrumentation/authlogic.rb
|
278
252
|
- lib/new_relic/agent/instrumentation/bunny.rb
|
@@ -369,6 +343,7 @@ files:
|
|
369
343
|
- lib/new_relic/agent/threading/backtrace_service.rb
|
370
344
|
- lib/new_relic/agent/threading/thread_profile.rb
|
371
345
|
- lib/new_relic/agent/timestamp_sampled_buffer.rb
|
346
|
+
- lib/new_relic/agent/tracer.rb
|
372
347
|
- lib/new_relic/agent/transaction.rb
|
373
348
|
- lib/new_relic/agent/transaction/abstract_segment.rb
|
374
349
|
- lib/new_relic/agent/transaction/attributes.rb
|
@@ -392,7 +367,6 @@ files:
|
|
392
367
|
- lib/new_relic/agent/transaction_event_recorder.rb
|
393
368
|
- lib/new_relic/agent/transaction_metrics.rb
|
394
369
|
- lib/new_relic/agent/transaction_sampler.rb
|
395
|
-
- lib/new_relic/agent/transaction_state.rb
|
396
370
|
- lib/new_relic/agent/transaction_time_aggregator.rb
|
397
371
|
- lib/new_relic/agent/utilization/aws.rb
|
398
372
|
- lib/new_relic/agent/utilization/azure.rb
|
@@ -421,6 +395,7 @@ files:
|
|
421
395
|
- lib/new_relic/control/frameworks/rails3.rb
|
422
396
|
- lib/new_relic/control/frameworks/rails4.rb
|
423
397
|
- lib/new_relic/control/frameworks/rails5.rb
|
398
|
+
- lib/new_relic/control/frameworks/rails6.rb
|
424
399
|
- lib/new_relic/control/frameworks/ruby.rb
|
425
400
|
- lib/new_relic/control/frameworks/sinatra.rb
|
426
401
|
- lib/new_relic/control/instance_methods.rb
|
@@ -486,8 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
461
|
- !ruby/object:Gem::Version
|
487
462
|
version: 1.3.1
|
488
463
|
requirements: []
|
489
|
-
|
490
|
-
rubygems_version: 2.7.7
|
464
|
+
rubygems_version: 3.0.3
|
491
465
|
signing_key:
|
492
466
|
specification_version: 4
|
493
467
|
summary: New Relic Ruby Agent
|
@@ -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
|