module Sequel::Plugins::MmtrixInstrumentation::MethodWrapping
Meta-programming for creating method tracers for the Sequel::Model plugin.
Public Instance Methods
wrap_sequel_method(method_name, operation_name=method_name)
click to toggle source
Install a method named method_name
that will trace execution with a metric name derived from operation_name
(or method_name
if operation_name
isn’t specified).
Calls superclass method
# File lib/sequel/plugins/mmtrix_instrumentation.rb, line 21 def wrap_sequel_method(method_name, operation_name=method_name) define_method(method_name) do |*args, &block| klass = self.is_a?(Class) ? self : self.class product = Mmtrix::Agent::Instrumentation::SequelHelper.product_name_from_adapter(db.adapter_scheme) metrics = ::Mmtrix::Agent::Datastores::MetricHelper.metrics_for(product, operation_name, klass.name) Mmtrix::Agent::MethodTracer.trace_execution_scoped(metrics) do Mmtrix::Agent.disable_all_tracing { super(*args, &block) } end end end