Module: Datadog::Tracing::Contrib::Sinatra::Patcher

Includes:
Patcher
Defined in:
lib/datadog/tracing/contrib/sinatra/patcher.rb

Overview

Patcher enables patching of ‘sinatra’ module.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject



51
52
53
54
55
56
57
# File 'lib/datadog/tracing/contrib/sinatra/patcher.rb', line 51

def patch
  require_relative 'tracer'
  register_tracer

  patch_default_middlewares
  setup_tracer
end

.patch_default_middlewaresObject



68
69
70
# File 'lib/datadog/tracing/contrib/sinatra/patcher.rb', line 68

def patch_default_middlewares
  ::Sinatra::Base.singleton_class.prepend(DefaultMiddlewarePatch)
end

.register_tracerObject



59
60
61
62
# File 'lib/datadog/tracing/contrib/sinatra/patcher.rb', line 59

def register_tracer
  ::Sinatra::Base.register(Contrib::Sinatra::Tracer)
  ::Sinatra::Base.prepend(Sinatra::Tracer::Base)
end

.setup_tracerObject



64
65
66
# File 'lib/datadog/tracing/contrib/sinatra/patcher.rb', line 64

def setup_tracer
  ::Sinatra::Base.singleton_class.prepend(TracerSetupPatch)
end

.target_versionObject



47
48
49
# File 'lib/datadog/tracing/contrib/sinatra/patcher.rb', line 47

def target_version
  Integration.version
end