Class: Anomonitor::MetricsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/anomonitor/metrics_controller.rb

Instance Method Summary collapse

Instance Method Details

#export_jsonObject



9
10
11
# File 'app/controllers/anomonitor/metrics_controller.rb', line 9

def export_json
  render json: MetricsExport.json_payload
end

#export_prometheusObject



13
14
15
16
# File 'app/controllers/anomonitor/metrics_controller.rb', line 13

def export_prometheus
  render plain: MetricsExport.prometheus_text,
         content_type: "text/plain; version=0.0.4; charset=utf-8"
end

#indexObject



5
6
7
# File 'app/controllers/anomonitor/metrics_controller.rb', line 5

def index
  @metrics = MetricSample.recent(24).order(sampled_at: :desc).limit(200)
end