newrelic_rpm 9.14.0 → 9.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.build_ignore +1 -0
- data/CHANGELOG.md +139 -5
- data/CONTRIBUTING.md +2 -2
- data/lib/boot/strap.rb +4 -3
- data/lib/new_relic/agent/agent.rb +4 -0
- data/lib/new_relic/agent/agent_helpers/connect.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +1 -0
- data/lib/new_relic/agent/agent_helpers/startup.rb +7 -0
- data/lib/new_relic/agent/aws.rb +6 -0
- data/lib/new_relic/agent/configuration/default_source.rb +336 -115
- data/lib/new_relic/agent/configuration/manager.rb +1 -1
- data/lib/new_relic/agent/configuration/yaml_source.rb +6 -1
- data/lib/new_relic/agent/database.rb +41 -1
- data/lib/new_relic/agent/distributed_tracing.rb +2 -2
- data/lib/new_relic/agent/health_check.rb +136 -0
- data/lib/new_relic/agent/http_clients/uri_util.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +1 -8
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +5 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +9 -16
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +0 -2
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +0 -2
- data/lib/new_relic/agent/instrumentation/async_http.rb +1 -2
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose.rb +22 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +91 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis.rb +22 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +93 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs.rb +0 -2
- data/lib/new_relic/agent/instrumentation/bunny.rb +3 -4
- data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +0 -2
- data/lib/new_relic/agent/instrumentation/curb.rb +3 -4
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -4
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +3 -4
- data/lib/new_relic/agent/instrumentation/dynamodb.rb +0 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +0 -2
- data/lib/new_relic/agent/instrumentation/ethon.rb +0 -4
- data/lib/new_relic/agent/instrumentation/fiber.rb +0 -2
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +0 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -3
- data/lib/new_relic/agent/instrumentation/httpclient.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpx.rb +0 -4
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
- data/lib/new_relic/agent/instrumentation/logstasher.rb +0 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +0 -1
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +0 -2
- data/lib/new_relic/agent/instrumentation/opensearch.rb +0 -2
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rake.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +0 -2
- data/lib/new_relic/agent/instrumentation/redis.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +7 -5
- data/lib/new_relic/agent/instrumentation/roda.rb +4 -4
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +14 -4
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +0 -2
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delay_extensions.rb +24 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +9 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -6
- data/lib/new_relic/agent/instrumentation/thread.rb +0 -2
- data/lib/new_relic/agent/instrumentation/tilt.rb +0 -4
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +11 -8
- data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
- data/lib/new_relic/agent/local_log_decorator.rb +12 -2
- data/lib/new_relic/agent/log_event_aggregator.rb +28 -2
- data/lib/new_relic/agent/new_relic_service.rb +8 -2
- data/lib/new_relic/agent/span_event_primitive.rb +4 -2
- data/lib/new_relic/agent/threading/backtrace_node.rb +10 -1
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +3 -0
- data/lib/new_relic/agent/transaction/tracing.rb +4 -5
- data/lib/new_relic/agent/transaction.rb +2 -1
- data/lib/new_relic/agent/utilization_data.rb +15 -5
- data/lib/new_relic/agent.rb +2 -2
- data/lib/new_relic/control/frameworks/rails4.rb +1 -5
- data/lib/new_relic/control/instance_methods.rb +5 -0
- data/lib/new_relic/dependency_detection.rb +11 -13
- data/lib/new_relic/environment_report.rb +1 -5
- data/lib/new_relic/helper.rb +15 -0
- data/lib/new_relic/language_support.rb +1 -5
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
- data/lib/tasks/helpers/newrelicyml.rb +4 -2
- data/newrelic.yml +174 -66
- data/test/agent_helper.rb +8 -1
- metadata +17 -19
- data/lib/tasks/instrumentation_generator/README.md +0 -63
- data/lib/tasks/instrumentation_generator/TODO.md +0 -33
- data/lib/tasks/instrumentation_generator/instrumentation.thor +0 -130
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +0 -9
- data/lib/tasks/instrumentation_generator/templates/chain.tt +0 -21
- data/lib/tasks/instrumentation_generator/templates/chain_method.tt +0 -7
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +0 -29
- data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +0 -13
- data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +0 -3
- data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +0 -19
- data/lib/tasks/instrumentation_generator/templates/prepend.tt +0 -13
- data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +0 -3
- data/lib/tasks/instrumentation_generator/templates/test.tt +0 -15
@@ -1,130 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require_relative '../../new_relic/language_support'
|
6
|
-
require 'thor'
|
7
|
-
|
8
|
-
class Instrumentation < Thor
|
9
|
-
include Thor::Actions
|
10
|
-
|
11
|
-
INSTRUMENTATION_ROOT = 'lib/new_relic/agent/instrumentation/'
|
12
|
-
MULTIVERSE_SUITE_ROOT = 'test/multiverse/suites/'
|
13
|
-
DEFAULT_SOURCE_LOCATION = 'lib/new_relic/agent/configuration/default_source.rb'
|
14
|
-
NEWRELIC_YML_LOCATION = 'newrelic.yml'
|
15
|
-
|
16
|
-
desc('scaffold NAME', 'Scaffold the required files for adding new instrumentation')
|
17
|
-
long_desc <<~LONGDESC
|
18
|
-
`instrumentation scaffold` requires one parameter by default: the name of the
|
19
|
-
library or class you are instrumenting. This task generates the basic
|
20
|
-
file structure needed to add new instrumentation to the Ruby agent.
|
21
|
-
LONGDESC
|
22
|
-
|
23
|
-
source_root(File.dirname(__FILE__))
|
24
|
-
|
25
|
-
option :method,
|
26
|
-
default: 'method_to_instrument',
|
27
|
-
desc: 'The method you would like to prepend or chain instrumentation onto'
|
28
|
-
option :args,
|
29
|
-
default: '*args',
|
30
|
-
desc: 'The arguments associated with the original method'
|
31
|
-
|
32
|
-
def scaffold(name)
|
33
|
-
@name = name
|
34
|
-
@snake_name = snake_name(@name)
|
35
|
-
@method = options[:method] if options[:method]
|
36
|
-
@args = options[:args] if options[:args]
|
37
|
-
@class_name = ::NewRelic::LanguageSupport.camelize(name)
|
38
|
-
base_path = "#{INSTRUMENTATION_ROOT}#{@snake_name}"
|
39
|
-
|
40
|
-
empty_directory(base_path)
|
41
|
-
create_instrumentation_files(base_path)
|
42
|
-
append_to_default_source(@name, @snake_name)
|
43
|
-
# append_to_newrelic_yml(@name, @snake_name) # This is now done on release, we don't need it anymore, but leaving it to be sure.
|
44
|
-
create_tests(name)
|
45
|
-
end
|
46
|
-
|
47
|
-
desc 'add_new_method NAME', 'Inserts a new method into an existing piece of instrumentation'
|
48
|
-
|
49
|
-
option :method, required: true, desc: 'The name of the method to instrument'
|
50
|
-
option :args, default: '*args', desc: 'The arguments associated with the instrumented method'
|
51
|
-
|
52
|
-
def add_new_method(name, method_name)
|
53
|
-
# Verify that existing instrumentation exists
|
54
|
-
# if it doesn't, should we just call the #scaffold method instead since we have all the stuff
|
55
|
-
# otherwise, inject the new method into the instrumentation matching the first arg
|
56
|
-
# add to only chain, instrumentation, prepend
|
57
|
-
# move the method content to a partial
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def create_instrumentation_files(base_path)
|
63
|
-
%w[chain instrumentation prepend].each do |file|
|
64
|
-
template("templates/#{file}.tt", "#{base_path}/#{file}.rb")
|
65
|
-
end
|
66
|
-
|
67
|
-
template('templates/dependency_detection.tt', "#{base_path}.rb")
|
68
|
-
end
|
69
|
-
|
70
|
-
def create_tests(name)
|
71
|
-
@name = name
|
72
|
-
@instrumentation_method_global_erb_snippet = '<%= $instrumentation_method %>'
|
73
|
-
@snake_name = snake_name(@name)
|
74
|
-
base_path = "#{MULTIVERSE_SUITE_ROOT}#{@snake_name}"
|
75
|
-
empty_directory(base_path)
|
76
|
-
template('templates/Envfile.tt', "#{base_path}/Envfile")
|
77
|
-
template('templates/test.tt', "#{base_path}/#{@snake_name}_instrumentation_test.rb")
|
78
|
-
|
79
|
-
empty_directory("#{base_path}/config")
|
80
|
-
template('templates/newrelic.yml.tt', "#{base_path}/config/newrelic.yml")
|
81
|
-
end
|
82
|
-
|
83
|
-
def append_to_default_source(name, snake_name)
|
84
|
-
insert_into_file(
|
85
|
-
DEFAULT_SOURCE_LOCATION,
|
86
|
-
config_block(name, snake_name),
|
87
|
-
after: ":description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
88
|
-
},\n"
|
89
|
-
)
|
90
|
-
end
|
91
|
-
|
92
|
-
def append_to_newrelic_yml(name, snake_name)
|
93
|
-
insert_into_file(
|
94
|
-
NEWRELIC_YML_LOCATION,
|
95
|
-
yaml_block(name, snake_name),
|
96
|
-
after: "# instrumentation.bunny: auto\n"
|
97
|
-
)
|
98
|
-
end
|
99
|
-
|
100
|
-
def config_block(name, snake_name)
|
101
|
-
# Don't change to <<~
|
102
|
-
# We want to preserve the whitespace so the config is correctly indented
|
103
|
-
<<-CONFIG
|
104
|
-
:'instrumentation.#{snake_name}' => {
|
105
|
-
:default => 'auto',
|
106
|
-
:documentation_default => 'auto',
|
107
|
-
:public => true,
|
108
|
-
:type => String,
|
109
|
-
:dynamic_name => true,
|
110
|
-
:allowed_from_server => false,
|
111
|
-
:description => 'Controls auto-instrumentation of the #{name} library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
112
|
-
},
|
113
|
-
CONFIG
|
114
|
-
end
|
115
|
-
|
116
|
-
def yaml_block(name, snake_name)
|
117
|
-
<<~HEREDOC
|
118
|
-
|
119
|
-
# Controls auto-instrumentation of #{name} at start-up.
|
120
|
-
# May be one of [auto|prepend|chain|disabled]
|
121
|
-
# instrumentation.#{snake_name}: auto
|
122
|
-
HEREDOC
|
123
|
-
end
|
124
|
-
|
125
|
-
def snake_name(name)
|
126
|
-
name.downcase.tr('-', '_')
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
Instrumentation.start(ARGV)
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
instrumentation_methods :chain, :prepend
|
6
|
-
|
7
|
-
gemfile <<~RB
|
8
|
-
gem '<%= @name.downcase %>'
|
9
|
-
RB
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
module NewRelic::Agent::Instrumentation
|
6
|
-
module <%= @class_name %>::Chain
|
7
|
-
def self.instrument!
|
8
|
-
::<%= @class_name %>.class_eval do
|
9
|
-
include NewRelic::Agent::Instrumentation::<%= @class_name %>
|
10
|
-
|
11
|
-
alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
|
12
|
-
|
13
|
-
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
14
|
-
<%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
|
15
|
-
<%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
|
2
|
-
|
3
|
-
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
4
|
-
<%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
|
5
|
-
<%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
|
6
|
-
end
|
7
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require_relative '<%= @snake_name.downcase %>/instrumentation'
|
6
|
-
require_relative '<%= @snake_name.downcase %>/chain'
|
7
|
-
require_relative '<%= @snake_name.downcase %>/prepend'
|
8
|
-
|
9
|
-
DependencyDetection.defer do
|
10
|
-
named :<%= @name.match?(/\-|\_/) ? "'#{@snake_name}'" : @name.downcase %>
|
11
|
-
|
12
|
-
depends_on do
|
13
|
-
# The class that needs to be defined to prepend/chain onto. This can be used
|
14
|
-
# to determine whether the library is installed.
|
15
|
-
defined?(<%= @class_name %>)
|
16
|
-
# Add any additional requirements to verify whether this instrumentation
|
17
|
-
# should be installed
|
18
|
-
end
|
19
|
-
|
20
|
-
executes do
|
21
|
-
NewRelic::Agent.logger.info('Installing <%= @name.downcase %> instrumentation')
|
22
|
-
|
23
|
-
if use_prepend?
|
24
|
-
prepend_instrument <%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
|
25
|
-
else
|
26
|
-
chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>::Chain
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
module NewRelic::Agent::Instrumentation
|
6
|
-
module <%= @class_name %>
|
7
|
-
|
8
|
-
def <%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %>
|
9
|
-
# add instrumentation content here
|
10
|
-
yield
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
development:
|
3
|
-
error_collector:
|
4
|
-
enabled: true
|
5
|
-
apdex_t: 0.5
|
6
|
-
monitor_mode: true
|
7
|
-
license_key: bootstrap_newrelic_admin_license_key_000
|
8
|
-
instrumentation:
|
9
|
-
<%= @snake_name %>: <%= @instrumentation_method_global_erb_snippet %>
|
10
|
-
app_name: test
|
11
|
-
log_level: debug
|
12
|
-
host: 127.0.0.1
|
13
|
-
api_host: 127.0.0.1
|
14
|
-
transaction_trace:
|
15
|
-
record_sql: obfuscated
|
16
|
-
enabled: true
|
17
|
-
stack_trace_threshold: 0.5
|
18
|
-
transaction_threshold: 1.0
|
19
|
-
capture_params: false
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
module NewRelic::Agent::Instrumentation
|
6
|
-
module <%= @class_name %>::Prepend
|
7
|
-
include NewRelic::Agent::Instrumentation::<%= @class_name %>
|
8
|
-
|
9
|
-
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
10
|
-
<%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> { super }
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file is distributed under New Relic's license terms.
|
2
|
-
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
class <%= @class_name %>InstrumentationTest < Minitest::Test
|
6
|
-
def setup
|
7
|
-
@stats_engine = NewRelic::Agent.instance.stats_engine
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
NewRelic::Agent.instance.stats_engine.clear_stats
|
12
|
-
end
|
13
|
-
|
14
|
-
# Add tests here
|
15
|
-
end
|