Module: OpenTracing::Instrumented::ClassMethods
- Defined in:
- lib/opentracing/instrumented.rb
Instance Method Summary collapse
-
#traced(*method_names) ⇒ Object
Wraps a method and traces its call.
Instance Method Details
#traced(*method_names) ⇒ Object
Wraps a method and traces its call. The span's operation name will be
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/opentracing/instrumented.rb', line 15 def traced(*method_names) proxy = Module.new method_names.each do |method_name| operation_name = "#{name}.#{method_name}" proxy.define_method(method_name) do |*args, &block| ret = nil OpenTracing.start_active_span(operation_name) do ret = super(*args, &block) end ret end end prepend proxy end |