Module NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer
In: lib/new_relic/agent/method_tracer.rb

contains methods refactored out of the add_method_tracer method

Methods

Constants

ALLOWED_KEYS = [:force, :metric, :push_scope, :code_header, :code_footer].freeze
DEPRECATED_KEYS = [:force, :scoped_metric_only, :deduct_call_time_from_parent].freeze
DEFAULT_SETTINGS = {:push_scope => true, :metric => true, :code_header => "", :code_footer => "" }.freeze

Public Instance methods

Returns a code snippet to be eval‘d that skips tracing when the agent is not tracing execution. turns instrumentation into effectively one method call overhead when the agent is disabled

raises an error when the NewRelic::Agent::MethodTracer::ClassMethods#add_method_tracer method is called with improper keys. This aids in debugging new instrumentation by failing fast

validity checking - add_method_tracer must receive either push scope or metric, or else it would record no data. Raises an error if this is the case

Decides which code snippet we should be eval‘ing in this context, based on the options.

Default to the class where the method is defined.

Example:

 Foo.default_metric_name_code('bar') #=> "Custom/#{Foo.name}/bar"

returns an eval-able string that contains the tracing code for a fully traced metric including scoping

returns an eval-able string that contains the traced method code used if the agent is not creating a scope for use in scoped metrics.

Checks to see if the method we are attempting to trace actually exists or not. add_method_tracer can‘t do anything if the method doesn‘t exist.

Checks to see if we have already traced a method with a given metric by checking to see if the traced method exists. Warns the user if methods are being double-traced to help with debugging custom instrumentation.

Checks the provided options to make sure that they make sense. Raises an error if the options are incorrect to assist with debugging, so that errors occur at class construction time rather than instrumentation run time

[Validate]