module ScoutApm::Tracer
Public Class Methods
Source
# File lib/scout_apm/tracer.rb, line 11 def self.included(klass) klass.extend ClassMethods end
Source
# File lib/scout_apm/tracer.rb, line 24 def self.instrument(type, name, options={}) # Takes a block layer = ScoutApm::Layer.new(type, name) layer.desc = options[:desc] if options[:desc] layer.subscopable! if options[:scope] req = ScoutApm::RequestManager.lookup req.start_layer(layer) req.ignore_children! if options[:ignore_children] begin yield ensure req.acknowledge_children! if options[:ignore_children] req.stop_layer end end
Type: the Layer
type - “View” or similar Name: specific name - “users/_gravatar”. The object must respond to “#to_s”. This allows us to be more efficient - in most cases, the metric name isn’t needed unless we are processing a slow transaction. A Block: The code to be instrumented
Options:
-
:ignore_children - will not instrument any method calls beneath this call. Example use case: InfluxDB uses Net::HTTP, which is instrumented. However, we can provide more specific data if we know we’re doing an influx call, so we’d rather just instrument the Influx call and ignore Net::HTTP. when rendering the transaction tree in the UI.
-
:desc - Additional capture, SQL, or HTTP url or similar
-
:scope - set to true if you want to make this layer a subscope