Method: NewRelic::Agent::NewRelicService#build_metric_data_array

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

#build_metric_data_array(stats_hash) ⇒ Object

The collector wants to receive metric data in a format that’s different from how we store it internally, so this method handles the translation.

[View source]

134
135
136
137
138
139
140
141
142
143
# File 'lib/new_relic/agent/new_relic_service.rb', line 134

def build_metric_data_array(stats_hash)
  metric_data_array = []
  stats_hash.each do |metric_spec, stats|
    # Omit empty stats as an optimization
    unless stats.is_reset?
      metric_data_array << NewRelic::MetricData.new(metric_spec, stats)
    end
  end
  metric_data_array
end