module Datadog::DeprecatedPin
Modification to Pin
which logs deprecation warnings if accessed. Will be used by integrations which are phasing out the direct use of datadog_pin
.
Constants
- DEPRECATION_WARNING
Public Instance Methods
datadog_pin()
click to toggle source
# File lib/ddtrace/pin.rb, line 118 def datadog_pin @datadog_deprecated_pin.log_deprecation_warning('#datadog_pin') @datadog_pin end
datadog_pin=(pin)
click to toggle source
# File lib/ddtrace/pin.rb, line 111 def datadog_pin=(pin) @datadog_deprecated_pin.log_deprecation_warning('#datadog_pin=') @datadog_pin = pin end
log_deprecation_warning(method_name)
click to toggle source
# File lib/ddtrace/pin.rb, line 131 def log_deprecation_warning(method_name) # Only log each deprecation warning once (safeguard against log spam) do_once(method_name) do Datadog.logger.warn("#{method_name}:#{DEPRECATION_WARNING}") end end
onto(obj)
click to toggle source
Raise a deprecation warning when datadog_pin
or datadog_pin=
is accessed.
# File lib/ddtrace/pin.rb, line 106 def onto(obj) obj.instance_exec(self) do |pin| @datadog_deprecated_pin = pin unless respond_to? :datadog_pin= def datadog_pin=(pin) @datadog_deprecated_pin.log_deprecation_warning('#datadog_pin=') @datadog_pin = pin end end unless respond_to? :datadog_pin def datadog_pin @datadog_deprecated_pin.log_deprecation_warning('#datadog_pin') @datadog_pin end end # Set instance variable to avoid deprecation warnings @datadog_pin = @datadog_deprecated_pin end self end