Skip to content

Commit

Permalink
Remove excess info-level instrumentation logs (#2881)
Browse files Browse the repository at this point in the history
* Remove duplicate info-level instrumentation logs

The methods `prepend_instrument` and `chain_instrument` eventually produce info-level log statements. Remove duplicate statements.

---------

Co-authored-by: James Bunch <fallwith@gmail.com>
  • Loading branch information
hannahramadan and fallwith authored Oct 4, 2024
1 parent 4bc15dd commit f4f1305
Show file tree
Hide file tree
Showing 32 changed files with 23 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
depends_on { defined?(ActiveSupport::BroadcastLogger) }

executes do
NewRelic::Agent.logger.info('Installing ActiveSupport::BroadcastLogger instrumentation')

if use_prepend?
prepend_instrument ActiveSupport::BroadcastLogger, NewRelic::Agent::Instrumentation::ActiveSupportBroadcastLogger::Prepend
else
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/active_support_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing ActiveSupport::Logger instrumentation')

if use_prepend?
# the only method currently instrumented is a class method
prepend_instrument ActiveSupport::Logger.singleton_class, NewRelic::Agent::Instrumentation::ActiveSupportLogger::Prepend
Expand Down
3 changes: 1 addition & 2 deletions lib/new_relic/agent/instrumentation/async_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
end

executes do
NewRelic::Agent.logger.info('Installing async_http instrumentation')

require 'async/http/internet'

if use_prepend?
prepend_instrument Async::HTTP::Internet, NewRelic::Agent::Instrumentation::AsyncHttp::Prepend
else
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/aws_sqs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing aws-sdk-sqs instrumentation')

if use_prepend?
prepend_instrument Aws::SQS::Client, NewRelic::Agent::Instrumentation::AwsSqs::Prepend
else
Expand Down
7 changes: 3 additions & 4 deletions lib/new_relic/agent/instrumentation/bunny.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
end

executes do
NewRelic::Agent.logger.info('Installing Bunny instrumentation')
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
require 'new_relic/agent/messaging'
require 'new_relic/agent/transaction/message_broker_segment'
end

executes do
if use_prepend?
prepend_instrument Bunny::Exchange, NewRelic::Agent::Instrumentation::Bunny::Prepend::Exchange
prepend_instrument Bunny::Queue, NewRelic::Agent::Instrumentation::Bunny::Prepend::Queue
prepend_instrument Bunny::Consumer, NewRelic::Agent::Instrumentation::Bunny::Prepend::Consumer
prepend_instrument Bunny::Exchange, NewRelic::Agent::Instrumentation::Bunny::Prepend::Exchange, 'Bunny::Exchange'
prepend_instrument Bunny::Queue, NewRelic::Agent::Instrumentation::Bunny::Prepend::Queue, 'Bunny::Queue'
prepend_instrument Bunny::Consumer, NewRelic::Agent::Instrumentation::Bunny::Prepend::Consumer, 'Bunny::Consumer'
else
chain_instrument NewRelic::Agent::Instrumentation::Bunny::Chain
end
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/concurrent_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing concurrent-ruby instrumentation')

if use_prepend?
prepend_instrument(Concurrent::ThreadPoolExecutor, NewRelic::Agent::Instrumentation::ConcurrentRuby::Prepend)

Expand Down
7 changes: 3 additions & 4 deletions lib/new_relic/agent/instrumentation/curb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
end

executes do
NewRelic::Agent.logger.info('Installing Curb instrumentation')
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
require 'new_relic/agent/http_clients/curb_wrappers'
end

executes do
if use_prepend?
prepend_instrument Curl::Easy, NewRelic::Agent::Instrumentation::Curb::Easy::Prepend
prepend_instrument Curl::Multi, NewRelic::Agent::Instrumentation::Curb::Multi::Prepend
prepend_instrument Curl::Easy, NewRelic::Agent::Instrumentation::Curb::Easy::Prepend, 'Curb::Easy'
prepend_instrument Curl::Multi, NewRelic::Agent::Instrumentation::Curb::Multi::Prepend, 'Curb::Multi'
else
chain_instrument NewRelic::Agent::Instrumentation::Curb::Chain
chain_instrument NewRelic::Agent::Instrumentation::Curb::Chain, NewRelic::Agent::Instrumentation::Curb::Multi::INSTRUMENTATION_NAME
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ def method_name(payload_object)
defined?(Delayed) && defined?(Delayed::Worker)
end

executes do
NewRelic::Agent.logger.info('Installing DelayedJob instrumentation [part 1/2]')
end

executes do
if use_prepend?
prepend_instrument Delayed::Worker, NewRelic::Agent::Instrumentation::DelayedJob::Prepend
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/dynamodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing DynamoDB instrumentation')

if use_prepend?
prepend_instrument Aws::DynamoDB::Client, NewRelic::Agent::Instrumentation::DynamoDB::Prepend
else
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/elasticsearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing Elasticsearch instrumentation')

to_instrument = if Gem::Version.create(Elasticsearch::VERSION) < Gem::Version.create('8.0.0')
Elasticsearch::Transport::Client
else
Expand Down
4 changes: 0 additions & 4 deletions lib/new_relic/agent/instrumentation/ethon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
defined?(Ethon) && Gem::Version.new(Ethon::VERSION) >= Gem::Version.new('0.12.0')
end

executes do
NewRelic::Agent.logger.info('Installing ethon instrumentation')
end

executes do
if use_prepend?
# NOTE: by default prepend_instrument will go with the module name that
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/fiber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing Fiber instrumentation')

if use_prepend?
prepend_instrument Fiber, NewRelic::Agent::Instrumentation::MonitoredFiber::Prepend
else
Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent/instrumentation/httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing HTTPClient instrumentation')
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
require 'new_relic/agent/http_clients/httpclient_wrappers'
end
Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent/instrumentation/httprb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing http.rb Wrappers')
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
require 'new_relic/agent/http_clients/http_rb_wrappers'
end
Expand Down
4 changes: 0 additions & 4 deletions lib/new_relic/agent/instrumentation/httpx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
defined?(HTTPX) && Gem::Version.new(HTTPX::VERSION) >= Gem::Version.new('1.0.0')
end

executes do
NewRelic::Agent.logger.info('Installing httpx instrumentation')
end

executes do
if use_prepend?
prepend_instrument HTTPX::Session, NewRelic::Agent::Instrumentation::HTTPX::Prepend
Expand Down
4 changes: 1 addition & 3 deletions lib/new_relic/agent/instrumentation/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
end

executes do
NewRelic::Agent.logger.info('Installing Logger instrumentation')

if use_prepend?
prepend_instrument Logger, NewRelic::Agent::Instrumentation::Logger::Prepend
else
chain_instrument NewRelic::Agent::Instrumentation::Logger
chain_instrument NewRelic::Agent::Instrumentation::Logger, NewRelic::Agent::Instrumentation::Logger::INSTRUMENTATION_NAME
end
end
end
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/logstasher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing LogStasher instrumentation')

if use_prepend?
prepend_instrument LogStasher.singleton_class, NewRelic::Agent::Instrumentation::LogStasher::Prepend
else
Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent/instrumentation/memcache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
depends_on { NewRelic::Agent::Instrumentation::Memcache::DalliCAS.should_instrument? }

executes do
NewRelic::Agent.logger.info('Installing Dalli CAS Client Memcache instrumentation')
if use_prepend?
prepend_module = NewRelic::Agent::Instrumentation::Memcache::Prepend
prepend_module.dalli_cas_prependers do |client_class, instrumenting_module|
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing opensearch-ruby instrumentation')

if use_prepend?
prepend_instrument OpenSearch::Transport::Client, NewRelic::Agent::Instrumentation::OpenSearch::Prepend
else
Expand Down
6 changes: 3 additions & 3 deletions lib/new_relic/agent/instrumentation/padrino.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
depends_on { defined?(Padrino) && defined?(Padrino::Routing::InstanceMethods) }

executes do
NewRelic::Agent.logger.info('Installing Padrino instrumentation')
supportability_name = NewRelic::Agent::Instrumentation::Padrino::INSTRUMENTATION_NAME
if use_prepend?
prepend_instrument Padrino::Application, NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend
prepend_instrument Padrino::Application, NewRelic::Agent::Instrumentation::PadrinoTracer::Prepend, supportability_name
else
chain_instrument NewRelic::Agent::Instrumentation::PadrinoTracer::Chain
chain_instrument NewRelic::Agent::Instrumentation::PadrinoTracer::Chain, supportability_name
end
end
end
1 change: 0 additions & 1 deletion lib/new_relic/agent/instrumentation/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
depends_on { NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }

executes do
NewRelic::Agent.logger.info('Installing Rake instrumentation')
NewRelic::Agent.logger.debug("Instrumenting Rake tasks: #{NewRelic::Agent.config[:'rake.tasks']}")
end

Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/rdkafka.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing rdkafka instrumentation')

require_relative 'rdkafka/instrumentation'
require_relative 'rdkafka/chain'
require_relative 'rdkafka/prepend'
Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent/instrumentation/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing Redis Instrumentation')
if NewRelic::Agent::Instrumentation::Redis::Constants::HAS_REDIS_CLIENT
RedisClient.register(NewRelic::Agent::Instrumentation::RedisClient::Middleware)

Expand Down
4 changes: 0 additions & 4 deletions lib/new_relic/agent/instrumentation/resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
defined?(Airbrake) && defined?(Airbrake::AIRBRAKE_VERSION) && Gem::Version.create(Airbrake::AIRBRAKE_VERSION) < Gem::Version.create('11.0.3')
end

executes do
NewRelic::Agent.logger.info('Installing Resque instrumentation')
end

executes do
if NewRelic::Agent.config[:'resque.use_ruby_dns'] && NewRelic::Agent.config[:dispatcher] == :resque
NewRelic::Agent.logger.info('Requiring resolv-replace')
Expand Down
8 changes: 4 additions & 4 deletions lib/new_relic/agent/instrumentation/roda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
require_relative '../../rack/agent_hooks'
require_relative '../../rack/browser_monitoring'

NewRelic::Agent.logger.info('Installing Roda instrumentation')

if use_prepend?
require_relative 'roda/prepend'
prepend_instrument Roda.singleton_class, NewRelic::Agent::Instrumentation::Roda::Build::Prepend

supportability_name = NewRelic::Agent::Instrumentation::Roda::Tracer::INSTRUMENTATION_NAME
prepend_instrument Roda.singleton_class, NewRelic::Agent::Instrumentation::Roda::Build::Prepend, supportability_name
prepend_instrument Roda, NewRelic::Agent::Instrumentation::Roda::Prepend
else
require_relative 'roda/chain'
chain_instrument NewRelic::Agent::Instrumentation::Roda::Build::Chain
chain_instrument NewRelic::Agent::Instrumentation::Roda::Build::Chain, supportability_name
chain_instrument NewRelic::Agent::Instrumentation::Roda::Chain
end
Roda.class_eval { extend NewRelic::Agent::Instrumentation::Roda::Ignorer }
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/ruby_kafka.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing ruby-kafka instrumentation')

if use_prepend?
prepend_instrument Kafka::Producer, NewRelic::Agent::Instrumentation::RubyKafkaProducer::Prepend
prepend_instrument Kafka::Consumer, NewRelic::Agent::Instrumentation::RubyKafkaConsumer::Prepend
Expand Down
9 changes: 3 additions & 6 deletions lib/new_relic/agent/instrumentation/sinatra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
depends_on { Sinatra::Base.private_method_defined?(:process_route) }
depends_on { Sinatra::Base.private_method_defined?(:route_eval) }

executes do
NewRelic::Agent.logger.info('Installing Sinatra instrumentation')
end

executes do
if use_prepend?
prepend_instrument Sinatra::Base, NewRelic::Agent::Instrumentation::Sinatra::Prepend
Expand All @@ -32,14 +28,15 @@
end

executes do
supportability_name = NewRelic::Agent::Instrumentation::Sinatra::Tracer::INSTRUMENTATION_NAME
# These requires are inside an executes block because they require rack, and
# we can't be sure that rack is available when this file is first required.
require 'new_relic/rack/agent_hooks'
require 'new_relic/rack/browser_monitoring'
if use_prepend?
prepend_instrument Sinatra::Base.singleton_class, NewRelic::Agent::Instrumentation::Sinatra::Build::Prepend
prepend_instrument Sinatra::Base.singleton_class, NewRelic::Agent::Instrumentation::Sinatra::Build::Prepend, supportability_name
else
chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Build::Chain
chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Build::Chain, supportability_name
end
end
end
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
named :thread

executes do
NewRelic::Agent.logger.info('Installing Thread Instrumentation')

if use_prepend?
prepend_instrument Thread, NewRelic::Agent::Instrumentation::MonitoredThread::Prepend
else
Expand Down
4 changes: 0 additions & 4 deletions lib/new_relic/agent/instrumentation/tilt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

depends_on { defined?(Tilt) }

executes do
NewRelic::Agent.logger.info('Installing Tilt instrumentation')
end

executes do
if use_prepend?
prepend_instrument Tilt::Template, NewRelic::Agent::Instrumentation::Tilt::Prepend
Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent/instrumentation/typhoeus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing Typhoeus instrumentation')
require 'new_relic/agent/distributed_tracing/cross_app_tracing'
require 'new_relic/agent/http_clients/typhoeus_wrappers'
end
Expand Down
2 changes: 0 additions & 2 deletions lib/new_relic/agent/instrumentation/view_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
end

executes do
NewRelic::Agent.logger.info('Installing ViewComponent instrumentation')

if use_prepend?
prepend_instrument ViewComponent::Base, NewRelic::Agent::Instrumentation::ViewComponent::Prepend
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ DependencyDetection.defer do
end

executes do
NewRelic::Agent.logger.info('Installing <%= @name.downcase %> instrumentation')

# prepend_instrument and chain_instrument call extract_supportability_name
# to get the library name for supportability metrics and info-level logging.
# This is done by spliting on the 2nd to last spot of the instrumented
# module. If this isn't how we want the name to appear, pass in the desired
# name as a third argument.
if use_prepend?
prepend_instrument <%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
else
Expand Down

0 comments on commit f4f1305

Please sign in to comment.