app/controllers/prosperity/metrics_controller.rb in prosperity-0.0.8 vs app/controllers/prosperity/metrics_controller.rb in prosperity-0.0.9

- old
+ new

@@ -43,11 +43,19 @@ end p = Prosperity::Periods::ALL.fetch(period) ext = ext_klass.new(@metric, option, start_time, end_time, p) + data = begin + ext.to_a + rescue => e + logger.error "#{e}\n#{e.backtrace.join("\n")}" + render_json_error "An exception occured while retrieving data from #{@metric}. #{e}" + return + end + json = { - data: ext.to_a, + data: data, key: ext.key, uid: ext.uid, label: ext.label, start_time: p.actual_start_time(start_time).iso8601, end_time: p.actual_end_time(end_time).iso8601,