Sha256: 806a7c37fada7890b2b6deb3d88d3a174201cbb61795f1efdf9d47a281c67f92

Contents?: true

Size: 737 Bytes

Versions: 30

Compression:

Stored size: 737 Bytes

Contents

require 'ddtrace/contrib/patcher'

module Datadog
  module Contrib
    module Sinatra
      # Patcher enables patching of 'sinatra' module.
      module Patcher
        include Contrib::Patcher

        module_function

        def patched?
          done?(:sinatra)
        end

        def patch
          do_once(:sinatra) do
            begin
              require 'ddtrace/contrib/sinatra/tracer'
              register_tracer
            rescue StandardError => e
              Datadog::Tracer.log.error("Unable to apply Sinatra integration: #{e}")
            end
          end
        end

        def register_tracer
          ::Sinatra.send(:register, Datadog::Contrib::Sinatra::Tracer)
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
ls-trace-0.1.2 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.29.1 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.26.1 lib/ddtrace/contrib/sinatra/patcher.rb
ls-trace-0.1.1 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.29.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.28.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.27.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.26.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.25.1 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.25.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.24.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.23.3 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.23.2 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.23.1 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.23.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.22.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.21.2 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.21.1 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.21.0 lib/ddtrace/contrib/sinatra/patcher.rb
ddtrace-0.20.0 lib/ddtrace/contrib/sinatra/patcher.rb