lib/ddtrace/contrib/dalli/instrumentation.rb in ddtrace-0.28.0 vs lib/ddtrace/contrib/dalli/instrumentation.rb in ddtrace-0.29.0
- old
+ new
@@ -7,31 +7,14 @@
module Contrib
module Dalli
# Instruments every interaction with the memcached server
module Instrumentation
def self.included(base)
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
- base.class_eval do
- alias_method :request_without_datadog, :request
- remove_method :request
- include InstanceMethods
- end
- else
- base.send(:prepend, InstanceMethods)
- end
+ base.send(:prepend, InstanceMethods)
end
- # Compatibility shim for Rubies not supporting `.prepend`
- module InstanceMethodsCompatibility
- def request(*args, &block)
- request_without_datadog(*args, &block)
- end
- end
-
# InstanceMethods - implementing instrumentation
module InstanceMethods
- include InstanceMethodsCompatibility unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0.0')
-
def request(op, *args)
tracer.trace(Datadog::Contrib::Dalli::Ext::SPAN_COMMAND) do |span|
span.resource = op.to_s.upcase
span.service = datadog_configuration[:service_name]
span.span_type = Datadog::Contrib::Dalli::Ext::SPAN_TYPE_COMMAND