Module: NewRelic::Agent
- Defined in:
- lib/new_relic/agent/agent.rb,
lib/new_relic/shim_agent.rb,
lib/new_relic/agent/synchronize.rb,
lib/new_relic/agent/worker_loop.rb,
lib/new_relic/agent/samplers/cpu.rb,
lib/new_relic/agent/stats_engine.rb,
lib/new_relic/agent/error_collector.rb,
lib/new_relic/agent/samplers/memory.rb,
lib/new_relic/agent/transaction_sampler.rb,
lib/new_relic/agent.rb
Overview
A worker loop executes a set of registered tasks on a single thread.
A task is a proc or block with a specified call period in seconds.
Defined Under Namespace
Modules: CollectionHelper, Instrumentation, Synchronize Classes: Agent, BackgroundLoadingError, CPUSampler, ErrorCollector, ForceDisconnectException, IgnoreSilentlyException, LicenseException, MemorySampler, ServerError, StatsEngine, TransactionSampleBuilder, TransactionSampler, WorkerLoop
Constant Summary collapse
- @@dummy_stats =
NewRelic::MethodTraceStats.new
Class Method Summary collapse
-
.add_custom_parameters(params) ⇒ Object
(also: add_request_parameters)
Add parameters to the current transaction trace.
- .agent ⇒ Object (also: instance)
-
.disable_sql_recording ⇒ Object
This method sets the state of sql recording in the transaction sampler feature.
-
.disable_transaction_tracing ⇒ Object
This method disables the recording of transaction traces in the given block.
-
.get_stats(metric_name, use_scope = false) ⇒ Object
Get or create a statistics gatherer that will aggregate numerical data under a metric name.
- .get_stats_no_scope(metric_name) ⇒ Object
-
.ignore_error_filter(&block) ⇒ Object
This method allows a filter to be applied to errors that RPM will track.
-
.manual_start(environment, identifier) ⇒ Object
Call this to manually start the Agent in situations where the Agent does not auto-start.
-
.set_sql_obfuscator(type = :replace, &block) ⇒ Object
This method sets the block sent to this method as a sql obfuscator.
- .should_ignore_error ⇒ Object
Class Method Details
.add_custom_parameters(params) ⇒ Object Also known as: add_request_parameters
Add parameters to the current transaction trace
125 126 |
# File 'lib/new_relic/agent/agent.rb', line 125 def add_custom_parameters(*args) end |
.agent ⇒ Object Also known as: instance
32 33 34 |
# File 'lib/new_relic/shim_agent.rb', line 32 def agent NewRelic::Agent::Agent.instance end |
.disable_sql_recording ⇒ Object
This method sets the state of sql recording in the transaction sampler feature. Within the given block, no sql will be recorded
usage:
NewRelic::Agent.disable_sql_recording do
...
end
95 96 97 |
# File 'lib/new_relic/agent/agent.rb', line 95 def disable_sql_recording yield end |
.disable_transaction_tracing ⇒ Object
This method disables the recording of transaction traces in the given block.
106 107 108 |
# File 'lib/new_relic/agent/agent.rb', line 106 def disable_transaction_tracing yield end |
.get_stats(metric_name, use_scope = false) ⇒ Object
Get or create a statistics gatherer that will aggregate numerical data under a metric name.
metric_name should follow a slash separated path convention. Application specific metrics should begin with “Custom/”.
the statistical gatherer returned by get_stats accepts data via calls to add_data_point(value)
46 47 48 |
# File 'lib/new_relic/agent/agent.rb', line 46 def get_stats(*args) @@dummy_stats end |
.get_stats_no_scope(metric_name) ⇒ Object
41 42 43 |
# File 'lib/new_relic/shim_agent.rb', line 41 def get_stats_no_scope(*args) @@dummy_stats end |
.ignore_error_filter(&block) ⇒ Object
This method allows a filter to be applied to errors that RPM will track. The block should return the exception to track (which could be different from the original exception) or nil to ignore this exception
119 120 121 |
# File 'lib/new_relic/agent/agent.rb', line 119 def ignore_error_filter(&block) agent.error_collector.ignore_error_filter(&block) end |
.manual_start(environment, identifier) ⇒ Object
Call this to manually start the Agent in situations where the Agent does not auto-start. When the app environment loads, so does the Agent. However, the Agent will only connect to RPM if a web front-end is found. If you want to selectively monitor ruby processes that don’t use web plugins, then call this method in your code and the Agent will fire up and start reporting to RPM.
environment - the name of the environment. used for logging only port - the name of this instance. shows up in the RPM UI screens. can be any String
65 66 |
# File 'lib/new_relic/agent/agent.rb', line 65 def manual_start(*args) end |
.set_sql_obfuscator(type = :replace, &block) ⇒ Object
This method sets the block sent to this method as a sql obfuscator. The block will be called with a single String SQL statement to obfuscate. The method must return the obfuscated String SQL. If chaining of obfuscators is required, use type = :before or :after
type = :before, :replace, :after
example:
NewRelic::Agent.set_sql_obfuscator(:replace) do |sql|
my_obfuscator(sql)
end
81 82 |
# File 'lib/new_relic/agent/agent.rb', line 81 def set_sql_obfuscator(*args) end |
.should_ignore_error ⇒ Object
63 64 |
# File 'lib/new_relic/shim_agent.rb', line 63 def should_ignore_error end |