Module: Datadog::Tracing::Contrib::Grape::Patcher

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

Overview

Patcher enables patching of ‘grape’ module.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/datadog/tracing/contrib/grape/patcher.rb', line 22

def patch
  # Patch endpoints
  ::Grape::Endpoint.prepend(Instrumentation::InstanceMethods)
  if target_version < Gem::Version.new('3.0.0')
    ::Grape::Endpoint.singleton_class.prepend(Instrumentation::GenerateApiMethodPatch)
  else
    ::Grape::Endpoint.prepend(Instrumentation::ExecutePatch)
  end

  # Subscribe to ActiveSupport events
  Endpoint.subscribe
end

.target_versionObject



18
19
20
# File 'lib/datadog/tracing/contrib/grape/patcher.rb', line 18

def target_version
  Integration.version
end