Module: Datadog::Contrib::Dalli::Patcher
- Includes:
- Patcher
- Defined in:
- lib/ddtrace/contrib/dalli/patcher.rb
Overview
Patcher enables patching of ‘dalli’ module.
Defined Under Namespace
Classes: DeprecatedPin
Class Method Summary collapse
-
.add_pin! ⇒ Object
DEPRECATED: Only kept for users still using ‘Dalli.datadog_pin` to configure.
- .get_option(option) ⇒ Object
- .patch ⇒ Object
- .patched? ⇒ Boolean
Methods included from Patcher
Class Method Details
.add_pin! ⇒ Object
DEPRECATED: Only kept for users still using ‘Dalli.datadog_pin` to configure.
Replaced by configuration API, i.e. `c.use :dalli`.
32 33 34 35 36 37 38 39 40 |
# File 'lib/ddtrace/contrib/dalli/patcher.rb', line 32 def add_pin! DeprecatedPin .new( get_option(:service_name), app: Ext::APP, app_type: Datadog::Ext::AppTypes::CACHE, tracer: get_option(:tracer) ).onto(::Dalli) end |
.get_option(option) ⇒ Object
42 43 44 |
# File 'lib/ddtrace/contrib/dalli/patcher.rb', line 42 def get_option(option) Datadog.configuration[:dalli].get_option(option) end |
.patch ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ddtrace/contrib/dalli/patcher.rb', line 19 def patch do_once(:dalli) do begin add_pin! ::Dalli::Server.send(:include, Instrumentation) rescue StandardError => e Datadog::Tracer.log.error("Unable to apply Dalli integration: #{e}") end end end |
.patched? ⇒ Boolean
15 16 17 |
# File 'lib/ddtrace/contrib/dalli/patcher.rb', line 15 def patched? done?(:dalli) end |