Sha256: 76d6e53c8ed522715beab8a04315fe0471555fa4e3529d7c64edaa2cd2786e2e

Contents?: true

Size: 1.7 KB

Versions: 34

Compression:

Stored size: 1.7 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic::Agent::Instrumentation
  module Sinatra
    module Chain
      def self.instrument!
        ::Sinatra::Base.class_eval do
          include ::NewRelic::Agent::Instrumentation::Sinatra::Tracer

          def dispatch_with_newrelic
            dispatch_with_tracing { dispatch_without_newrelic }
          end
          alias dispatch_without_newrelic dispatch!
          alias dispatch! dispatch_with_newrelic

          def process_route_with_newrelic(*args, &block)
            process_route_with_tracing(*args) do
              process_route_without_newrelic(*args, &block)
            end
          end
          alias process_route_without_newrelic process_route
          alias process_route process_route_with_newrelic

          def route_eval_with_newrelic(*args, &block)
            route_eval_with_tracing(*args) do
              route_eval_without_newrelic(*args, &block)
            end
          end
          alias route_eval_without_newrelic route_eval
          alias route_eval route_eval_with_newrelic
        end
      end
    end

    module Build
      module Chain
        def self.instrument!
          ::Sinatra::Base.class_eval do
            class << self
              def build_with_newrelic(*args, &block)
                build_with_tracing(*args) do
                  build_without_newrelic(*args, &block)
                end
              end
              alias build_without_newrelic build
              alias build build_with_newrelic
            end
          end
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
newrelic_rpm-9.17.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.16.1 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.16.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.15.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.14.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.13.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.12.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.11.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.10.2 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.10.1 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.10.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.9.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.8.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.7.1 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.7.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.6.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.5.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.4.2 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.4.1 lib/new_relic/agent/instrumentation/sinatra/chain.rb
newrelic_rpm-9.4.0 lib/new_relic/agent/instrumentation/sinatra/chain.rb