newrelic_rpm 4.2.0.334 → 4.3.0.335
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -7
- data/CHANGELOG.md +44 -0
- data/lib/new_relic/agent.rb +9 -1
- data/lib/new_relic/agent/agent.rb +1 -0
- data/lib/new_relic/agent/configuration/default_source.rb +15 -0
- data/lib/new_relic/agent/cross_app_monitor.rb +5 -44
- data/lib/new_relic/agent/cross_app_tracing.rb +43 -0
- data/lib/new_relic/agent/error_collector.rb +1 -1
- data/lib/new_relic/agent/http_clients/uri_util.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +5 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +146 -0
- data/lib/new_relic/agent/messaging.rb +414 -0
- data/lib/new_relic/agent/synthetics_monitor.rb +21 -12
- data/lib/new_relic/agent/transaction.rb +23 -4
- data/lib/new_relic/agent/transaction/abstract_segment.rb +3 -2
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +104 -0
- data/lib/new_relic/agent/transaction/segment.rb +2 -2
- data/lib/new_relic/agent/transaction/tracing.rb +37 -8
- data/lib/new_relic/agent/transaction_state.rb +1 -1
- data/lib/new_relic/latest_changes.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +1 -1
- metadata +6 -3
@@ -9,6 +9,7 @@ require 'new_relic/agent/method_tracer_helpers'
|
|
9
9
|
require 'new_relic/agent/transaction/attributes'
|
10
10
|
require 'new_relic/agent/transaction/request_attributes'
|
11
11
|
require 'new_relic/agent/transaction/tracing'
|
12
|
+
require 'new_relic/agent/cross_app_tracing'
|
12
13
|
|
13
14
|
module NewRelic
|
14
15
|
module Agent
|
@@ -25,6 +26,7 @@ module NewRelic
|
|
25
26
|
MIDDLEWARE_PREFIX = 'Middleware/Rack/'.freeze
|
26
27
|
TASK_PREFIX = 'OtherTransaction/Background/'.freeze
|
27
28
|
RAKE_PREFIX = 'OtherTransaction/Rake/'.freeze
|
29
|
+
MESSAGE_PREFIX = 'OtherTransaction/Message/'.freeze
|
28
30
|
RACK_PREFIX = 'Controller/Rack/'.freeze
|
29
31
|
SINATRA_PREFIX = 'Controller/Sinatra/'.freeze
|
30
32
|
GRAPE_PREFIX = 'Controller/Grape/'.freeze
|
@@ -409,6 +411,8 @@ module NewRelic
|
|
409
411
|
NewRelic::Agent.instance.events.notify(:start_transaction)
|
410
412
|
NewRelic::Agent::BusyCalculator.dispatcher_start(start_time)
|
411
413
|
|
414
|
+
ignore! if user_defined_rules_ignore?
|
415
|
+
|
412
416
|
create_initial_segment @default_name
|
413
417
|
end
|
414
418
|
|
@@ -487,7 +491,6 @@ module NewRelic
|
|
487
491
|
def stop(state, end_time, outermost_frame)
|
488
492
|
return if !state.is_execution_traced?
|
489
493
|
freeze_name_and_execute_if_not_ignored
|
490
|
-
ignore! if user_defined_rules_ignore?
|
491
494
|
|
492
495
|
if nesting_max_depth == 1
|
493
496
|
outermost_frame.name = @frozen_name
|
@@ -520,6 +523,7 @@ module NewRelic
|
|
520
523
|
record_summary_metrics(outermost_node_name, end_time)
|
521
524
|
record_apdex(state, end_time) unless ignore_apdex?
|
522
525
|
record_queue_time
|
526
|
+
record_client_application_metric state
|
523
527
|
|
524
528
|
generate_payload(state, start_time, end_time)
|
525
529
|
|
@@ -775,6 +779,12 @@ module NewRelic
|
|
775
779
|
end
|
776
780
|
end
|
777
781
|
|
782
|
+
def record_client_application_metric state
|
783
|
+
if id = state.client_cross_app_id
|
784
|
+
NewRelic::Agent.record_metric "ClientApplication/#{id}/all", state.timings.app_time_in_seconds
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
778
788
|
APDEX_ALL_METRIC = 'ApdexAll'.freeze
|
779
789
|
|
780
790
|
APDEX_METRIC = 'Apdex'.freeze
|
@@ -785,10 +795,10 @@ module NewRelic
|
|
785
795
|
|
786
796
|
def had_error_affecting_apdex?
|
787
797
|
@exceptions.each do |exception, options|
|
788
|
-
ignored
|
789
|
-
|
798
|
+
ignored = NewRelic::Agent.instance.error_collector.error_is_ignored?(exception)
|
799
|
+
expected = options[:expected]
|
790
800
|
|
791
|
-
return true unless ignored ||
|
801
|
+
return true unless ignored || expected
|
792
802
|
end
|
793
803
|
false
|
794
804
|
end
|
@@ -909,6 +919,15 @@ module NewRelic
|
|
909
919
|
@ignore_trace
|
910
920
|
end
|
911
921
|
|
922
|
+
def add_message_cat_headers headers
|
923
|
+
state.is_cross_app_caller = true
|
924
|
+
CrossAppTracing.insert_message_headers headers,
|
925
|
+
guid,
|
926
|
+
cat_trip_id(state),
|
927
|
+
cat_path_hash(state),
|
928
|
+
raw_synthetics_header
|
929
|
+
end
|
930
|
+
|
912
931
|
private
|
913
932
|
|
914
933
|
def process_cpu
|
@@ -10,7 +10,7 @@ module NewRelic
|
|
10
10
|
attr_accessor :name, :parent, :children_time, :transaction
|
11
11
|
attr_writer :record_metrics, :record_scoped_metric, :record_on_finish
|
12
12
|
|
13
|
-
def initialize name=nil
|
13
|
+
def initialize name=nil, start_time=nil
|
14
14
|
@name = name
|
15
15
|
@children_time = 0.0
|
16
16
|
@record_metrics = true
|
@@ -19,10 +19,11 @@ module NewRelic
|
|
19
19
|
@parent = nil
|
20
20
|
@record_on_finish = false
|
21
21
|
@params = nil
|
22
|
+
@start_time = start_time if start_time
|
22
23
|
end
|
23
24
|
|
24
25
|
def start
|
25
|
-
@start_time
|
26
|
+
@start_time ||= Time.now
|
26
27
|
end
|
27
28
|
|
28
29
|
def finish
|
@@ -0,0 +1,104 @@
|
|
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/agent/transaction/segment'
|
6
|
+
require 'new_relic/agent/cross_app_tracing'
|
7
|
+
|
8
|
+
module NewRelic
|
9
|
+
module Agent
|
10
|
+
class Transaction
|
11
|
+
class MessageBrokerSegment < Segment
|
12
|
+
CONSUME = 'Consume'.freeze
|
13
|
+
EXCHANGE = 'Exchange'.freeze
|
14
|
+
NAMED = 'Named/'.freeze
|
15
|
+
PRODUCE = 'Produce'.freeze
|
16
|
+
QUEUE = 'Queue'.freeze
|
17
|
+
PURGE = 'Purge'.freeze
|
18
|
+
SLASH = '/'.freeze
|
19
|
+
TEMP = 'Temp'.freeze
|
20
|
+
TOPIC = 'Topic'.freeze
|
21
|
+
UNKNOWN = 'Unknown'.freeze
|
22
|
+
|
23
|
+
DESTINATION_TYPES = [
|
24
|
+
:exchange,
|
25
|
+
:queue,
|
26
|
+
:topic,
|
27
|
+
:temporary_queue,
|
28
|
+
:temporary_topic,
|
29
|
+
:unknown
|
30
|
+
]
|
31
|
+
|
32
|
+
ACTIONS = {
|
33
|
+
consume: CONSUME,
|
34
|
+
produce: PRODUCE,
|
35
|
+
purge: PURGE
|
36
|
+
}
|
37
|
+
|
38
|
+
TYPES = {
|
39
|
+
exchange: EXCHANGE,
|
40
|
+
temporary_queue: QUEUE,
|
41
|
+
queue: QUEUE,
|
42
|
+
temporary_topic: TOPIC,
|
43
|
+
topic: TOPIC,
|
44
|
+
unknown: EXCHANGE
|
45
|
+
}
|
46
|
+
|
47
|
+
METRIC_PREFIX = 'MessageBroker/'.freeze
|
48
|
+
|
49
|
+
attr_reader :action,
|
50
|
+
:destination_name,
|
51
|
+
:destination_type,
|
52
|
+
:library,
|
53
|
+
:headers
|
54
|
+
|
55
|
+
def initialize action: nil,
|
56
|
+
library: nil,
|
57
|
+
destination_type: nil,
|
58
|
+
destination_name: nil,
|
59
|
+
headers: nil,
|
60
|
+
parameters: nil,
|
61
|
+
start_time: nil
|
62
|
+
|
63
|
+
# ruby 2.0.0 does not support required kwargs
|
64
|
+
raise ArgumentError, 'missing required argument: action' if action.nil?
|
65
|
+
raise ArgumentError, 'missing required argument: library' if library.nil?
|
66
|
+
raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
|
67
|
+
raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
|
68
|
+
|
69
|
+
@action = action
|
70
|
+
@library = library
|
71
|
+
@destination_type = destination_type
|
72
|
+
@destination_name = destination_name
|
73
|
+
@headers = headers
|
74
|
+
super(nil, nil, start_time)
|
75
|
+
params.merge! parameters if parameters
|
76
|
+
end
|
77
|
+
|
78
|
+
def name
|
79
|
+
return @name if @name
|
80
|
+
@name = METRIC_PREFIX + library
|
81
|
+
@name << SLASH << TYPES[destination_type] << SLASH << ACTIONS[action] << SLASH
|
82
|
+
|
83
|
+
if destination_type == :temporary_queue || destination_type == :temporary_topic
|
84
|
+
@name << TEMP
|
85
|
+
else
|
86
|
+
@name << NAMED << destination_name
|
87
|
+
end
|
88
|
+
|
89
|
+
@name
|
90
|
+
end
|
91
|
+
|
92
|
+
def transaction= t
|
93
|
+
super
|
94
|
+
if headers && transaction && action == :produce && record_metrics? && CrossAppTracing.cross_app_enabled?
|
95
|
+
transaction.add_message_cat_headers headers
|
96
|
+
end
|
97
|
+
rescue => e
|
98
|
+
NewRelic::Agent.logger.error "Error during message header processing", e
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -13,9 +13,9 @@ module NewRelic
|
|
13
13
|
# initialize it as an array that would be empty, have one item, or many items.
|
14
14
|
attr_reader :unscoped_metrics
|
15
15
|
|
16
|
-
def initialize name
|
16
|
+
def initialize name=nil, unscoped_metrics=nil, start_time=nil
|
17
17
|
@unscoped_metrics = unscoped_metrics
|
18
|
-
super name
|
18
|
+
super name, start_time
|
19
19
|
end
|
20
20
|
|
21
21
|
def record_metrics
|
@@ -5,6 +5,7 @@
|
|
5
5
|
require 'new_relic/agent/transaction/segment'
|
6
6
|
require 'new_relic/agent/transaction/datastore_segment'
|
7
7
|
require 'new_relic/agent/transaction/external_request_segment'
|
8
|
+
require 'new_relic/agent/transaction/message_broker_segment'
|
8
9
|
|
9
10
|
module NewRelic
|
10
11
|
module Agent
|
@@ -13,9 +14,7 @@ module NewRelic
|
|
13
14
|
module ClassMethods
|
14
15
|
def start_segment name, unscoped_metrics=nil
|
15
16
|
segment = Segment.new name, unscoped_metrics
|
16
|
-
segment
|
17
|
-
add_segment segment
|
18
|
-
segment
|
17
|
+
start_and_add_segment segment
|
19
18
|
end
|
20
19
|
|
21
20
|
UNKNOWN_PRODUCT = "Unknown".freeze
|
@@ -25,20 +24,50 @@ module NewRelic
|
|
25
24
|
product ||= UNKNOWN_PRODUCT
|
26
25
|
operation ||= UNKNOWN_OPERATION
|
27
26
|
segment = DatastoreSegment.new product, operation, collection, host, port_path_or_id, database_name
|
28
|
-
segment
|
29
|
-
add_segment segment
|
30
|
-
segment
|
27
|
+
start_and_add_segment segment
|
31
28
|
end
|
32
29
|
|
33
30
|
def start_external_request_segment library, uri, procedure
|
34
31
|
segment = ExternalRequestSegment.new library, uri, procedure
|
32
|
+
start_and_add_segment segment
|
33
|
+
end
|
34
|
+
|
35
|
+
# @api private
|
36
|
+
#
|
37
|
+
def start_message_broker_segment(action: nil,
|
38
|
+
library: nil,
|
39
|
+
destination_type: nil,
|
40
|
+
destination_name: nil,
|
41
|
+
headers: nil,
|
42
|
+
parameters: nil,
|
43
|
+
start_time: nil)
|
44
|
+
|
45
|
+
# ruby 2.0.0 does not support required kwargs
|
46
|
+
raise ArgumentError, 'missing required argument: action' if action.nil?
|
47
|
+
raise ArgumentError, 'missing required argument: library' if library.nil?
|
48
|
+
raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
|
49
|
+
raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
|
50
|
+
|
51
|
+
segment = MessageBrokerSegment.new(
|
52
|
+
action: action,
|
53
|
+
library: library,
|
54
|
+
destination_type: destination_type,
|
55
|
+
destination_name: destination_name,
|
56
|
+
headers: headers,
|
57
|
+
parameters: parameters,
|
58
|
+
start_time: start_time
|
59
|
+
)
|
60
|
+
start_and_add_segment segment
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def start_and_add_segment segment
|
35
66
|
segment.start
|
36
67
|
add_segment segment
|
37
68
|
segment
|
38
69
|
end
|
39
70
|
|
40
|
-
private
|
41
|
-
|
42
71
|
def add_segment segment
|
43
72
|
state = NewRelic::Agent::TransactionState.tl_get
|
44
73
|
if (txn = state.current_transaction) && state.is_execution_traced?
|
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 = [ "
|
13
|
+
s.authors = [ "Matthew Wear", "Kenichi Nakamura", "Chris Pine", "Dana Scheider" ]
|
14
14
|
s.date = Time.now.strftime('%Y-%m-%d')
|
15
15
|
s.licenses = ['New Relic']
|
16
16
|
s.description = <<-EOS
|
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.
|
4
|
+
version: 4.3.0.335
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Tim Krajcar
|
8
7
|
- Matthew Wear
|
9
8
|
- Kenichi Nakamura
|
10
9
|
- Chris Pine
|
10
|
+
- Dana Scheider
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- lib/new_relic/agent/instrumentation/active_record_subscriber.rb
|
240
240
|
- lib/new_relic/agent/instrumentation/acts_as_solr.rb
|
241
241
|
- lib/new_relic/agent/instrumentation/authlogic.rb
|
242
|
+
- lib/new_relic/agent/instrumentation/bunny.rb
|
242
243
|
- lib/new_relic/agent/instrumentation/controller_instrumentation.rb
|
243
244
|
- lib/new_relic/agent/instrumentation/curb.rb
|
244
245
|
- lib/new_relic/agent/instrumentation/data_mapper.rb
|
@@ -289,6 +290,7 @@ files:
|
|
289
290
|
- lib/new_relic/agent/javascript_instrumentor.rb
|
290
291
|
- lib/new_relic/agent/log_once.rb
|
291
292
|
- lib/new_relic/agent/memory_logger.rb
|
293
|
+
- lib/new_relic/agent/messaging.rb
|
292
294
|
- lib/new_relic/agent/method_tracer.rb
|
293
295
|
- lib/new_relic/agent/method_tracer_helpers.rb
|
294
296
|
- lib/new_relic/agent/new_relic_service.rb
|
@@ -332,6 +334,7 @@ files:
|
|
332
334
|
- lib/new_relic/agent/transaction/attributes.rb
|
333
335
|
- lib/new_relic/agent/transaction/datastore_segment.rb
|
334
336
|
- lib/new_relic/agent/transaction/external_request_segment.rb
|
337
|
+
- lib/new_relic/agent/transaction/message_broker_segment.rb
|
335
338
|
- lib/new_relic/agent/transaction/request_attributes.rb
|
336
339
|
- lib/new_relic/agent/transaction/segment.rb
|
337
340
|
- lib/new_relic/agent/transaction/slowest_sample_buffer.rb
|