Module NewRelic::Agent::StatsEngine::MetricStats
In: lib/new_relic/agent/stats_engine/metric_stats.rb

Handles methods related to actual Metric collection @api public

Methods

Constants

SCOPE_PLACEHOLDER = '__SCOPE__'.freeze

Public Instance methods

For use by test code only.

This method is deprecated and not thread safe, and should not be used by any new client code. Use NewRelic::Agent.record_metric instead.

If scoped_metric_only is true, only a scoped metric is created (used by rendering metrics which by definition are per controller only) Leaving second, unused parameter for compatibility

@api public @deprecated Use {::NewRelic::Agent.record_metric} instead.

This method is deprecated and not thread safe, and should not be used by any new client code.

Lookup the Stats object for a given unscoped metric, returning a new Stats object if one did not exist previously.

@api public @deprecated Use {::NewRelic::Agent.record_metric} instead.

merge data from previous harvests into this stats engine

Renamed to reset!, here for backwards compatibility with 3rd-party gems (though this really isn‘t part of the public API). @deprecated

Like tl_record_unscoped_metrics, but records a scoped metric as well.

This is an internal method, subject to change at any time. Client apps and gems should use the public API (NewRelic::Agent.record_metric) instead.

The given scoped_metric will be recoded as both a scoped and an unscoped metric. The summary_metrics will be recorded as unscoped metrics only.

If called during a transaction, all metrics will be attached to the Transaction, and not merged into the global set of metrics until the end of the transaction.

If called outside of a transaction, only the unscoped metrics will be recorded, directly into the global set of metrics (under a lock).

@api private

Helper for recording a straight value into the count

Update the unscoped metrics given in metric_names. metric_names may be either a single name, or an array of names.

This is an internal method, subject to change at any time. Client apps and gems should use the public API (NewRelic::Agent.record_metric) instead.

There are four ways to use this method:

  1. With a numeric value, it will update the Stats objects associated with the given metrics by calling record_data_point(value, aux). aux will be treated in this case as the exclusive time associated with the call being recorded.
  2. With a value of :apdex_s, :apdex_t, or :apdex_f, it will treat the associated stats as an Apdex metric, updating it to reflect the occurrence of a transaction falling into the given category. The aux value in this case should be the apdex threshold used in bucketing the request.
  3. If a block is given, value and aux will be ignored, and instead the Stats object associated with each named unscoped metric will be yielded to the block for customized update logic.
  4. If value is a Stats instance, it will be merged into the Stats associated with each named unscoped metric.

If this method is called during a transaction, the metrics will be attached to the Transaction, and not merged into the global set until the end of the transaction.

Otherwise, the metrics will be recorded directly into the global set of metrics, under a lock.

@api private

For use by test code only.

[Validate]