newrelic_rpm 4.7.1.340 → 4.8.0.341
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +20 -2
- data/CHANGELOG.md +24 -1
- data/lib/new_relic/agent/attribute_filter.rb +0 -2
- data/lib/new_relic/agent/configuration/yaml_source.rb +8 -10
- data/lib/new_relic/agent/transaction/request_attributes.rb +5 -13
- data/lib/new_relic/agent/transaction/trace.rb +20 -12
- data/lib/new_relic/agent/transaction/trace_builder.rb +0 -1
- data/lib/new_relic/noticed_error.rb +16 -8
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +1 -1
- data/test/agent_helper.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b51f94bfacea16c929d073a557db1c96c171da40
|
4
|
+
data.tar.gz: 6b593714cfad1a3751dd07b410ba300fe46e4751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88aa0416e6c2a3f8e32b6b5536e1b4f58b5b423ce06085ba583830fca6c014c04ea318bad3b48bcc17f5f93506d27f1ac7fed3ce56fb157cfd43830650c74652
|
7
|
+
data.tar.gz: afc0971db514b4b76e93725c6c7b299e26a281ba0a8cee2add9aba30a149f0c20a0dc74d7d08363f4977a54c5dc90f2e897edf64d2fa658cf286cc18358cc978
|
data/.travis.yml
CHANGED
@@ -10,6 +10,7 @@ sudo: required
|
|
10
10
|
|
11
11
|
before_install:
|
12
12
|
- gem --version
|
13
|
+
- gem update --system
|
13
14
|
- ./test/script/before_install/gemstash_mirror.sh
|
14
15
|
- bundle --version
|
15
16
|
|
@@ -33,6 +34,7 @@ notifications:
|
|
33
34
|
rvm:
|
34
35
|
# Run slowest builds first to try and optimize overall cycle time.
|
35
36
|
- jruby-9.1.13.0
|
37
|
+
- 2.5.0
|
36
38
|
- 2.4.2
|
37
39
|
- 2.3.5
|
38
40
|
- 2.2.8
|
@@ -80,6 +82,24 @@ matrix:
|
|
80
82
|
fast_finish: true
|
81
83
|
exclude:
|
82
84
|
# Unsupported Rails/Ruby combinations
|
85
|
+
# 2.5
|
86
|
+
- rvm: 2.5.0
|
87
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
88
|
+
- rvm: 2.5.0
|
89
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
90
|
+
- rvm: 2.5.0
|
91
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
92
|
+
- rvm: 2.5.0
|
93
|
+
env: TYPE=UNIT ENVIRONMENT=rails30
|
94
|
+
- rvm: 2.5.0
|
95
|
+
env: TYPE=UNIT ENVIRONMENT=rails31
|
96
|
+
- rvm: 2.5.0
|
97
|
+
env: TYPE=UNIT ENVIRONMENT=rails32
|
98
|
+
- rvm: 2.5.0
|
99
|
+
env: TYPE=UNIT ENVIRONMENT=rails40
|
100
|
+
- rvm: 2.5.0
|
101
|
+
env: TYPE=UNIT ENVIRONMENT=rails41
|
102
|
+
|
83
103
|
# 2.4
|
84
104
|
- rvm: 2.4.2
|
85
105
|
env: TYPE=UNIT ENVIRONMENT=rails21
|
@@ -97,8 +117,6 @@ matrix:
|
|
97
117
|
env: TYPE=UNIT ENVIRONMENT=rails40
|
98
118
|
- rvm: 2.4.2
|
99
119
|
env: TYPE=UNIT ENVIRONMENT=rails41
|
100
|
-
- rvm: 2.4.2
|
101
|
-
env: TYPE=UNIT ENVIRONMENT=rails42
|
102
120
|
|
103
121
|
# 2.3
|
104
122
|
- rvm: 2.3.5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v4.8.0 ##
|
4
|
+
|
5
|
+
* Initialize New Relic Agent before config initializers
|
6
|
+
|
7
|
+
When running in a Rails environment, the agent registers an initializer that
|
8
|
+
starts the agent. This initializer is now defined to run before config/initializers.
|
9
|
+
Previously, the ordering was not specified for the initializer. This change
|
10
|
+
guarantees the agent will started by the time your initializers run, so you can
|
11
|
+
safely reference the Agent in your custom initializers. Thanks to Tony Ta for
|
12
|
+
the contribution.
|
13
|
+
|
14
|
+
* Ruby 2.5 Support
|
15
|
+
|
16
|
+
The Ruby Agent has been verified to run under Ruby 2.5.
|
17
|
+
|
18
|
+
* `request.uri` Collected as an Agent Attribute
|
19
|
+
|
20
|
+
Users can now control the collection of `request.uri` on errors and transaction
|
21
|
+
traces. Previously it was always collected without the ability to turn it off.
|
22
|
+
It is now an agent attribute that can be controlled via the attributes config.
|
23
|
+
For more information on agent attributes [see here](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/agent-attributes).
|
24
|
+
|
3
25
|
## 4.7.1 ##
|
4
26
|
|
5
27
|
* Bugfix for Manual Browser Instrumentation
|
@@ -7,7 +29,8 @@
|
|
7
29
|
There was a previous bug that required setting both `rum.enabled: false` and
|
8
30
|
`browser.auto_instrument: false` to completely disable browser monitoring. An
|
9
31
|
attempt to fix this in 4.7.0 resulted in breaking manual browser
|
10
|
-
instrumentation. Those changes have been reverted.
|
32
|
+
instrumentation. Those changes have been reverted. We will revisit this issue
|
33
|
+
in an upcoming release.
|
11
34
|
|
12
35
|
## v4.7.0 ##
|
13
36
|
|
@@ -100,8 +100,6 @@ module NewRelic
|
|
100
100
|
build_rule(config[:'transaction_events.attributes.include'], DST_TRANSACTION_EVENTS, true)
|
101
101
|
build_rule(config[:'error_collector.attributes.include'], DST_ERROR_COLLECTOR, true)
|
102
102
|
build_rule(config[:'browser_monitoring.attributes.include'], DST_BROWSER_MONITORING, true)
|
103
|
-
# This agent attribute has unexpected behaviors and we need to ensure it only goes where directed in configuration
|
104
|
-
build_rule(['request_uri'], DST_TRANSACTION_TRACER | DST_ERROR_COLLECTOR, false)
|
105
103
|
|
106
104
|
@rules.sort!
|
107
105
|
|
@@ -9,11 +9,19 @@ module NewRelic
|
|
9
9
|
module Configuration
|
10
10
|
class YamlSource < DottedHash
|
11
11
|
attr_accessor :file_path, :failures
|
12
|
+
attr_reader :generated_for_user, :license_key
|
12
13
|
|
13
14
|
def initialize(path, env)
|
14
15
|
config = {}
|
15
16
|
@failures = []
|
16
17
|
|
18
|
+
# These are needed in process_erb for populating the newrelic.yml via
|
19
|
+
# erb binding, necessary when using the default newrelic.yml file. They
|
20
|
+
# are defined as ivars instead of local variables to prevent
|
21
|
+
# `assigned but unused variable` warnings when running with -W
|
22
|
+
@generated_for_user = ''
|
23
|
+
@license_key = ''
|
24
|
+
|
17
25
|
begin
|
18
26
|
@file_path = validate_config_file_path(path)
|
19
27
|
return unless @file_path
|
@@ -81,20 +89,10 @@ module NewRelic
|
|
81
89
|
# ERB template commented at the YML level is fine. Leave the line,
|
82
90
|
# though, so ERB line numbers remain correct.
|
83
91
|
file.gsub!(/^\s*#.*$/, '#')
|
84
|
-
|
85
|
-
# Next two are for populating the newrelic.yml via erb binding, necessary
|
86
|
-
# when using the default newrelic.yml file
|
87
|
-
generated_for_user = ''
|
88
|
-
license_key = ''
|
89
|
-
|
90
92
|
ERB.new(file).result(binding)
|
91
93
|
rescue ScriptError, StandardError => e
|
92
94
|
log_failure("Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.", e)
|
93
95
|
nil
|
94
|
-
ensure
|
95
|
-
# Avoid warnings by using these again
|
96
|
-
generated_for_user = nil
|
97
|
-
license_key = nil
|
98
96
|
end
|
99
97
|
end
|
100
98
|
|
@@ -12,8 +12,6 @@ module NewRelic
|
|
12
12
|
:host, :port, :user_agent, :request_method
|
13
13
|
|
14
14
|
HTTP_ACCEPT_HEADER_KEY = "HTTP_ACCEPT".freeze
|
15
|
-
REQUEST_URI_KEY = "request_uri".freeze
|
16
|
-
WILDCARD = "*".freeze
|
17
15
|
|
18
16
|
def initialize request
|
19
17
|
@request_path = path_from_request request
|
@@ -36,12 +34,11 @@ module NewRelic
|
|
36
34
|
txn.add_agent_attribute :'request.headers.referer', referer, AttributeFilter::DST_ERROR_COLLECTOR
|
37
35
|
end
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
txn.add_agent_attribute :request_uri, request_path, AttributeFilter::DST_TRANSACTION_EVENTS
|
37
|
+
if request_path
|
38
|
+
txn.add_agent_attribute :'request.uri',
|
39
|
+
request_path,
|
40
|
+
AttributeFilter::DST_TRANSACTION_TRACER |
|
41
|
+
AttributeFilter::DST_ERROR_COLLECTOR
|
45
42
|
end
|
46
43
|
|
47
44
|
if accept
|
@@ -119,11 +116,6 @@ module NewRelic
|
|
119
116
|
env[key]
|
120
117
|
end
|
121
118
|
end
|
122
|
-
|
123
|
-
def configured_to_collect?
|
124
|
-
txn_event_attributes = NewRelic::Agent.config[:'transaction_events.attributes.include']
|
125
|
-
txn_event_attributes.any?{|attribute| attribute == REQUEST_URI_KEY || attribute == WILDCARD}
|
126
|
-
end
|
127
119
|
end
|
128
120
|
end
|
129
121
|
end
|
@@ -11,9 +11,8 @@ module NewRelic
|
|
11
11
|
class FinishedTraceError < StandardError; end
|
12
12
|
|
13
13
|
attr_reader :start_time, :root_node
|
14
|
-
attr_accessor :transaction_name, :
|
15
|
-
:
|
16
|
-
:profile
|
14
|
+
attr_accessor :transaction_name, :guid, :xray_session_id, :attributes,
|
15
|
+
:node_count, :finished, :threshold, :profile
|
17
16
|
|
18
17
|
ROOT = "ROOT".freeze
|
19
18
|
|
@@ -118,35 +117,44 @@ module NewRelic
|
|
118
117
|
@root_node.each_node_with_nest_tracking(&block)
|
119
118
|
end
|
120
119
|
|
121
|
-
|
120
|
+
AGENT_ATTRIBUTES_KEY = 'agentAttributes'.freeze
|
121
|
+
USER_ATTRIBUTES_KEY = 'userAttributes'.freeze
|
122
|
+
INTRINSIC_ATTRIBUTES_KEY = 'intrinsics'.freeze
|
122
123
|
|
123
|
-
def
|
124
|
+
def attributes_for_tracer_destination
|
124
125
|
destination = NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER
|
125
126
|
|
126
127
|
agent_attributes = self.attributes.agent_attributes_for(destination)
|
127
128
|
custom_attributes = self.attributes.custom_attributes_for(destination)
|
128
129
|
intrinsic_attributes = self.attributes.intrinsic_attributes_for(destination)
|
129
130
|
|
131
|
+
{
|
132
|
+
AGENT_ATTRIBUTES_KEY => agent_attributes,
|
133
|
+
USER_ATTRIBUTES_KEY => custom_attributes,
|
134
|
+
INTRINSIC_ATTRIBUTES_KEY => intrinsic_attributes
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
EMPTY_HASH = {}.freeze
|
139
|
+
|
140
|
+
def trace_tree attributes_hash
|
130
141
|
[
|
131
142
|
NewRelic::Coerce.float(self.start_time),
|
132
143
|
EMPTY_HASH,
|
133
144
|
EMPTY_HASH,
|
134
145
|
self.root_node.to_array,
|
135
|
-
|
136
|
-
'agentAttributes' => agent_attributes,
|
137
|
-
'userAttributes' => custom_attributes,
|
138
|
-
'intrinsics' => intrinsic_attributes
|
139
|
-
}
|
146
|
+
attributes_hash
|
140
147
|
]
|
141
148
|
end
|
142
149
|
|
143
150
|
def to_collector_array(encoder)
|
151
|
+
attributes_hash = attributes_for_tracer_destination
|
144
152
|
[
|
145
153
|
NewRelic::Helper.time_to_millis(self.start_time),
|
146
154
|
NewRelic::Helper.time_to_millis(self.root_node.duration),
|
147
155
|
NewRelic::Coerce.string(self.transaction_name),
|
148
|
-
NewRelic::Coerce.string(
|
149
|
-
encoder.encode(trace_tree),
|
156
|
+
NewRelic::Coerce.string(attributes_hash[AGENT_ATTRIBUTES_KEY][:'request.uri']),
|
157
|
+
encoder.encode(trace_tree(attributes_hash)),
|
150
158
|
NewRelic::Coerce.string(self.guid),
|
151
159
|
nil,
|
152
160
|
forced?,
|
@@ -45,7 +45,6 @@ module NewRelic
|
|
45
45
|
|
46
46
|
def copy_attributes transaction, trace
|
47
47
|
trace.transaction_name = transaction.best_name
|
48
|
-
trace.uri = transaction.request_path
|
49
48
|
trace.guid = transaction.guid
|
50
49
|
trace.attributes = transaction.attributes
|
51
50
|
trace.threshold = transaction.threshold
|
@@ -87,8 +87,9 @@ class NewRelic::NoticedError
|
|
87
87
|
def processed_attributes
|
88
88
|
@processed_attributes ||= begin
|
89
89
|
attributes = base_parameters
|
90
|
-
|
91
|
-
append_attributes(attributes,
|
90
|
+
merged_attributes = NewRelic::Agent::Transaction::Attributes.new(NewRelic::Agent.instance.attribute_filter)
|
91
|
+
append_attributes(attributes, USER_ATTRIBUTES, merged_custom_attributes(merged_attributes))
|
92
|
+
append_attributes(attributes, AGENT_ATTRIBUTES, build_agent_attributes(merged_attributes))
|
92
93
|
append_attributes(attributes, INTRINSIC_ATTRIBUTES, build_intrinsic_attributes)
|
93
94
|
attributes
|
94
95
|
end
|
@@ -96,7 +97,6 @@ class NewRelic::NoticedError
|
|
96
97
|
|
97
98
|
def base_parameters
|
98
99
|
params = {}
|
99
|
-
params[:request_uri] = request_uri if request_uri
|
100
100
|
params[:file_name] = file_name if file_name
|
101
101
|
params[:line_number] = line_number if line_number
|
102
102
|
params[:stack_trace] = stack_trace if stack_trace
|
@@ -108,9 +108,7 @@ class NewRelic::NoticedError
|
|
108
108
|
# hold in @attributes, or passed options to notice_error which show up in
|
109
109
|
# @attributes_from_notice_error. Both need filtering, so merge them together
|
110
110
|
# in our Attributes class for consistent handling
|
111
|
-
def merged_custom_attributes
|
112
|
-
merged_attributes = NewRelic::Agent::Transaction::Attributes.new(NewRelic::Agent.instance.attribute_filter)
|
113
|
-
|
111
|
+
def merged_custom_attributes(merged_attributes)
|
114
112
|
merge_custom_attributes_from_transaction(merged_attributes)
|
115
113
|
merge_custom_attributes_from_notice_error(merged_attributes)
|
116
114
|
|
@@ -131,12 +129,22 @@ class NewRelic::NoticedError
|
|
131
129
|
end
|
132
130
|
end
|
133
131
|
|
134
|
-
def build_agent_attributes
|
135
|
-
if @attributes
|
132
|
+
def build_agent_attributes(merged_attributes)
|
133
|
+
agent_attributes = if @attributes
|
136
134
|
@attributes.agent_attributes_for(DESTINATION)
|
137
135
|
else
|
138
136
|
EMPTY_HASH
|
139
137
|
end
|
138
|
+
|
139
|
+
# It's possible to override the request_uri from the transaction attributes
|
140
|
+
# with a uri passed to notice_error. Add it to merged_attributes filter and
|
141
|
+
# merge with the transaction attributes, possibly overriding the request_uri
|
142
|
+
if request_uri
|
143
|
+
merged_attributes.add_agent_attribute(:'request.uri', request_uri, DESTINATION)
|
144
|
+
agent_attributes.merge(merged_attributes.agent_attributes_for(DESTINATION))
|
145
|
+
end
|
146
|
+
|
147
|
+
agent_attributes
|
140
148
|
end
|
141
149
|
|
142
150
|
def build_intrinsic_attributes
|
data/lib/new_relic/version.rb
CHANGED
data/lib/newrelic_rpm.rb
CHANGED
@@ -37,7 +37,7 @@ elsif defined?(Rails::VERSION)
|
|
37
37
|
module NewRelic
|
38
38
|
class Railtie < Rails::Railtie
|
39
39
|
|
40
|
-
initializer "newrelic_rpm.start_plugin" do |app|
|
40
|
+
initializer "newrelic_rpm.start_plugin", before: :load_config_initializers do |app|
|
41
41
|
NewRelic::Control.instance.init_plugin(:config => app.config)
|
42
42
|
end
|
43
43
|
end
|
data/test/agent_helper.rb
CHANGED
@@ -484,16 +484,16 @@ unless Time.respond_to?(:__original_now)
|
|
484
484
|
end
|
485
485
|
end
|
486
486
|
|
487
|
-
def
|
487
|
+
def nr_freeze_time(now=Time.now)
|
488
488
|
Time.__frozen_now = now
|
489
489
|
end
|
490
490
|
|
491
|
-
def
|
491
|
+
def nr_unfreeze_time
|
492
492
|
Time.__frozen_now = nil
|
493
493
|
end
|
494
494
|
|
495
495
|
def advance_time(seconds)
|
496
|
-
|
496
|
+
Time.__frozen_now = Time.now + seconds
|
497
497
|
end
|
498
498
|
|
499
499
|
def with_constant_defined(constant_symbol, implementation=Module.new)
|
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: 4.
|
4
|
+
version: 4.8.0.341
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Wear
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|