module Sequel::Plugins::OneapmInstrumentation::MethodTracer
Public Instance Methods
add_method_tracer( method_name, metric=nil, options={} )
click to toggle source
# File lib/sequel/plugins/oneapm_instrumentation.rb, line 25 def add_method_tracer( method_name, metric=nil, options={} ) # Shift options hash if metric is omitted if metric.is_a?( Hash ) options = metric metric = nil end metric ||= method_name.to_s body = make_tracer_method( metric, options ) define_method( method_name, &body ) end
make_tracer_method( opname, options )
click to toggle source
Calls superclass method
# File lib/sequel/plugins/oneapm_instrumentation.rb, line 12 def make_tracer_method( opname, options ) body = Proc.new do |*args, &block| classname = self.is_a?( Class ) ? self.name : self.class.name op_name = OneApm::Agent::Instrumentation::ActiveRecordHelper.rename_for(opname) metrics = OneApm::Agent::Instrumentation::ActiveRecordHelper.metric_for(classname, op_name).compact trace_execution_scoped( metrics, options ) do super( *args, &block ) end end return body end