app/controllers/prosperity/metrics_controller.rb in prosperity-0.0.5 vs app/controllers/prosperity/metrics_controller.rb in prosperity-0.0.6

- old
+ new

@@ -34,17 +34,22 @@ end end end def data - ext_klass = Metric.extractors[params.fetch(:extractor, "interval")] + ext_name = params.fetch(:extractor, "interval") + ext_klass = Metric.extractors.fetch(ext_name) do + render_json_error "Could not find extractor #{ext_name} for #{@metric}. Possible values are #{Metric.extractors.keys.join(", ")}.", 404 + return + end p = Prosperity::Periods::ALL.fetch(period) ext = ext_klass.new(@metric, option, start_time, end_time, p) json = { data: ext.to_a, 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, period_milliseconds: p.duration * 1000 }