newrelic_rpm 9.9.0 → 9.21.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 +463 -1
- data/CONTRIBUTING.md +2 -2
- data/README.md +16 -17
- data/Rakefile +1 -1
- data/lib/boot/strap.rb +102 -0
- data/lib/new_relic/agent/agent.rb +6 -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/agent_logger.rb +1 -0
- data/lib/new_relic/agent/aws.rb +68 -0
- data/lib/new_relic/agent/configuration/default_source.rb +603 -105
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
- data/lib/new_relic/agent/configuration/manager.rb +28 -2
- data/lib/new_relic/agent/configuration/yaml_source.rb +7 -2
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +11 -11
- data/lib/new_relic/agent/database/obfuscator.rb +1 -0
- data/lib/new_relic/agent/database.rb +41 -1
- data/lib/new_relic/agent/database_adapter.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing.rb +4 -2
- data/lib/new_relic/agent/error_collector.rb +37 -10
- data/lib/new_relic/agent/external.rb +2 -0
- 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/action_dispatch.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_mailbox.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_mailer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +6 -2
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +0 -13
- data/lib/new_relic/agent/instrumentation/active_record.rb +7 -12
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +7 -3
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +11 -9
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
- 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 +2 -3
- 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/chain.rb +37 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/prepend.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs.rb +23 -0
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +14 -0
- data/lib/new_relic/agent/instrumentation/bunny.rb +3 -4
- data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +1 -3
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/curb.rb +4 -5
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -23
- data/lib/new_relic/agent/instrumentation/dynamodb/chain.rb +27 -0
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +64 -0
- data/lib/new_relic/agent/instrumentation/dynamodb/prepend.rb +19 -0
- data/lib/new_relic/agent/instrumentation/dynamodb.rb +23 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +53 -7
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -3
- data/lib/new_relic/agent/instrumentation/ethon.rb +1 -5
- data/lib/new_relic/agent/instrumentation/excon.rb +1 -17
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +1 -1
- 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 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -5
- data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpx.rb +1 -5
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
- data/lib/new_relic/agent/instrumentation/logstasher/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb +24 -0
- data/lib/new_relic/agent/instrumentation/logstasher/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/logstasher.rb +25 -0
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +0 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +0 -2
- data/lib/new_relic/agent/instrumentation/opensearch/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/opensearch/instrumentation.rb +66 -0
- data/lib/{tasks/instrumentation_generator/templates/instrumentation.tt → new_relic/agent/instrumentation/opensearch/prepend.rb} +4 -4
- data/lib/new_relic/agent/instrumentation/opensearch.rb +23 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +3 -0
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +9 -5
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -2
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +72 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb +70 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +67 -0
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +25 -0
- data/lib/new_relic/agent/instrumentation/redis/cluster_middleware.rb +26 -0
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +2 -2
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +14 -11
- data/lib/new_relic/agent/instrumentation/redis/middleware.rb +3 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +11 -5
- data/lib/new_relic/agent/instrumentation/resque.rb +8 -6
- data/lib/new_relic/agent/instrumentation/roda.rb +5 -5
- data/lib/new_relic/agent/instrumentation/ruby_kafka/chain.rb +55 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +60 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +25 -0
- data/lib/new_relic/agent/instrumentation/ruby_openai.rb +2 -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 +2 -2
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +9 -15
- data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -19
- data/lib/new_relic/agent/instrumentation/stripe.rb +1 -1
- data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +22 -1
- 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/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +11 -5
- data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +2 -3
- data/lib/new_relic/agent/llm/chat_completion_summary.rb +1 -1
- data/lib/new_relic/agent/llm/embedding.rb +1 -1
- data/lib/new_relic/agent/local_log_decorator.rb +20 -3
- data/lib/new_relic/agent/log_event_aggregator.rb +119 -28
- data/lib/new_relic/agent/logging.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +16 -5
- data/lib/new_relic/agent/method_tracer.rb +3 -0
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
- data/lib/new_relic/agent/new_relic_service.rb +8 -2
- data/lib/new_relic/agent/opentelemetry/context/propagation/trace_propagator.rb +66 -0
- data/lib/new_relic/agent/opentelemetry/context/propagation.rb +15 -0
- data/lib/{tasks/instrumentation_generator/templates/Envfile.tt → new_relic/agent/opentelemetry/context.rb} +9 -5
- data/lib/new_relic/agent/opentelemetry/trace/span.rb +31 -0
- data/lib/new_relic/agent/opentelemetry/trace/tracer.rb +129 -0
- data/lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb +18 -0
- data/lib/new_relic/agent/opentelemetry/trace.rb +15 -0
- data/lib/new_relic/agent/opentelemetry/transaction_patch.rb +69 -0
- data/lib/new_relic/agent/opentelemetry_bridge.rb +32 -0
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
- data/lib/new_relic/agent/serverless_handler.rb +247 -12
- data/lib/new_relic/agent/serverless_handler_event_sources.json +155 -0
- data/lib/new_relic/agent/serverless_handler_event_sources.rb +49 -0
- data/lib/new_relic/agent/span_event_primitive.rb +16 -11
- data/lib/new_relic/agent/system_info.rb +14 -0
- data/lib/new_relic/agent/threading/backtrace_node.rb +10 -1
- data/lib/new_relic/agent/tracer.rb +1 -1
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -1
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +3 -3
- data/lib/new_relic/agent/transaction/external_request_segment.rb +0 -10
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +4 -1
- data/lib/new_relic/agent/transaction/request_attributes.rb +14 -7
- data/lib/new_relic/agent/transaction/trace_context.rb +34 -5
- data/lib/new_relic/agent/transaction/tracing.rb +3 -3
- data/lib/new_relic/agent/transaction.rb +4 -7
- data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
- data/lib/new_relic/agent/utilization/ecs.rb +22 -0
- data/lib/new_relic/agent/utilization/ecs_v4.rb +22 -0
- data/lib/new_relic/agent/utilization_data.rb +40 -5
- data/lib/new_relic/agent/vm/c_ruby_vm.rb +3 -3
- data/lib/new_relic/agent.rb +124 -2
- data/lib/new_relic/constants.rb +1 -0
- data/lib/new_relic/control/frameworks/grape.rb +14 -0
- data/lib/new_relic/control/frameworks/padrino.rb +14 -0
- data/lib/new_relic/control/frameworks/rails4.rb +1 -3
- data/lib/new_relic/control/instance_methods.rb +6 -0
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/private_instance_methods.rb +4 -0
- data/lib/new_relic/control/security_interface.rb +57 -0
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +11 -14
- data/lib/new_relic/environment_report.rb +2 -2
- data/lib/new_relic/helper.rb +22 -0
- data/lib/new_relic/language_support.rb +3 -1
- data/lib/new_relic/local_environment.rb +1 -4
- data/lib/new_relic/rack/browser_monitoring.rb +20 -8
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +3 -2
- data/lib/tasks/config.rake +7 -3
- data/lib/tasks/gha.rake +31 -0
- data/lib/tasks/helpers/config.html.erb +3 -2
- data/lib/tasks/helpers/format.rb +1 -1
- data/lib/tasks/helpers/newrelicyml.rb +80 -13
- data/newrelic.yml +425 -162
- data/newrelic_rpm.gemspec +3 -1
- data/test/agent_helper.rb +24 -2
- metadata +91 -22
- 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 -121
- 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_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
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.4.0'
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to?(:required_rubygems_version=)
|
13
|
-
s.authors = ['Tanna McClure', 'Kayla Reopelle', '
|
13
|
+
s.authors = ['Tanna McClure', 'Kayla Reopelle', 'Hannah Ramadan']
|
14
14
|
s.licenses = ['Apache-2.0']
|
15
15
|
s.description = <<~EOS
|
16
16
|
New Relic is a performance management system, developed by New Relic,
|
@@ -56,6 +56,8 @@ Gem::Specification.new do |s|
|
|
56
56
|
s.add_development_dependency 'minitest', "#{RUBY_VERSION >= '2.7.0' ? '5.3.3' : '4.7.5'}"
|
57
57
|
s.add_development_dependency 'minitest-stub-const', '0.6'
|
58
58
|
s.add_development_dependency 'mocha', '~> 1.16'
|
59
|
+
s.add_development_dependency 'mutex_m' # used by Minitest, not included in Rubies above v3.3
|
60
|
+
s.add_development_dependency 'ostruct' # used by Rack, not included in Rubies above v3.4
|
59
61
|
s.add_development_dependency 'pry' if ENV['ENABLE_PRY']
|
60
62
|
s.add_development_dependency 'rack'
|
61
63
|
s.add_development_dependency 'rake', '12.3.3'
|
data/test/agent_helper.rb
CHANGED
@@ -112,7 +112,14 @@ def assert_log_contains(log, message)
|
|
112
112
|
lines = log.array
|
113
113
|
|
114
114
|
assert (lines.any? { |line| line.match(message) }),
|
115
|
-
"Could not find message. Log contained: #{lines.join("\n")}"
|
115
|
+
"Could not find message: '#{message.inspect}'. Log contained: #{lines.join("\n")}"
|
116
|
+
end
|
117
|
+
|
118
|
+
def refute_log_contains(log, message)
|
119
|
+
lines = log.array
|
120
|
+
|
121
|
+
refute (lines.any? { |line| line.match(message) }),
|
122
|
+
"Found message: '#{message.inspect}'. Log contained: #{lines.join("\n")}"
|
116
123
|
end
|
117
124
|
|
118
125
|
def assert_audit_log_contains(audit_log_contents, needle)
|
@@ -228,7 +235,9 @@ def assert_metrics_recorded(expected)
|
|
228
235
|
expected.each do |specish, expected_attrs|
|
229
236
|
expected_spec = metric_spec_from_specish(specish)
|
230
237
|
actual_stats = NewRelic::Agent.instance.stats_engine.to_h[expected_spec]
|
231
|
-
if
|
238
|
+
if actual_stats
|
239
|
+
assert(actual_stats)
|
240
|
+
else
|
232
241
|
all_specs = NewRelic::Agent.instance.stats_engine.to_h.keys.sort
|
233
242
|
matches = all_specs.select { |spec| spec.name == expected_spec.name }
|
234
243
|
matches.map! { |m| " #{m.inspect}" }
|
@@ -1037,3 +1046,16 @@ def first_call_for(subject)
|
|
1037
1046
|
|
1038
1047
|
items.first
|
1039
1048
|
end
|
1049
|
+
|
1050
|
+
def ruby_version_float
|
1051
|
+
RUBY_VERSION.split('.')[0..1].join('.').to_f
|
1052
|
+
end
|
1053
|
+
|
1054
|
+
def rails_version
|
1055
|
+
@rails_version ||= Gem::Version.new(Rails::VERSION::STRING)
|
1056
|
+
end
|
1057
|
+
|
1058
|
+
def rails_version_at_least?(version_string)
|
1059
|
+
version_string += '.0' until version_string.count('.') >= 2 # '7' => '7.0.0'
|
1060
|
+
rails_version >= Gem::Version.new(version_string)
|
1061
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
8
8
|
- Kayla Reopelle
|
9
|
-
- James Bunch
|
10
9
|
- Hannah Ramadan
|
11
|
-
autorequire:
|
12
10
|
bindir: bin
|
13
11
|
cert_chain: []
|
14
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
15
13
|
dependencies:
|
16
14
|
- !ruby/object:Gem::Dependency
|
17
15
|
name: bundler
|
@@ -69,6 +67,34 @@ dependencies:
|
|
69
67
|
- - "~>"
|
70
68
|
- !ruby/object:Gem::Version
|
71
69
|
version: '1.16'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: mutex_m
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: ostruct
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
72
98
|
- !ruby/object:Gem::Dependency
|
73
99
|
name: rack
|
74
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,15 +244,15 @@ description: |
|
|
218
244
|
https://github.com/newrelic/newrelic-ruby-agent/
|
219
245
|
email: support@newrelic.com
|
220
246
|
executables:
|
221
|
-
- newrelic_rpm
|
222
247
|
- newrelic
|
248
|
+
- newrelic_rpm
|
223
249
|
- nrdebug
|
224
250
|
extensions: []
|
225
251
|
extra_rdoc_files:
|
226
252
|
- CHANGELOG.md
|
253
|
+
- CONTRIBUTING.md
|
227
254
|
- LICENSE
|
228
255
|
- README.md
|
229
|
-
- CONTRIBUTING.md
|
230
256
|
- newrelic.yml
|
231
257
|
files:
|
232
258
|
- ".build_ignore"
|
@@ -243,6 +269,7 @@ files:
|
|
243
269
|
- bin/nrdebug
|
244
270
|
- init.rb
|
245
271
|
- install.rb
|
272
|
+
- lib/boot/strap.rb
|
246
273
|
- lib/new_relic/agent.rb
|
247
274
|
- lib/new_relic/agent/adaptive_sampler.rb
|
248
275
|
- lib/new_relic/agent/agent.rb
|
@@ -260,6 +287,7 @@ files:
|
|
260
287
|
- lib/new_relic/agent/attributes.rb
|
261
288
|
- lib/new_relic/agent/audit_logger.rb
|
262
289
|
- lib/new_relic/agent/autostart.rb
|
290
|
+
- lib/new_relic/agent/aws.rb
|
263
291
|
- lib/new_relic/agent/chained_call.rb
|
264
292
|
- lib/new_relic/agent/commands/agent_command.rb
|
265
293
|
- lib/new_relic/agent/commands/agent_command_router.rb
|
@@ -314,6 +342,7 @@ files:
|
|
314
342
|
- lib/new_relic/agent/external.rb
|
315
343
|
- lib/new_relic/agent/guid_generator.rb
|
316
344
|
- lib/new_relic/agent/harvester.rb
|
345
|
+
- lib/new_relic/agent/health_check.rb
|
317
346
|
- lib/new_relic/agent/heap.rb
|
318
347
|
- lib/new_relic/agent/hostname.rb
|
319
348
|
- lib/new_relic/agent/http_clients/abstract.rb
|
@@ -362,6 +391,22 @@ files:
|
|
362
391
|
- lib/new_relic/agent/instrumentation/async_http/chain.rb
|
363
392
|
- lib/new_relic/agent/instrumentation/async_http/instrumentation.rb
|
364
393
|
- lib/new_relic/agent/instrumentation/async_http/prepend.rb
|
394
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_firehose.rb
|
395
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_firehose/chain.rb
|
396
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_firehose/instrumentation.rb
|
397
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_firehose/prepend.rb
|
398
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_kinesis.rb
|
399
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_kinesis/chain.rb
|
400
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb
|
401
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_kinesis/prepend.rb
|
402
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb
|
403
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb
|
404
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb
|
405
|
+
- lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb
|
406
|
+
- lib/new_relic/agent/instrumentation/aws_sqs.rb
|
407
|
+
- lib/new_relic/agent/instrumentation/aws_sqs/chain.rb
|
408
|
+
- lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb
|
409
|
+
- lib/new_relic/agent/instrumentation/aws_sqs/prepend.rb
|
365
410
|
- lib/new_relic/agent/instrumentation/bunny.rb
|
366
411
|
- lib/new_relic/agent/instrumentation/bunny/chain.rb
|
367
412
|
- lib/new_relic/agent/instrumentation/bunny/instrumentation.rb
|
@@ -381,6 +426,10 @@ files:
|
|
381
426
|
- lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb
|
382
427
|
- lib/new_relic/agent/instrumentation/delayed_job/prepend.rb
|
383
428
|
- lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb
|
429
|
+
- lib/new_relic/agent/instrumentation/dynamodb.rb
|
430
|
+
- lib/new_relic/agent/instrumentation/dynamodb/chain.rb
|
431
|
+
- lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb
|
432
|
+
- lib/new_relic/agent/instrumentation/dynamodb/prepend.rb
|
384
433
|
- lib/new_relic/agent/instrumentation/elasticsearch.rb
|
385
434
|
- lib/new_relic/agent/instrumentation/elasticsearch/chain.rb
|
386
435
|
- lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb
|
@@ -427,6 +476,10 @@ files:
|
|
427
476
|
- lib/new_relic/agent/instrumentation/logger/chain.rb
|
428
477
|
- lib/new_relic/agent/instrumentation/logger/instrumentation.rb
|
429
478
|
- lib/new_relic/agent/instrumentation/logger/prepend.rb
|
479
|
+
- lib/new_relic/agent/instrumentation/logstasher.rb
|
480
|
+
- lib/new_relic/agent/instrumentation/logstasher/chain.rb
|
481
|
+
- lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb
|
482
|
+
- lib/new_relic/agent/instrumentation/logstasher/prepend.rb
|
430
483
|
- lib/new_relic/agent/instrumentation/memcache.rb
|
431
484
|
- lib/new_relic/agent/instrumentation/memcache/chain.rb
|
432
485
|
- lib/new_relic/agent/instrumentation/memcache/dalli.rb
|
@@ -442,6 +495,10 @@ files:
|
|
442
495
|
- lib/new_relic/agent/instrumentation/net_http/instrumentation.rb
|
443
496
|
- lib/new_relic/agent/instrumentation/net_http/prepend.rb
|
444
497
|
- lib/new_relic/agent/instrumentation/notifications_subscriber.rb
|
498
|
+
- lib/new_relic/agent/instrumentation/opensearch.rb
|
499
|
+
- lib/new_relic/agent/instrumentation/opensearch/chain.rb
|
500
|
+
- lib/new_relic/agent/instrumentation/opensearch/instrumentation.rb
|
501
|
+
- lib/new_relic/agent/instrumentation/opensearch/prepend.rb
|
445
502
|
- lib/new_relic/agent/instrumentation/padrino.rb
|
446
503
|
- lib/new_relic/agent/instrumentation/padrino/chain.rb
|
447
504
|
- lib/new_relic/agent/instrumentation/padrino/instrumentation.rb
|
@@ -463,8 +520,13 @@ files:
|
|
463
520
|
- lib/new_relic/agent/instrumentation/rake/chain.rb
|
464
521
|
- lib/new_relic/agent/instrumentation/rake/instrumentation.rb
|
465
522
|
- lib/new_relic/agent/instrumentation/rake/prepend.rb
|
523
|
+
- lib/new_relic/agent/instrumentation/rdkafka.rb
|
524
|
+
- lib/new_relic/agent/instrumentation/rdkafka/chain.rb
|
525
|
+
- lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb
|
526
|
+
- lib/new_relic/agent/instrumentation/rdkafka/prepend.rb
|
466
527
|
- lib/new_relic/agent/instrumentation/redis.rb
|
467
528
|
- lib/new_relic/agent/instrumentation/redis/chain.rb
|
529
|
+
- lib/new_relic/agent/instrumentation/redis/cluster_middleware.rb
|
468
530
|
- lib/new_relic/agent/instrumentation/redis/constants.rb
|
469
531
|
- lib/new_relic/agent/instrumentation/redis/instrumentation.rb
|
470
532
|
- lib/new_relic/agent/instrumentation/redis/middleware.rb
|
@@ -480,6 +542,10 @@ files:
|
|
480
542
|
- lib/new_relic/agent/instrumentation/roda/instrumentation.rb
|
481
543
|
- lib/new_relic/agent/instrumentation/roda/prepend.rb
|
482
544
|
- lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb
|
545
|
+
- lib/new_relic/agent/instrumentation/ruby_kafka.rb
|
546
|
+
- lib/new_relic/agent/instrumentation/ruby_kafka/chain.rb
|
547
|
+
- lib/new_relic/agent/instrumentation/ruby_kafka/instrumentation.rb
|
548
|
+
- lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb
|
483
549
|
- lib/new_relic/agent/instrumentation/ruby_openai.rb
|
484
550
|
- lib/new_relic/agent/instrumentation/ruby_openai/chain.rb
|
485
551
|
- lib/new_relic/agent/instrumentation/ruby_openai/instrumentation.rb
|
@@ -488,6 +554,7 @@ files:
|
|
488
554
|
- lib/new_relic/agent/instrumentation/sequel_helper.rb
|
489
555
|
- lib/new_relic/agent/instrumentation/sidekiq.rb
|
490
556
|
- lib/new_relic/agent/instrumentation/sidekiq/client.rb
|
557
|
+
- lib/new_relic/agent/instrumentation/sidekiq/extensions/delay_extensions.rb
|
491
558
|
- lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
|
492
559
|
- lib/new_relic/agent/instrumentation/sidekiq/server.rb
|
493
560
|
- lib/new_relic/agent/instrumentation/sinatra.rb
|
@@ -546,6 +613,15 @@ files:
|
|
546
613
|
- lib/new_relic/agent/noticeable_error.rb
|
547
614
|
- lib/new_relic/agent/null_logger.rb
|
548
615
|
- lib/new_relic/agent/obfuscator.rb
|
616
|
+
- lib/new_relic/agent/opentelemetry/context.rb
|
617
|
+
- lib/new_relic/agent/opentelemetry/context/propagation.rb
|
618
|
+
- lib/new_relic/agent/opentelemetry/context/propagation/trace_propagator.rb
|
619
|
+
- lib/new_relic/agent/opentelemetry/trace.rb
|
620
|
+
- lib/new_relic/agent/opentelemetry/trace/span.rb
|
621
|
+
- lib/new_relic/agent/opentelemetry/trace/tracer.rb
|
622
|
+
- lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb
|
623
|
+
- lib/new_relic/agent/opentelemetry/transaction_patch.rb
|
624
|
+
- lib/new_relic/agent/opentelemetry_bridge.rb
|
549
625
|
- lib/new_relic/agent/parameter_filtering.rb
|
550
626
|
- lib/new_relic/agent/payload_metric_mapping.rb
|
551
627
|
- lib/new_relic/agent/pipe_channel_manager.rb
|
@@ -563,6 +639,8 @@ files:
|
|
563
639
|
- lib/new_relic/agent/samplers/object_sampler.rb
|
564
640
|
- lib/new_relic/agent/samplers/vm_sampler.rb
|
565
641
|
- lib/new_relic/agent/serverless_handler.rb
|
642
|
+
- lib/new_relic/agent/serverless_handler_event_sources.json
|
643
|
+
- lib/new_relic/agent/serverless_handler_event_sources.rb
|
566
644
|
- lib/new_relic/agent/span_event_aggregator.rb
|
567
645
|
- lib/new_relic/agent/span_event_primitive.rb
|
568
646
|
- lib/new_relic/agent/sql_sampler.rb
|
@@ -604,6 +682,8 @@ files:
|
|
604
682
|
- lib/new_relic/agent/transaction_time_aggregator.rb
|
605
683
|
- lib/new_relic/agent/utilization/aws.rb
|
606
684
|
- lib/new_relic/agent/utilization/azure.rb
|
685
|
+
- lib/new_relic/agent/utilization/ecs.rb
|
686
|
+
- lib/new_relic/agent/utilization/ecs_v4.rb
|
607
687
|
- lib/new_relic/agent/utilization/gcp.rb
|
608
688
|
- lib/new_relic/agent/utilization/pcf.rb
|
609
689
|
- lib/new_relic/agent/utilization/vendor.rb
|
@@ -625,6 +705,8 @@ files:
|
|
625
705
|
- lib/new_relic/control/class_methods.rb
|
626
706
|
- lib/new_relic/control/frameworks.rb
|
627
707
|
- lib/new_relic/control/frameworks/external.rb
|
708
|
+
- lib/new_relic/control/frameworks/grape.rb
|
709
|
+
- lib/new_relic/control/frameworks/padrino.rb
|
628
710
|
- lib/new_relic/control/frameworks/rails.rb
|
629
711
|
- lib/new_relic/control/frameworks/rails3.rb
|
630
712
|
- lib/new_relic/control/frameworks/rails4.rb
|
@@ -635,6 +717,7 @@ files:
|
|
635
717
|
- lib/new_relic/control/instance_methods.rb
|
636
718
|
- lib/new_relic/control/instrumentation.rb
|
637
719
|
- lib/new_relic/control/private_instance_methods.rb
|
720
|
+
- lib/new_relic/control/security_interface.rb
|
638
721
|
- lib/new_relic/control/server_methods.rb
|
639
722
|
- lib/new_relic/delayed_job_injection.rb
|
640
723
|
- lib/new_relic/dependency_detection.rb
|
@@ -665,6 +748,7 @@ files:
|
|
665
748
|
- lib/tasks/bump_version.rake
|
666
749
|
- lib/tasks/config.rake
|
667
750
|
- lib/tasks/coverage_report.rake
|
751
|
+
- lib/tasks/gha.rake
|
668
752
|
- lib/tasks/helpers/config.html.erb
|
669
753
|
- lib/tasks/helpers/config.text.erb
|
670
754
|
- lib/tasks/helpers/format.rb
|
@@ -673,19 +757,6 @@ files:
|
|
673
757
|
- lib/tasks/helpers/prompt.rb
|
674
758
|
- lib/tasks/helpers/version_bump.rb
|
675
759
|
- lib/tasks/install.rake
|
676
|
-
- lib/tasks/instrumentation_generator/README.md
|
677
|
-
- lib/tasks/instrumentation_generator/TODO.md
|
678
|
-
- lib/tasks/instrumentation_generator/instrumentation.thor
|
679
|
-
- lib/tasks/instrumentation_generator/templates/Envfile.tt
|
680
|
-
- lib/tasks/instrumentation_generator/templates/chain.tt
|
681
|
-
- lib/tasks/instrumentation_generator/templates/chain_method.tt
|
682
|
-
- lib/tasks/instrumentation_generator/templates/dependency_detection.tt
|
683
|
-
- lib/tasks/instrumentation_generator/templates/instrumentation.tt
|
684
|
-
- lib/tasks/instrumentation_generator/templates/instrumentation_method.tt
|
685
|
-
- lib/tasks/instrumentation_generator/templates/newrelic.yml.tt
|
686
|
-
- lib/tasks/instrumentation_generator/templates/prepend.tt
|
687
|
-
- lib/tasks/instrumentation_generator/templates/prepend_method.tt
|
688
|
-
- lib/tasks/instrumentation_generator/templates/test.tt
|
689
760
|
- lib/tasks/newrelic.rb
|
690
761
|
- lib/tasks/newrelicyml.rake
|
691
762
|
- lib/tasks/tests.rake
|
@@ -702,7 +773,6 @@ metadata:
|
|
702
773
|
documentation_uri: https://docs.newrelic.com/docs/agents/ruby-agent
|
703
774
|
source_code_uri: https://github.com/newrelic/newrelic-ruby-agent
|
704
775
|
homepage_uri: https://newrelic.com/ruby
|
705
|
-
post_install_message:
|
706
776
|
rdoc_options: []
|
707
777
|
require_paths:
|
708
778
|
- lib
|
@@ -717,8 +787,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
717
787
|
- !ruby/object:Gem::Version
|
718
788
|
version: 1.3.1
|
719
789
|
requirements: []
|
720
|
-
rubygems_version: 3.
|
721
|
-
signing_key:
|
790
|
+
rubygems_version: 3.6.9
|
722
791
|
specification_version: 4
|
723
792
|
summary: New Relic Ruby Agent
|
724
793
|
test_files: []
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# Instrumentation Generator
|
2
|
-
|
3
|
-
## Usage
|
4
|
-
|
5
|
-
`thor list` can be passed to get a list of all available thor commands
|
6
|
-
|
7
|
-
### instrumentation:scaffold
|
8
|
-
|
9
|
-
This task requires one parameter by default: the name of the library or class you are instrumenting. This task generates the basic file structure needed to add new instrumentation to the Ruby agent.
|
10
|
-
|
11
|
-
Run it using:
|
12
|
-
|
13
|
-
`thor instrumentation:scaffold gem_name`
|
14
|
-
|
15
|
-
It accepts two optional parameters:
|
16
|
-
|
17
|
-
- `--method`: the name of a method to instrument. Only one method can be accepted at this time. Defaults to `method_to_instrument`
|
18
|
-
- `--args`: the arguments for the instrumented method. A comma-separated list can be given if there are multiple arguments. Defaults to `*args`.
|
19
|
-
|
20
|
-
With the optional parameters, the task can be run like so:
|
21
|
-
|
22
|
-
`thor instrumentation:scaffold gem_name --method=method_to_instrument --args=arg1,arg2,arg3`
|
23
|
-
|
24
|
-
### WIP: instrumentation:add_new_method
|
25
|
-
|
26
|
-
Are you trying add instrumentation for a method within library we already instrument? This task is for you! Instead of building the entire scaffold, this task inserts only the changes needed within the `instrumentation.rb` and test files to instrument the new method. It requires one argument, the name of the existing instrumentation to add the method to. If the instrumented library does not already exist, it will create a new scaffold for that library.
|
27
|
-
|
28
|
-
Run it using:
|
29
|
-
|
30
|
-
`thor instrumentation:scaffold gem_name`
|
31
|
-
|
32
|
-
It accepts two optional parameters:
|
33
|
-
|
34
|
-
- `--method`: the name of a method to instrument. Only one method can be accepted at this time. Defaults to `method_to_instrument`
|
35
|
-
- `--args`: the arguments for the instrumented method. A comma-separated list can be given if there are multiple arguments. Defaults to `*args`.
|
36
|
-
|
37
|
-
With the optional parameters, the task can be run like so:
|
38
|
-
|
39
|
-
`thor instrumentation:add_new_method gem_name --method=method_to_instrument --args=arg1,arg2,arg3`
|
40
|
-
|
41
|
-
## Idea
|
42
|
-
|
43
|
-
Create a CLI, similar to Rails’ generators and scaffold scripts, to create the required files and basic classes for instrumenting new libraries. The hope is that the parts of adding new instrumentation that is repetitive can be eliminated and/or reduced so that it takes less time to add new instrumentation and we can spend development time considering the best attributes to collect and interactions to measure. I also hope this project will reduce the overall toil related to adding new instrumentation.
|
44
|
-
|
45
|
-
The files we create with little variation besides library and method names are:
|
46
|
-
|
47
|
-
- Lib
|
48
|
-
- Dependency detection
|
49
|
-
- Chain
|
50
|
-
- Prepend
|
51
|
-
- Instrumentation
|
52
|
-
- Tests
|
53
|
-
- configuration/newrelic.yml
|
54
|
-
- Envfile
|
55
|
-
- Test file
|
56
|
-
|
57
|
-
Furthermore, we also create very similar snippets inside the default source configuration file that could be generated by this project as well.
|
58
|
-
|
59
|
-
## Outcome
|
60
|
-
|
61
|
-
A prototype outside the agent was first created. This prototype generated the required files to add instrumentation. The prototype accepted three arguments: name (name of the library), method (method to instrument), args (arguments for the method). This prototype has evolved into the current directory.
|
62
|
-
|
63
|
-
This project leverages the Ruby gem Thor, a toolkit for building powerful command-line interfaces used in Bundler, Vagrant, Rails and others powers this CLI.
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# TODO
|
2
|
-
|
3
|
-
# - [X] Create instrumentation file
|
4
|
-
|
5
|
-
# - [X] Create chain file
|
6
|
-
|
7
|
-
# - [X] Create prepend file
|
8
|
-
|
9
|
-
# - [X] Create dependency detection file
|
10
|
-
|
11
|
-
# - [X] Add config to default source
|
12
|
-
|
13
|
-
# - [X] Create multiverse suite
|
14
|
-
|
15
|
-
# - [X] Create Envfile
|
16
|
-
|
17
|
-
# - [X] Create test file with examples
|
18
|
-
|
19
|
-
# - [X] Create option for method names to instrument
|
20
|
-
|
21
|
-
# - [X] Add entry to newrelic.yml
|
22
|
-
|
23
|
-
# - [ ] Append a new method to instrument to an existing instrumentation class (with tests?)
|
24
|
-
|
25
|
-
# - [ ] Documentation: examples of what to add in each gap (Good examples of tests, instrumentation, etc. as comments to guide users)
|
26
|
-
|
27
|
-
# - [ ] Handle multi-word gem names (camel case for classes, handle hyphens, concurrent-ruby as example)
|
28
|
-
|
29
|
-
# - [ ] Allow multiple method arguments to be passed to the command line
|
30
|
-
|
31
|
-
# - [ ] Add tests for the instrumentation_generator code
|
32
|
-
|
33
|
-
# - [ ] See if instrumentation PRs can get automatically generated when an already instrumented library adds methods to its codebase
|
@@ -1,121 +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
|
-
@method = options[:method] if options[:method]
|
35
|
-
@args = options[:args] if options[:args]
|
36
|
-
@class_name = ::NewRelic::LanguageSupport.camelize(name)
|
37
|
-
base_path = "#{INSTRUMENTATION_ROOT}#{name.downcase}"
|
38
|
-
|
39
|
-
empty_directory(base_path)
|
40
|
-
create_instrumentation_files(base_path)
|
41
|
-
append_to_default_source(name)
|
42
|
-
append_to_newrelic_yml(name)
|
43
|
-
create_tests(name)
|
44
|
-
end
|
45
|
-
|
46
|
-
desc 'add_new_method NAME', 'Inserts a new method into an existing piece of instrumentation'
|
47
|
-
|
48
|
-
option :method, required: true, desc: 'The name of the method to instrument'
|
49
|
-
option :args, default: '*args', desc: 'The arguments associated with the instrumented method'
|
50
|
-
|
51
|
-
def add_new_method(name, method_name)
|
52
|
-
# Verify that existing instrumentation exists
|
53
|
-
# if it doesn't, should we just call the #scaffold method instead since we have all the stuff
|
54
|
-
# otherwise, inject the new method into the instrumentation matching the first arg
|
55
|
-
# add to only chain, instrumentation, prepend
|
56
|
-
# move the method content to a partial
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def create_instrumentation_files(base_path)
|
62
|
-
%w[chain instrumentation prepend].each do |file|
|
63
|
-
template("templates/#{file}.tt", "#{base_path}/#{file}.rb")
|
64
|
-
end
|
65
|
-
|
66
|
-
template('templates/dependency_detection.tt', "#{base_path}.rb")
|
67
|
-
end
|
68
|
-
|
69
|
-
def create_tests(name)
|
70
|
-
@name = name
|
71
|
-
@instrumentation_method_global_erb_snippet = '<%= $instrumentation_method %>'
|
72
|
-
base_path = "#{MULTIVERSE_SUITE_ROOT}#{@name.downcase}"
|
73
|
-
empty_directory(base_path)
|
74
|
-
template('templates/Envfile.tt', "#{base_path}/Envfile")
|
75
|
-
template('templates/test.tt', "#{base_path}/#{@name.downcase}_instrumentation_test.rb")
|
76
|
-
|
77
|
-
empty_directory("#{base_path}/config")
|
78
|
-
template('templates/newrelic.yml.tt', "#{base_path}/config/newrelic.yml")
|
79
|
-
end
|
80
|
-
|
81
|
-
def append_to_default_source(name)
|
82
|
-
insert_into_file(
|
83
|
-
DEFAULT_SOURCE_LOCATION,
|
84
|
-
config_block(name.downcase),
|
85
|
-
after: ":description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
86
|
-
},\n"
|
87
|
-
)
|
88
|
-
end
|
89
|
-
|
90
|
-
def append_to_newrelic_yml(name)
|
91
|
-
insert_into_file(
|
92
|
-
NEWRELIC_YML_LOCATION,
|
93
|
-
yaml_block(name),
|
94
|
-
after: "# instrumentation.bunny: auto\n"
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
def config_block(name)
|
99
|
-
<<~CONFIG
|
100
|
-
:'instrumentation.#{name.downcase}' => {
|
101
|
-
:default => 'auto',
|
102
|
-
:public => true,
|
103
|
-
:type => String,
|
104
|
-
:dynamic_name => true,
|
105
|
-
:allowed_from_server => false,
|
106
|
-
:description => 'Controls auto-instrumentation of the #{name} library at start-up. May be one of [auto|prepend|chain|disabled].'
|
107
|
-
},
|
108
|
-
CONFIG
|
109
|
-
end
|
110
|
-
|
111
|
-
def yaml_block(name)
|
112
|
-
<<~HEREDOC
|
113
|
-
|
114
|
-
# Controls auto-instrumentation of #{name} at start-up.
|
115
|
-
# May be one of [auto|prepend|chain|disabled]
|
116
|
-
# instrumentation.#{name.downcase}: auto
|
117
|
-
HEREDOC
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
Instrumentation.start(ARGV)
|
@@ -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 '<%= @name.downcase %>/instrumentation'
|
6
|
-
require_relative '<%= @name.downcase %>/chain'
|
7
|
-
require_relative '<%= @name.downcase %>/prepend'
|
8
|
-
|
9
|
-
DependencyDetection.defer do
|
10
|
-
named :<%= @name.match?(/\-|\_/) ? "'#{@name.downcase}'" : @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,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
|
-
<%= @name.downcase %>: <%= @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
|