Sha256: 01f268815865e5705e27a886700d3275caabea2dc4eecaa4f57bbec4090cb248

Contents?: true

Size: 416 Bytes

Versions: 7

Compression:

Stored size: 416 Bytes

Contents

class PeakFlowUtils::Pings::PostgresConnectionsController < PeakFlowUtils::ApplicationController
  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
peak_flow_utils-0.1.19 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb
peak_flow_utils-0.1.18 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb
peak_flow_utils-0.1.17 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb
peak_flow_utils-0.1.16 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb
peak_flow_utils-0.1.15 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb
peak_flow_utils-0.1.14 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb
peak_flow_utils-0.1.13 app/controllers/peak_flow_utils/pings/postgres_connections_controller.rb