Class: Pgbus::Api::MetricsController

Inherits:
Pgbus::ApplicationController show all
Defined in:
app/controllers/pgbus/api/metrics_controller.rb

Constant Summary collapse

PROMETHEUS_CONTENT_TYPE =
"text/plain; version=0.0.4; charset=utf-8"

Instance Method Summary collapse

Methods inherited from Pgbus::ApplicationController

#pgbus

Instance Method Details

#showObject



8
9
10
11
12
13
# File 'app/controllers/pgbus/api/metrics_controller.rb', line 8

def show
  return head(:not_found) unless Pgbus.configuration.metrics_enabled

  body = Web::MetricsSerializer.new(data_source).serialize
  render plain: body, content_type: PROMETHEUS_CONTENT_TYPE
end