Sha256: 6040d03c7ea1d510c8d651cacb7cfcba91d79522e1e5e1660eb128e87603d581
Contents?: true
Size: 1.84 KB
Versions: 10
Compression:
Stored size: 1.84 KB
Contents
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. require_relative 'sinatra/transaction_namer' require_relative 'sinatra/ignorer' require_relative 'sinatra/instrumentation' require_relative 'sinatra/chain' require_relative 'sinatra/prepend' DependencyDetection.defer do named :sinatra depends_on { defined?(::Sinatra) && defined?(::Sinatra::Base) } depends_on { Sinatra::Base.private_method_defined?(:dispatch!) } 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 else chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Chain end ::Sinatra::Base.class_eval { register ::NewRelic::Agent::Instrumentation::Sinatra::Ignorer } ::Sinatra.module_eval { register NewRelic::Agent::Instrumentation::Sinatra::Ignorer } end executes do if Sinatra::Base.respond_to?(:build) # 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 else chain_instrument NewRelic::Agent::Instrumentation::Sinatra::Build::Chain end else ::NewRelic::Agent.logger.info("Skipping auto-injection of middleware for Sinatra - requires Sinatra 1.2.1+") end end end
Version data entries
10 entries across 10 versions & 1 rubygems