module NewRelic
@api public
This class applies filtering rules as specified in the Agent Attributes cross-agent spec.
Instances of it are constructed by deriving a set of rules from the agent configuration. Instances are immutable once they are constructed - if the config changes, a new instance should be constructed and swapped in to replace the existing one.
The apply method is the main external interface of this class. It takes an attribute name and a set of default destinations (represented as a bitfield) and returns a set of actual destinations after applying the filtering rules specified in the config.
Each set of destinations is represented as a bitfield, where the bit positions specified in the DST_* constants are used to indicate whether an attribute should be sent to the corresponding destination.
The choice of a bitfield here rather than an Array was made to avoid the need for any transient object allocations during the application of rules. Since rule application will happen once per attribute per transaction, this is a hot code path.
The algorithm for applying filtering rules is as follows:
-
Start with a bitfield representing the set of default destinations passed in to apply.
-
Mask this bitfield against the set of destinations that have attribute enabled at all.
-
Traverse the list of rules in order (more on the ordering later), applying each matching rule, but taking care to not let rules override the enabled status of each destination. Each matching rule may mutate the bitfield.
-
Return the resulting bitfield after all rules have been applied.
Each rule consists of a name, a flag indicating whether it ends with a wildcard, a bitfield representing the set of destinations that it applies to, and a flag specifying whether it is an include or exclude rule.
During construction, rules are sorted according to the following criteria:
-
First, the names are compared lexicographically. This has the impact of forcing shorter (more general) rules towards the top of the list and longer (more specific) rules towards the bottom. This is important, because the Agent Attributes spec stipulates that the most specific rule for a given destination should take precedence. Since rules are applied top-to-bottom, this sorting guarantees that the most specific rule will be applied last.
-
If the names are identical, we next examine the wildcard flag. Rules ending with a wildcard are considered more general (and thus 'less than') rules not ending with a wildcard.
-
If the names and wildcard flags are identical, we next examine whether the rules being compared are include or exclude rules. Exclude rules have precedence by the spec, so they are considered 'greater than' include rules.
This approach to rule evaluation was taken from the PHP agent's implementation.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
The agent's configuration is accessed through a configuration object exposed by NewRelic::Agent#config. It provides a hash like interface to the agent's settings.
For example: NewRelic::Agent#config determines whether transaction tracing is enabled. String and symbol keys are treated indifferently and nested keys are collapsed and concatenated with a dot (i.e. {:a => {:b => 'c'} becomes { 'a.b' => 'c'}).
The agent reads configuration from a variety of sources. These sources are modeled as a set of layers. The top layer has the highest priority. If the top layer does not contain the requested setting the config object will search through the subsequent layers returning the first value it finds.
Configuration layers include EnvironmentSource (which reads settings from ENV), ServerSource (which reads Server Side Config from New Relic's servers), YamlSource (which reads from newrelic.yml), ManualSource (which reads arguments passed to NewRelic::Agent#manual_start or potentially other methods), and Defaults (which contains default settings).
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
encoding: utf-8 This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This module was extracted from NewRelic::JSONWrapper
encoding: utf-8 This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
EventBuffer is intended to be an abstract base class. It should not be instantiated directly. Subclasses should define an `append_event` method looking something like this:
def append_event(x)
<attempt to append> if append_success? return x else return nil end
end
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This module includes utilities for manipulating URIs, particularly from the context of Net::HTTP requests. We don't always have direct access to the full URI from our instrumentation points in Net::HTTP, and we want to filter out some URI parts before saving URIs from instrumented calls - logic for that lives here.
This class serves as the base for objects wanting to monitor and respond to incoming web requests. Examples include cross application tracing and synthetics.
Subclasses are expected to define on_finished_configuring(events) which will be called when the agent is fully configured. That method is expected to subscribe to the necessary request events, such as before_call and after_call for the monitor to do its work.
Listen for ActiveSupport::Notifications events for ActionView render events. Write metric data and transaction trace nodes for each event.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
Listen for ActiveSupport::Notifications events for ActiveRecord query events. Write metric data, transaction trace nodes and slow sql nodes for each event.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This module is intended to be included into both MiddlewareProxy and our internal middleware classes.
Host classes must define two methods:
-
target: returns the original middleware being traced
-
category: returns the category for the resulting agent transaction
should be either :middleware or :rack
-
transaction_options: returns an options hash to be passed to
Transaction.start when tracing this middleware.
The target may be self, in which case the host class should define a traced_call method, instead of the usual call.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This is the base class for all errors that we want to record through the NewRelic::Agent::ErrorCollector#notice_agent_error API. It provides the standard support text at the front of the message, and is used for flagging agent errors when checking queue limits.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
A stub object that we can use in place of a real Logger instance when the agent is disabled.
require 'base64'
This file is distributed under New Relic“s license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
encoding: utf-8 This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
A Sampler is used to capture meaningful metrics in a background thread periodically. They will be invoked about once a minute, each time the agent sends data to New Relic's servers.
Samplers can be added to New Relic by subclassing NewRelic::Agent::Sampler. Instances are created when the agent is enabled and installed. Subclasses are registered for instantiation automatically.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
-*- coding: utf-8 -*-
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
Data structure for representing a thread profile
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This class represents a set of metrics that were recorded during a single transaction. Since the name of the transaction is not known until its end, we don't save explicit scopes with these metrics, we just keep separate collections of scoped and unscoped metrics.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
The GC::Profiler class available on MRI has to be reset periodically to avoid memory “leaking” in the underlying implementation. However, it's a major bummer for how we want to gather those statistics.
This class comes to the rescue. It relies on being the only party to reset the underlying GC::Profiler, but otherwise gives us a steadily increasing total time.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
GITSHA: d9342d09094b10a22151ad547c8adb5c92b6b4ef
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
Some parts adapted from golang.org/src/pkg/json/decode.go and golang.org/src/pkg/utf8/utf8.go
@api public
summarizes performance data for all calls to segments with the same metric_name
This file is distributed under New Relic's license terms. See github.com/newrelic/rpm/blob/master/LICENSE for complete details.
Constants
- MYSQL_EXPLAIN_COLUMNS
columns for a mysql explain plan