Method: NewRelic::Agent::StatsEngine#record_scoped_and_unscoped_metrics

Defined in:
lib/new_relic/agent/stats_engine.rb

#record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics = nil, value = nil, aux = nil, &blk) ⇒ Object

[View source]

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/new_relic/agent/stats_engine.rb', line 104

def record_scoped_and_unscoped_metrics(state, scoped_metric, summary_metrics = nil, value = nil, aux = nil, &blk)
  txn = state.current_transaction
  if txn
    txn.metrics.record_scoped_and_unscoped(scoped_metric, value, aux, &blk)
    if summary_metrics
      txn.metrics.record_unscoped(summary_metrics, value, aux, &blk)
    end
  else
    specs = coerce_to_metric_spec_array(scoped_metric, nil)
    if summary_metrics
      specs.concat(coerce_to_metric_spec_array(summary_metrics, nil))
    end
    with_stats_lock do
      @stats_hash.record(specs, value, aux, &blk)
    end
  end
end