newrelic_rpm 3.14.1.311 → 3.14.2.312
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +174 -11
- data/CHANGELOG +22 -0
- data/Rakefile +5 -0
- data/lib/new_relic/agent/agent.rb +22 -7
- data/lib/new_relic/agent/aws_info.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +19 -44
- data/lib/new_relic/agent/error_event_aggregator.rb +11 -103
- data/lib/new_relic/agent/event_aggregator.rb +130 -0
- data/lib/new_relic/agent/event_buffer.rb +7 -0
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +18 -2
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +12 -4
- data/lib/new_relic/agent/new_relic_service.rb +6 -4
- data/lib/new_relic/agent/sampled_buffer.rb +9 -6
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +1 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +2 -1
- data/lib/new_relic/agent/supported_versions.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +52 -0
- data/lib/new_relic/agent/synthetics_event_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction.rb +14 -7
- data/lib/new_relic/agent/transaction/request_attributes.rb +7 -2
- data/lib/new_relic/agent/transaction_error_primitive.rb +72 -0
- data/lib/new_relic/agent/transaction_event_aggregator.rb +33 -210
- data/lib/new_relic/agent/transaction_event_primitive.rb +106 -0
- data/lib/new_relic/agent/transaction_event_recorder.rb +48 -0
- data/lib/new_relic/agent/transaction_metrics.rb +9 -1
- data/lib/new_relic/agent/transction_event_recorder.rb +35 -0
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/versions.html.erb +13 -11
- data/lib/tasks/versions.postface.html +8 -0
- data/lib/tasks/versions.preface.html +3 -0
- data/lib/tasks/versions.rake +15 -5
- data/test/agent_helper.rb +1 -1
- data/test/environments/rails31/Gemfile +2 -0
- data/test/environments/rails32/Gemfile +2 -0
- data/test/environments/rails32/Rakefile +2 -1
- data/test/environments/rails32/config/database.yml +1 -6
- data/test/multiverse/suites/active_record/Envfile +1 -0
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +18 -0
- data/test/multiverse/suites/agent_only/custom_analytics_events_test.rb +21 -6
- data/test/multiverse/suites/agent_only/error_events_test.rb +14 -6
- data/test/multiverse/suites/agent_only/transaction_events_test.rb +31 -0
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +2 -0
- data/test/multiverse/suites/capistrano/Envfile +9 -3
- data/test/multiverse/suites/capistrano2/Envfile +4 -0
- data/test/multiverse/suites/config_file_loading/Envfile +1 -1
- data/test/multiverse/suites/curb/Envfile +1 -1
- data/test/multiverse/suites/datamapper/Envfile +3 -0
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +7 -3
- data/test/multiverse/suites/grape/grape_test.rb +2 -0
- data/test/multiverse/suites/padrino/Envfile +4 -3
- data/test/multiverse/suites/padrino/config/newrelic.yml +2 -0
- data/test/multiverse/suites/rack/config/newrelic.yml +18 -0
- data/test/multiverse/suites/rack/nested_non_rack_app_test.rb +1 -1
- data/test/multiverse/suites/rack/puma_rack_builder_test.rb +17 -14
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +16 -13
- data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +1 -1
- data/test/multiverse/suites/rails/Envfile +5 -0
- data/test/multiverse/suites/rails/parameter_capture_test.rb +9 -0
- data/test/multiverse/suites/rake/Envfile +2 -1
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sidekiq/Envfile +18 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +11 -10
- data/test/multiverse/suites/sidekiq/test_model.rb +12 -0
- data/test/multiverse/suites/sinatra/ignoring_test.rb +43 -25
- data/test/multiverse/suites/sinatra/nested_middleware_test.rb +10 -2
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +8 -2
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +2 -0
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +79 -10
- data/test/new_relic/agent/agent_test.rb +3 -3
- data/test/new_relic/agent/aws_info_test.rb +1 -2
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +2 -0
- data/test/new_relic/agent/custom_event_aggregator_test.rb +43 -4
- data/test/new_relic/agent/error_collector_test.rb +1 -1
- data/test/new_relic/agent/error_event_aggregator_test.rb +13 -81
- data/test/new_relic/agent/event_aggregator_test.rb +178 -0
- data/test/new_relic/agent/event_buffer_test_cases.rb +16 -0
- data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +7 -0
- data/test/new_relic/agent/new_relic_service_test.rb +7 -1
- data/test/new_relic/agent/pipe_channel_manager_test.rb +45 -3
- data/test/new_relic/agent/rpm_agent_test.rb +1 -0
- data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
- data/test/new_relic/agent/synthetics_event_aggregator_test.rb +179 -0
- data/test/new_relic/agent/transaction/request_attributes_test.rb +8 -0
- data/test/new_relic/agent/transaction_error_primitive_test.rb +117 -0
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +148 -374
- data/test/new_relic/agent/transaction_event_primitive_test.rb +195 -0
- data/test/new_relic/agent/transaction_event_recorder_test.rb +80 -0
- data/test/new_relic/agent/transaction_metrics_test.rb +7 -7
- data/test/new_relic/agent/transaction_test.rb +4 -4
- data/test/new_relic/agent/utilization_data_test.rb +7 -7
- data/test/new_relic/fake_collector.rb +10 -17
- data/test/new_relic/license_test.rb +2 -0
- data/test/new_relic/marshalling_test_cases.rb +1 -1
- data/test/nullverse/default_source_require_test.rb +21 -0
- data/test/nullverse/nullverse_helper.rb +10 -0
- data/test/performance/suites/active_record.rb +1 -1
- data/test/performance/suites/sql_obfuscation.rb +7 -6
- data/test/script/ci.sh +10 -165
- data/test/script/install_mongodb.sh +6 -0
- metadata +21 -6
- data/test/script/build_test_gem.sh +0 -57
- data/test/script/ci_agent-tests_runner.sh +0 -82
- data/test/script/ci_bench.sh +0 -52
- data/test/script/ci_multiverse_runner.sh +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d249ecd98766db01a826c39d022d93d87664cb0e
|
4
|
+
data.tar.gz: ede61fd51cb9dcf848302e06361f726482541da7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f41a0a49218ddb2bd666b76cc7d303870ae2aaddcfb4f62ffdf126b32f577ccaa5d22e7348a216c41a2033a582ed41bab9c1a15308b40db1e119dc3abc064126
|
7
|
+
data.tar.gz: 41c64d4afcaedfc5d7f1d9501c1bca9522eefd1e02d27b2c94693def7876a9b616e34a5adb636330d7918cb0c6073804ab90a5fc58dea178d6ef09f3f9c9a1e6
|
data/.travis.yml
CHANGED
@@ -1,17 +1,180 @@
|
|
1
|
+
services:
|
2
|
+
- mysql
|
3
|
+
- redis-server
|
4
|
+
- memcached
|
5
|
+
|
1
6
|
language: ruby
|
7
|
+
|
8
|
+
sudo: false
|
9
|
+
|
10
|
+
script: ./test/script/ci.sh
|
11
|
+
|
12
|
+
before_install:
|
13
|
+
- 'mkdir -p /home/travis/gemfiles && touch /home/travis/gemfiles/IGNORE.txt && cp -R /home/travis/gemfiles/* .'
|
14
|
+
- 'if [[ `ruby --version` =~ ^ruby\ 1\. ]]; then gem update --system 1.8.25; fi'
|
15
|
+
- gem --version
|
16
|
+
- gem install bundler
|
17
|
+
- bundle --version
|
18
|
+
|
19
|
+
install: bundle install --local --path=/home/travis/bundle || bundle --path=/home/travis/bundle
|
20
|
+
|
21
|
+
# Travis default Mongo is currently 2.4.14, which has some instrumentation differences with >= 2.6.
|
22
|
+
before_script:
|
23
|
+
- 'if [[ $GROUP == "database" ]]; then ./test/script/install_mongodb.sh; fi'
|
24
|
+
|
25
|
+
before_cache:
|
26
|
+
- rsync -a --prune-empty-dirs --include '*/' --include 'Gemfile.*' --exclude '*' . /home/travis/gemfiles
|
27
|
+
|
28
|
+
cache:
|
29
|
+
directories:
|
30
|
+
- /home/travis/bundle
|
31
|
+
- /home/travis/gemfiles
|
32
|
+
|
33
|
+
branches:
|
34
|
+
only:
|
35
|
+
- master
|
36
|
+
- dev
|
37
|
+
- release
|
38
|
+
|
2
39
|
rvm:
|
3
|
-
|
4
|
-
- ree
|
5
|
-
- 1.9.2
|
6
|
-
- 1.9.3
|
7
|
-
- 2.0
|
8
|
-
- 2.1
|
9
|
-
- 2.2
|
10
|
-
- jruby-19mode
|
11
|
-
- jruby-18mode
|
40
|
+
# Run slowest builds first to try and optimize overall cycle time.
|
12
41
|
- rbx-2.5.8
|
42
|
+
- jruby-1.7.23
|
43
|
+
- jruby-9.0.4.0
|
44
|
+
- 2.2.4
|
45
|
+
- 2.1.8
|
46
|
+
- 2.0.0-p648
|
47
|
+
- 1.9.3
|
48
|
+
- 1.9.2
|
49
|
+
- ree
|
50
|
+
- 1.8.7
|
51
|
+
|
52
|
+
env:
|
53
|
+
global:
|
54
|
+
- CI_BUNDLE_PATH=/home/travis/bundle
|
55
|
+
- BUNDLE_PATH=/home/travis/bundle
|
56
|
+
- MONGODB=2.6.11
|
57
|
+
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
|
58
|
+
- JRUBY_OPTS="-Xcompile.invokedynamic=false -J-Djruby.compile.mode=OFF"
|
59
|
+
- RBXOPT="-Xcompiler.no_rbc -Xint"
|
60
|
+
- SERIALIZE=1
|
61
|
+
- TESTOPTS="-v"
|
62
|
+
- VERBOSE = 1
|
63
|
+
matrix:
|
64
|
+
- TYPE=UNIT ENVIRONMENT=rails21
|
65
|
+
- TYPE=UNIT ENVIRONMENT=rails22
|
66
|
+
- TYPE=UNIT ENVIRONMENT=rails23
|
67
|
+
- TYPE=UNIT ENVIRONMENT=rails30
|
68
|
+
- TYPE=UNIT ENVIRONMENT=rails31
|
69
|
+
- TYPE=UNIT ENVIRONMENT=rails32
|
70
|
+
- TYPE=UNIT ENVIRONMENT=rails40
|
71
|
+
- TYPE=UNIT ENVIRONMENT=rails41
|
72
|
+
- TYPE=UNIT ENVIRONMENT=rails42
|
73
|
+
- TYPE=UNIT ENVIRONMENT=norails
|
74
|
+
- TYPE=FUNCTIONAL GROUP=agent
|
75
|
+
- TYPE=FUNCTIONAL GROUP=api
|
76
|
+
- TYPE=FUNCTIONAL GROUP=background
|
77
|
+
- TYPE=FUNCTIONAL GROUP=database
|
78
|
+
- TYPE=FUNCTIONAL GROUP=httpclients
|
79
|
+
- TYPE=FUNCTIONAL GROUP=rails
|
80
|
+
- TYPE=FUNCTIONAL GROUP=serialization
|
81
|
+
- TYPE=FUNCTIONAL GROUP=sinatra
|
82
|
+
- TYPE=FUNCTIONAL GROUP=rest
|
83
|
+
- TYPE=NULLVERSE
|
13
84
|
|
14
85
|
matrix:
|
15
86
|
allow_failures:
|
16
|
-
- rvm: rbx-2
|
17
|
-
|
87
|
+
- rvm: rbx-2.5.8
|
88
|
+
exclude:
|
89
|
+
- rvm: rbx-2.5.8 # Currently hangs
|
90
|
+
env: TYPE=FUNCTIONAL GROUP=agent
|
91
|
+
|
92
|
+
# Unsupported Rails/Ruby combinations
|
93
|
+
# 2.2
|
94
|
+
- rvm: 2.2.4
|
95
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
96
|
+
- rvm: 2.2.4
|
97
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
98
|
+
- rvm: 2.2.4
|
99
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
100
|
+
|
101
|
+
# 2.1
|
102
|
+
- rvm: 2.1.8
|
103
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
104
|
+
- rvm: 2.1.8
|
105
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
106
|
+
- rvm: 2.1.8
|
107
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
108
|
+
|
109
|
+
# 2.0
|
110
|
+
- rvm: 2.0.0-p648
|
111
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
112
|
+
- rvm: 2.0.0-p648
|
113
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
114
|
+
- rvm: 2.0.0-p648
|
115
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
116
|
+
|
117
|
+
# 1.9.3
|
118
|
+
- rvm: 1.9.3
|
119
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
120
|
+
- rvm: 1.9.3
|
121
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
122
|
+
|
123
|
+
# 1.9.2
|
124
|
+
- rvm: 1.9.2
|
125
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
126
|
+
- rvm: 1.9.2
|
127
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
128
|
+
|
129
|
+
# REE
|
130
|
+
- rvm: ree
|
131
|
+
env: TYPE=UNIT ENVIRONMENT=rails40
|
132
|
+
- rvm: ree
|
133
|
+
env: TYPE=UNIT ENVIRONMENT=rails41
|
134
|
+
- rvm: ree
|
135
|
+
env: TYPE=UNIT ENVIRONMENT=rails42
|
136
|
+
|
137
|
+
# 1.8.7
|
138
|
+
- rvm: 1.8.7
|
139
|
+
env: TYPE=UNIT ENVIRONMENT=rails40
|
140
|
+
- rvm: 1.8.7
|
141
|
+
env: TYPE=UNIT ENVIRONMENT=rails41
|
142
|
+
- rvm: 1.8.7
|
143
|
+
env: TYPE=UNIT ENVIRONMENT=rails42
|
144
|
+
|
145
|
+
# jruby 1.7
|
146
|
+
- rvm: jruby-1.7.23
|
147
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
148
|
+
- rvm: jruby-1.7.23
|
149
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
150
|
+
- rvm: jruby-1.7.23
|
151
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
152
|
+
|
153
|
+
# jruby 9.0
|
154
|
+
- rvm: jruby-9.0.4.0
|
155
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
156
|
+
- rvm: jruby-9.0.4.0
|
157
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
158
|
+
- rvm: jruby-9.0.4.0
|
159
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
160
|
+
- rvm: jruby-9.0.4.0
|
161
|
+
env: TYPE=UNIT ENVIRONMENT=rails30
|
162
|
+
- rvm: jruby-9.0.4.0
|
163
|
+
env: TYPE=UNIT ENVIRONMENT=rails31
|
164
|
+
- rvm: jruby-9.0.4.0
|
165
|
+
env: TYPE=UNIT ENVIRONMENT=rails32
|
166
|
+
|
167
|
+
# rbx
|
168
|
+
- rvm: rbx-2.5.8
|
169
|
+
env: TYPE=UNIT ENVIRONMENT=rails21
|
170
|
+
- rvm: rbx-2.5.8
|
171
|
+
env: TYPE=UNIT ENVIRONMENT=rails22
|
172
|
+
- rvm: rbx-2.5.8
|
173
|
+
env: TYPE=UNIT ENVIRONMENT=rails23
|
174
|
+
- rvm: rbx-2.5.8
|
175
|
+
env: TYPE=UNIT ENVIRONMENT=rails30
|
176
|
+
- rvm: rbx-2.5.8
|
177
|
+
env: TYPE=UNIT ENVIRONMENT=rails31
|
178
|
+
- rvm: rbx-2.5.8
|
179
|
+
env: TYPE=UNIT ENVIRONMENT=rails32
|
180
|
+
|
data/CHANGELOG
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v3.14.2 ##
|
4
|
+
|
5
|
+
* Improved transaction names for Sinatra
|
6
|
+
|
7
|
+
The agent will now use sinatra.route for transaction names on Sinatra 1.4.3+,
|
8
|
+
which sets it in the request environment. This gives names that closer resemble the
|
9
|
+
routes defined in the Sinatra DSL. Thanks to Brian Phillips for the suggestion!
|
10
|
+
|
11
|
+
* Bugfix for error flag on transaction events
|
12
|
+
|
13
|
+
There was an issue causing the error flag to always be set to false for Insights
|
14
|
+
transaction events that has been fixed.
|
15
|
+
|
16
|
+
* Official support for Sidekiq 4
|
17
|
+
|
18
|
+
The Ruby agent now officially supports Sidekiq 4.
|
19
|
+
|
20
|
+
* Additional attributes collected
|
21
|
+
|
22
|
+
The agent now collects the following information in web transactions:
|
23
|
+
Content-Length HTTP response and Content-Type HTTP request headers.
|
24
|
+
|
3
25
|
## v3.14.1 ##
|
4
26
|
|
5
27
|
* Add support for setting a display name on hosts
|
data/Rakefile
CHANGED
@@ -65,6 +65,11 @@ namespace :test do
|
|
65
65
|
t.verbose = true
|
66
66
|
end
|
67
67
|
|
68
|
+
Rake::TestTask.new(:nullverse) do |t|
|
69
|
+
t.pattern = "#{agent_home}/test/nullverse/*_test.rb"
|
70
|
+
t.verbose = true
|
71
|
+
end
|
72
|
+
|
68
73
|
# Note unit testing task is defined in lib/tasks/tests.rake to facilitate
|
69
74
|
# running them in a rails application environment.
|
70
75
|
|
@@ -21,7 +21,7 @@ require 'new_relic/agent/event_listener'
|
|
21
21
|
require 'new_relic/agent/cross_app_monitor'
|
22
22
|
require 'new_relic/agent/synthetics_monitor'
|
23
23
|
require 'new_relic/agent/synthetics_event_buffer'
|
24
|
-
require 'new_relic/agent/
|
24
|
+
require 'new_relic/agent/transaction_event_recorder'
|
25
25
|
require 'new_relic/agent/custom_event_aggregator'
|
26
26
|
require 'new_relic/agent/sampler_collection'
|
27
27
|
require 'new_relic/agent/javascript_instrumentor'
|
@@ -64,7 +64,8 @@ module NewRelic
|
|
64
64
|
@harvester = NewRelic::Agent::Harvester.new(@events)
|
65
65
|
@after_fork_lock = Mutex.new
|
66
66
|
|
67
|
-
@
|
67
|
+
@transaction_event_recorder = NewRelic::Agent::TransactionEventRecorder.new
|
68
|
+
|
68
69
|
@custom_event_aggregator = NewRelic::Agent::CustomEventAggregator.new
|
69
70
|
|
70
71
|
@connect_state = :pending
|
@@ -138,9 +139,17 @@ module NewRelic
|
|
138
139
|
# GC::Profiler.total_time is not monotonic so we wrap it.
|
139
140
|
attr_reader :monotonic_gc_profiler
|
140
141
|
attr_reader :custom_event_aggregator
|
141
|
-
|
142
|
+
attr_reader :transaction_event_recorder
|
142
143
|
attr_reader :attribute_filter
|
143
144
|
|
145
|
+
def transaction_event_aggregator
|
146
|
+
@transaction_event_recorder.transaction_event_aggregator
|
147
|
+
end
|
148
|
+
|
149
|
+
def synthetics_event_aggregator
|
150
|
+
@transaction_event_recorder.synthetics_event_aggregator
|
151
|
+
end
|
152
|
+
|
144
153
|
# This method should be called in a forked process after a fork.
|
145
154
|
# It assumes the parent process initialized the agent, but does
|
146
155
|
# not assume the agent started.
|
@@ -557,7 +566,7 @@ module NewRelic
|
|
557
566
|
@stats_engine.reset!
|
558
567
|
@error_collector.drop_buffered_data
|
559
568
|
@transaction_sampler.reset!
|
560
|
-
@
|
569
|
+
@transaction_event_recorder.drop_buffered_data
|
561
570
|
@custom_event_aggregator.reset!
|
562
571
|
@sql_sampler.reset!
|
563
572
|
end
|
@@ -926,7 +935,7 @@ module NewRelic
|
|
926
935
|
when :transaction_sample_data then @transaction_sampler
|
927
936
|
when :error_data then @error_collector.error_trace_aggregator
|
928
937
|
when :error_event_data then @error_collector.error_event_aggregator
|
929
|
-
when :analytic_event_data then
|
938
|
+
when :analytic_event_data then transaction_event_aggregator
|
930
939
|
when :custom_event_data then @custom_event_aggregator
|
931
940
|
when :sql_trace_data then @sql_sampler
|
932
941
|
end
|
@@ -934,7 +943,12 @@ module NewRelic
|
|
934
943
|
|
935
944
|
def merge_data_for_endpoint(endpoint, data)
|
936
945
|
if data && !data.empty?
|
937
|
-
container_for_endpoint
|
946
|
+
container = container_for_endpoint endpoint
|
947
|
+
if container.respond_to?(:has_metadata?) && container.has_metadata?
|
948
|
+
container_for_endpoint(endpoint).merge!(data, false)
|
949
|
+
else
|
950
|
+
container_for_endpoint(endpoint).merge!(data)
|
951
|
+
end
|
938
952
|
end
|
939
953
|
rescue => e
|
940
954
|
NewRelic::Agent.logger.error("Error while merging #{endpoint} data from child: ", e)
|
@@ -1100,7 +1114,8 @@ module NewRelic
|
|
1100
1114
|
end
|
1101
1115
|
|
1102
1116
|
def harvest_and_send_analytic_event_data
|
1103
|
-
harvest_and_send_from_container(
|
1117
|
+
harvest_and_send_from_container(transaction_event_aggregator, :analytic_event_data)
|
1118
|
+
harvest_and_send_from_container(synthetics_event_aggregator, :analytic_event_data)
|
1104
1119
|
harvest_and_send_from_container(@custom_event_aggregator, :custom_event_data)
|
1105
1120
|
end
|
1106
1121
|
|
@@ -62,7 +62,7 @@ module NewRelic
|
|
62
62
|
rescue Timeout::Error
|
63
63
|
handle_error "UtilizationData timed out fetching remote keys."
|
64
64
|
rescue StandardError => e
|
65
|
-
handle_error "UtilizationData encountered error fetching remote keys
|
65
|
+
handle_error "UtilizationData encountered error fetching remote keys: #{e.message}"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -2,35 +2,21 @@
|
|
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/event_aggregator'
|
6
6
|
require 'new_relic/agent/attribute_processing'
|
7
7
|
|
8
8
|
module NewRelic
|
9
9
|
module Agent
|
10
|
-
class CustomEventAggregator
|
10
|
+
class CustomEventAggregator < EventAggregator
|
11
11
|
include NewRelic::Coerce
|
12
12
|
|
13
13
|
TYPE = 'type'.freeze
|
14
14
|
TIMESTAMP = 'timestamp'.freeze
|
15
15
|
EVENT_TYPE_REGEX = /^[a-zA-Z0-9:_ ]+$/.freeze
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@lock = Mutex.new
|
21
|
-
@buffer = SampledBuffer.new(NewRelic::Agent.config[DEFAULT_CAPACITY_KEY])
|
22
|
-
@type_strings = Hash.new { |hash, key| hash[key] = key.to_s.freeze }
|
23
|
-
register_config_callbacks
|
24
|
-
end
|
25
|
-
|
26
|
-
def register_config_callbacks
|
27
|
-
NewRelic::Agent.config.register_callback(DEFAULT_CAPACITY_KEY) do |max_samples|
|
28
|
-
NewRelic::Agent.logger.debug "CustomEventAggregator max_samples set to #{max_samples}"
|
29
|
-
@lock.synchronize do
|
30
|
-
@buffer.capacity = max_samples
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
17
|
+
named :CustomEventAggregator
|
18
|
+
capacity_key :'custom_insights_events.max_samples_stored'
|
19
|
+
enabled_key :'custom_insights_events.enabled'
|
34
20
|
|
35
21
|
def record(type, attributes)
|
36
22
|
unless attributes.is_a? Hash
|
@@ -54,47 +40,36 @@ module NewRelic
|
|
54
40
|
stored
|
55
41
|
end
|
56
42
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
@
|
61
|
-
results.concat(@buffer.to_a)
|
62
|
-
drop_count += @buffer.num_dropped
|
63
|
-
@buffer.reset!
|
64
|
-
end
|
65
|
-
note_dropped_events(results.size, drop_count)
|
66
|
-
results
|
43
|
+
private
|
44
|
+
|
45
|
+
def after_initialize
|
46
|
+
@type_strings = Hash.new { |hash, key| hash[key] = key.to_s.freeze }
|
67
47
|
end
|
68
48
|
|
69
|
-
def
|
70
|
-
|
49
|
+
def after_harvest metadata
|
50
|
+
dropped_count = metadata[:seen] - metadata[:captured]
|
51
|
+
note_dropped_events(metadata[:seen], dropped_count)
|
52
|
+
record_supportability_metrics(metadata[:seen], metadata[:captured], dropped_count)
|
53
|
+
end
|
54
|
+
|
55
|
+
def note_dropped_events total_count, dropped_count
|
71
56
|
if dropped_count > 0
|
72
57
|
NewRelic::Agent.logger.warn("Dropped #{dropped_count} custom events out of #{total_count}.")
|
73
58
|
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def record_supportability_metrics total_count, captured_count, dropped_count
|
74
62
|
engine = NewRelic::Agent.instance.stats_engine
|
75
63
|
engine.tl_record_supportability_metric_count("Events/Customer/Seen" , total_count)
|
76
64
|
engine.tl_record_supportability_metric_count("Events/Customer/Sent" , captured_count)
|
77
65
|
engine.tl_record_supportability_metric_count("Events/Customer/Dropped", dropped_count)
|
78
66
|
end
|
79
67
|
|
80
|
-
def merge!(events)
|
81
|
-
@lock.synchronize do
|
82
|
-
events.each do |event|
|
83
|
-
@buffer.append(event)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def reset!
|
89
|
-
@lock.synchronize { @buffer.reset! }
|
90
|
-
end
|
91
|
-
|
92
68
|
def note_dropped_event(type)
|
93
69
|
::NewRelic::Agent.logger.log_once(:warn, "dropping_event_of_type:#{type}",
|
94
70
|
"Invalid event type name '#{type}', not recording.")
|
95
71
|
@buffer.note_dropped
|
96
72
|
end
|
97
|
-
|
98
73
|
end
|
99
74
|
end
|
100
75
|
end
|
@@ -3,124 +3,32 @@
|
|
3
3
|
# This file is distributed under New Relic's license terms.
|
4
4
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
5
5
|
|
6
|
-
require 'new_relic/agent/
|
7
|
-
require 'new_relic/agent/
|
6
|
+
require 'new_relic/agent/event_aggregator'
|
7
|
+
require 'new_relic/agent/transaction_error_primitive'
|
8
8
|
|
9
9
|
module NewRelic
|
10
10
|
module Agent
|
11
|
-
class ErrorEventAggregator
|
12
|
-
EVENT_TYPE = "TransactionError".freeze
|
11
|
+
class ErrorEventAggregator < EventAggregator
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
register_config_callbacks
|
18
|
-
end
|
19
|
-
|
20
|
-
def enabled?
|
21
|
-
Agent.config[:'error_collector.capture_events']
|
22
|
-
end
|
13
|
+
named :ErrorEventAggregator
|
14
|
+
capacity_key :'error_collector.max_event_samples_stored'
|
15
|
+
enabled_key :'error_collector.capture_events'
|
23
16
|
|
24
17
|
def append_event noticed_error, transaction_payload = nil
|
25
18
|
return unless enabled?
|
26
19
|
|
27
20
|
@lock.synchronize do
|
28
|
-
@
|
29
|
-
|
21
|
+
@buffer.append do
|
22
|
+
create_event(noticed_error, transaction_payload)
|
30
23
|
end
|
24
|
+
notify_if_full
|
31
25
|
end
|
32
26
|
end
|
33
27
|
|
34
|
-
def harvest!
|
35
|
-
@lock.synchronize do
|
36
|
-
samples = @error_event_buffer.to_a
|
37
|
-
# Eventually the logic for adding reservoir data will move to the sampled buffer
|
38
|
-
# so it can be shared with the other event aggregators. We'll first get it working
|
39
|
-
# here and then promote the functionality later.
|
40
|
-
stats = reservoir_stats
|
41
|
-
@error_event_buffer.reset!
|
42
|
-
[stats, samples]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def reset!
|
47
|
-
@lock.synchronize do
|
48
|
-
@error_event_buffer.reset!
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# samples will have already been transformed into
|
53
|
-
# collector primitives by event_for_collector
|
54
|
-
def merge! payload
|
55
|
-
@lock.synchronize do
|
56
|
-
_, samples = payload
|
57
|
-
@error_event_buffer.decrement_lifetime_counts_by samples.count
|
58
|
-
samples.each { |s| @error_event_buffer.append s }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def has_metadata?
|
63
|
-
true
|
64
|
-
end
|
65
|
-
|
66
28
|
private
|
67
29
|
|
68
|
-
def
|
69
|
-
|
70
|
-
:reservoir_size => Agent.config[:'error_collector.max_event_samples_stored'],
|
71
|
-
:events_seen => @error_event_buffer.num_seen
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
def register_config_callbacks
|
76
|
-
NewRelic::Agent.config.register_callback(:'error_collector.max_event_samples_stored') do |max_samples|
|
77
|
-
NewRelic::Agent.logger.debug "ErrorEventAggregator max_samples set to #{max_samples}"
|
78
|
-
@lock.synchronize { @error_event_buffer.capacity = max_samples }
|
79
|
-
end
|
80
|
-
|
81
|
-
NewRelic::Agent.config.register_callback(:'error_collector.capture_events') do |enabled|
|
82
|
-
::NewRelic::Agent.logger.debug "Error events will #{enabled ? '' : 'not '}be sent to the New Relic service."
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def event_for_collector noticed_error, transaction_payload
|
87
|
-
[
|
88
|
-
intrinsic_attributes_for(noticed_error, transaction_payload),
|
89
|
-
noticed_error.custom_attributes,
|
90
|
-
noticed_error.agent_attributes
|
91
|
-
]
|
92
|
-
end
|
93
|
-
|
94
|
-
def intrinsic_attributes_for noticed_error, transaction_payload
|
95
|
-
attrs = {
|
96
|
-
:type => EVENT_TYPE,
|
97
|
-
:'error.class' => noticed_error.exception_class_name,
|
98
|
-
:'error.message' => noticed_error.message,
|
99
|
-
:timestamp => noticed_error.timestamp.to_f
|
100
|
-
}
|
101
|
-
|
102
|
-
attrs[:port] = noticed_error.request_port if noticed_error.request_port
|
103
|
-
|
104
|
-
if transaction_payload
|
105
|
-
attrs[:transactionName] = transaction_payload[:name]
|
106
|
-
attrs[:duration] = transaction_payload[:duration]
|
107
|
-
append_synthetics transaction_payload, attrs
|
108
|
-
append_cat transaction_payload, attrs
|
109
|
-
PayloadMetricMapping.append_mapped_metrics transaction_payload[:metrics], attrs
|
110
|
-
end
|
111
|
-
|
112
|
-
attrs
|
113
|
-
end
|
114
|
-
|
115
|
-
def append_synthetics transaction_payload, sample
|
116
|
-
sample[:'nr.syntheticsResourceId'] = transaction_payload[:synthetics_resource_id] if transaction_payload[:synthetics_resource_id]
|
117
|
-
sample[:'nr.syntheticsJobId'] = transaction_payload[:synthetics_job_id] if transaction_payload[:synthetics_job_id]
|
118
|
-
sample[:'nr.syntheticsMonitorId'] = transaction_payload[:synthetics_monitor_id] if transaction_payload[:synthetics_monitor_id]
|
119
|
-
end
|
120
|
-
|
121
|
-
def append_cat transaction_payload, sample
|
122
|
-
sample[:'nr.transactionGuid'] = transaction_payload[:guid] if transaction_payload[:guid]
|
123
|
-
sample[:'nr.referringTransactionGuid'] = transaction_payload[:referring_transaction_guid] if transaction_payload[:referring_transaction_guid]
|
30
|
+
def create_event noticed_error, transaction_payload
|
31
|
+
TransactionErrorPrimitive.create noticed_error, transaction_payload
|
124
32
|
end
|
125
33
|
end
|
126
34
|
end
|