Class: PeakFlowUtils::Pings::PostgresConnectionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb

Instance Method Summary collapse

Instance Method Details

#countObject



2
3
4
5
6
7
8
9
# File 'app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb', line 2

def count
  postgres_connections_count = ActiveRecord::Base.connection.execute("SELECT SUM(numbackends) AS connections_count FROM pg_stat_database").to_a.first

  render json: {
    check_json_status: "OK",
    postgres_connections_count: postgres_connections_count.fetch("connections_count")
  }
end