newrelic_rpm 3.15.2.317 → 3.16.0.318
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +23 -0
- data/lib/new_relic/agent.rb +0 -3
- data/lib/new_relic/agent/agent.rb +29 -34
- data/lib/new_relic/agent/attribute_filter.rb +2 -0
- data/lib/new_relic/agent/configuration/default_source.rb +50 -4
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +3 -2
- data/lib/new_relic/agent/hash_extensions.rb +16 -1
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +82 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +9 -8
- data/lib/new_relic/agent/instrumentation/rails5/action_cable.rb +29 -0
- data/lib/new_relic/agent/new_relic_service.rb +12 -4
- data/lib/new_relic/agent/new_relic_service/encoders.rb +19 -3
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +5 -1
- data/lib/new_relic/agent/supported_versions.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +2 -1
- data/lib/new_relic/agent/transaction/request_attributes.rb +15 -0
- data/lib/new_relic/agent/utilization_data.rb +45 -1
- data/lib/new_relic/recipes/capistrano3.rb +44 -34
- data/lib/new_relic/version.rb +2 -2
- data/lib/tasks/versions.preface.html +7 -1
- data/lib/tasks/versions.rake +1 -1
- data/newrelic_rpm.gemspec +1 -0
- data/test/fixtures/cross_agent_tests/README.md +10 -32
- data/test/fixtures/cross_agent_tests/aws.json +2 -2
- data/test/fixtures/cross_agent_tests/rum_client_config.json +33 -4
- data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +1 -0
- data/test/fixtures/cross_agent_tests/utilization/README.md +13 -0
- data/test/fixtures/cross_agent_tests/utilization/utilization_json.json +132 -0
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +82 -0
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +2 -9
- data/test/multiverse/suites/rails/Envfile +1 -1
- data/test/multiverse/suites/rails/action_cable_test.rb +81 -0
- data/test/new_relic/agent/agent_test.rb +0 -1
- data/test/new_relic/agent/hash_extensions_test.rb +26 -1
- data/test/new_relic/agent/instrumentation/action_cable_subscriber_test.rb +124 -0
- data/test/new_relic/agent/method_tracer_test.rb +0 -1
- data/test/new_relic/agent/new_relic_service/json_marshaller_test.rb +27 -0
- data/test/new_relic/agent/utilization_data_test.rb +86 -0
- metadata +10 -4
- data/lib/new_relic/agent/transction_event_recorder.rb +0 -35
@@ -0,0 +1,27 @@
|
|
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 File.expand_path(File.join(File.dirname(__FILE__),'../../..','test_helper'))
|
6
|
+
require 'new_relic/agent/new_relic_service/json_marshaller'
|
7
|
+
require 'new_relic/agent/new_relic_service/encoders'
|
8
|
+
|
9
|
+
module NewRelic
|
10
|
+
module Agent
|
11
|
+
class NewRelicService
|
12
|
+
class JsonMarshallerTest < Minitest::Test
|
13
|
+
def test_default_encoder_is_base64_compressed_json
|
14
|
+
marshaller = JsonMarshaller.new
|
15
|
+
assert_equal Encoders::Base64CompressedJSON, marshaller.default_encoder
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_default_encoder_is_identity_with_simple_compression_enabled
|
19
|
+
marshaller = JsonMarshaller.new
|
20
|
+
with_config :simple_compression => true do
|
21
|
+
assert_equal Encoders::Identity, marshaller.default_encoder
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -147,6 +147,92 @@ module NewRelic::Agent
|
|
147
147
|
assert_equal UtilizationData::METADATA_VERSION, utilization_data.to_collector_hash[:metadata_version]
|
148
148
|
end
|
149
149
|
|
150
|
+
def test_configured_hostname_added_to_config_hash
|
151
|
+
with_config(:'utilization.billing_hostname' => 'BillNye') do
|
152
|
+
utilization_data = UtilizationData.new
|
153
|
+
assert_equal 'BillNye', utilization_data.to_collector_hash[:config][:hostname]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_configured_logical_processors_added_to_config_hash
|
158
|
+
with_config(:'utilization.logical_processors' => 42) do
|
159
|
+
utilization_data = UtilizationData.new
|
160
|
+
assert_equal 42, utilization_data.to_collector_hash[:config][:logical_processors]
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_configured_total_ram_mib_added_to_config_hash
|
165
|
+
with_config(:'utilization.total_ram_mib' => 42) do
|
166
|
+
utilization_data = UtilizationData.new
|
167
|
+
assert_equal 42, utilization_data.to_collector_hash[:config][:total_ram_mib]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
load_cross_agent_test("utilization/utilization_json").each do |test_case|
|
172
|
+
|
173
|
+
test_case = HashExtensions.symbolize_keys_in_object test_case
|
174
|
+
define_method("test_#{test_case[:testname]}".tr(" ", "_")) do
|
175
|
+
setup_cross_agent_test_stubs test_case
|
176
|
+
# This is a little bit ugly, but TravisCI runs these tests in a docker environment,
|
177
|
+
# which means we get an unexpected docker id in the vendors hash. Since none of the
|
178
|
+
# cross agent tests expect docker ids in the vendors hash we can safely turn off
|
179
|
+
# docker detection.
|
180
|
+
options = convert_env_to_config_options(test_case).merge(:'utilization.detect_docker' => false)
|
181
|
+
with_config options do
|
182
|
+
assert_equal test_case[:expected_output_json], UtilizationData.new.to_collector_hash
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def setup_cross_agent_test_stubs test_case
|
188
|
+
stub_utilization_inputs test_case
|
189
|
+
stub_aws_inputs test_case
|
190
|
+
end
|
191
|
+
|
192
|
+
UTILIZATION_INPUTS = {
|
193
|
+
:input_total_ram_mib => :ram_in_mib,
|
194
|
+
:input_logical_processors => :cpu_count,
|
195
|
+
:input_hostname => :hostname
|
196
|
+
}
|
197
|
+
|
198
|
+
def stub_utilization_inputs test_case
|
199
|
+
test_case.keys.each do |key|
|
200
|
+
if meth = UTILIZATION_INPUTS[key]
|
201
|
+
UtilizationData.any_instance.stubs(meth).returns(test_case[key])
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
AWS_INPUTS = {
|
207
|
+
:input_aws_id => :instance_id,
|
208
|
+
:input_aws_type => :instance_type,
|
209
|
+
:input_aws_zone => :availability_zone
|
210
|
+
}
|
211
|
+
|
212
|
+
def stub_aws_inputs test_case
|
213
|
+
test_case.keys.each do |key|
|
214
|
+
if meth = AWS_INPUTS[key]
|
215
|
+
AWSInfo.any_instance.stubs(meth).returns(test_case[key])
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
ENV_TO_OPTIONS = {
|
221
|
+
:NEW_RELIC_UTILIZATION_LOGICAL_PROCESSORS => :'utilization.logical_processors',
|
222
|
+
:NEW_RELIC_UTILIZATION_TOTAL_RAM_MIB => :'utilization.total_ram_mib',
|
223
|
+
:NEW_RELIC_UTILIZATION_BILLING_HOSTNAME => :'utilization.billing_hostname'
|
224
|
+
}
|
225
|
+
|
226
|
+
NUMERIC_ENV_OPTS = [:NEW_RELIC_UTILIZATION_LOGICAL_PROCESSORS, :NEW_RELIC_UTILIZATION_TOTAL_RAM_MIB]
|
227
|
+
|
228
|
+
def convert_env_to_config_options test_case
|
229
|
+
env_inputs = test_case.fetch :input_environment_variables, {}
|
230
|
+
env_inputs.keys.inject({}) do |memo, k|
|
231
|
+
memo[ENV_TO_OPTIONS[k]] = NUMERIC_ENV_OPTS.include?(k) ? env_inputs[k].to_i : env_inputs[k]
|
232
|
+
memo
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
150
236
|
def stub_aws_info(responses = {})
|
151
237
|
AWSInfo.any_instance.stubs(:remote_fetch).with("instance-id").returns(responses[:instance_id])
|
152
238
|
AWSInfo.any_instance.stubs(:remote_fetch).with("instance-type").returns(responses[:instance_type])
|
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: 3.
|
4
|
+
version: 3.16.0.318
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Krajcar
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-
|
15
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -286,6 +286,7 @@ files:
|
|
286
286
|
- lib/new_relic/agent/http_clients/uri_util.rb
|
287
287
|
- lib/new_relic/agent/inbound_request_monitor.rb
|
288
288
|
- lib/new_relic/agent/instrumentation.rb
|
289
|
+
- lib/new_relic/agent/instrumentation/action_cable_subscriber.rb
|
289
290
|
- lib/new_relic/agent/instrumentation/action_controller_subscriber.rb
|
290
291
|
- lib/new_relic/agent/instrumentation/action_view_subscriber.rb
|
291
292
|
- lib/new_relic/agent/instrumentation/active_job.rb
|
@@ -328,6 +329,7 @@ files:
|
|
328
329
|
- lib/new_relic/agent/instrumentation/rails4/action_controller.rb
|
329
330
|
- lib/new_relic/agent/instrumentation/rails4/action_view.rb
|
330
331
|
- lib/new_relic/agent/instrumentation/rails4/errors.rb
|
332
|
+
- lib/new_relic/agent/instrumentation/rails5/action_cable.rb
|
331
333
|
- lib/new_relic/agent/instrumentation/rails5/action_controller.rb
|
332
334
|
- lib/new_relic/agent/instrumentation/rails5/action_view.rb
|
333
335
|
- lib/new_relic/agent/instrumentation/rails_middleware.rb
|
@@ -408,7 +410,6 @@ files:
|
|
408
410
|
- lib/new_relic/agent/transaction_sampler.rb
|
409
411
|
- lib/new_relic/agent/transaction_state.rb
|
410
412
|
- lib/new_relic/agent/transaction_timings.rb
|
411
|
-
- lib/new_relic/agent/transction_event_recorder.rb
|
412
413
|
- lib/new_relic/agent/utilization_data.rb
|
413
414
|
- lib/new_relic/agent/vm.rb
|
414
415
|
- lib/new_relic/agent/vm/jruby_vm.rb
|
@@ -744,6 +745,8 @@ files:
|
|
744
745
|
- test/fixtures/cross_agent_tests/transaction_segment_terms.json
|
745
746
|
- test/fixtures/cross_agent_tests/url_clean.json
|
746
747
|
- test/fixtures/cross_agent_tests/url_domain_extraction.json
|
748
|
+
- test/fixtures/cross_agent_tests/utilization/README.md
|
749
|
+
- test/fixtures/cross_agent_tests/utilization/utilization_json.json
|
747
750
|
- test/helpers/exceptions.rb
|
748
751
|
- test/helpers/file_searching.rb
|
749
752
|
- test/helpers/mongo_metric_builder.rb
|
@@ -905,6 +908,7 @@ files:
|
|
905
908
|
- test/multiverse/suites/rack/response_content_type_test.rb
|
906
909
|
- test/multiverse/suites/rack/url_map_test.rb
|
907
910
|
- test/multiverse/suites/rails/Envfile
|
911
|
+
- test/multiverse/suites/rails/action_cable_test.rb
|
908
912
|
- test/multiverse/suites/rails/action_controller_live_rum_test.rb
|
909
913
|
- test/multiverse/suites/rails/activejob_test.rb
|
910
914
|
- test/multiverse/suites/rails/app.rb
|
@@ -1054,6 +1058,7 @@ files:
|
|
1054
1058
|
- test/new_relic/agent/hostname_test.rb
|
1055
1059
|
- test/new_relic/agent/http_clients/uri_util_test.rb
|
1056
1060
|
- test/new_relic/agent/inbound_request_monitor_test.rb
|
1061
|
+
- test/new_relic/agent/instrumentation/action_cable_subscriber_test.rb
|
1057
1062
|
- test/new_relic/agent/instrumentation/action_controller_subscriber_test.rb
|
1058
1063
|
- test/new_relic/agent/instrumentation/action_view_subscriber_test.rb
|
1059
1064
|
- test/new_relic/agent/instrumentation/active_job_test.rb
|
@@ -1081,6 +1086,7 @@ files:
|
|
1081
1086
|
- test/new_relic/agent/method_tracer_test.rb
|
1082
1087
|
- test/new_relic/agent/method_visibility_test.rb
|
1083
1088
|
- test/new_relic/agent/mock_scope_listener.rb
|
1089
|
+
- test/new_relic/agent/new_relic_service/json_marshaller_test.rb
|
1084
1090
|
- test/new_relic/agent/new_relic_service_test.rb
|
1085
1091
|
- test/new_relic/agent/obfuscator_test.rb
|
1086
1092
|
- test/new_relic/agent/parameter_filtering_test.rb
|
@@ -1333,7 +1339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1333
1339
|
version: 1.3.1
|
1334
1340
|
requirements: []
|
1335
1341
|
rubyforge_project:
|
1336
|
-
rubygems_version: 2.4.5
|
1342
|
+
rubygems_version: 2.4.5.1
|
1337
1343
|
signing_key:
|
1338
1344
|
specification_version: 4
|
1339
1345
|
summary: New Relic Ruby Agent
|
@@ -1,35 +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
|
-
require 'new_relic/agent/transaction_event_aggregator'
|
5
|
-
require 'new_relic/agent/synthetics_event_aggregator'
|
6
|
-
|
7
|
-
module NewRelic
|
8
|
-
module Agent
|
9
|
-
# This is responsibile for recording transaction events and managing
|
10
|
-
# the relationship between events generated from synthetics requests
|
11
|
-
# vs normal requests.
|
12
|
-
class TransactionEventRecorder
|
13
|
-
attr_reader :transaction_event_aggregator
|
14
|
-
attr_reader :synthetics_event_aggregator
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
@transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
|
18
|
-
@synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
|
19
|
-
end
|
20
|
-
|
21
|
-
def record payload
|
22
|
-
return unless NewRelic::Agent.config[:'analytics_events.enabled']
|
23
|
-
|
24
|
-
event = TransactionEvent.new payload
|
25
|
-
|
26
|
-
if event.synthetics?
|
27
|
-
_, rejected = synthetics_event_aggregator.append_or_reject event.to_collector_array
|
28
|
-
transaction_event_aggregator.record event if rejected
|
29
|
-
else
|
30
|
-
transaction_event_aggregator.record event.to_collector_array
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|