lib/rest-ftp-daemon/api/status.rb in rest-ftp-daemon-0.250.5 vs lib/rest-ftp-daemon/api/status.rb in rest-ftp-daemon-0.300.1

- old
+ new

@@ -2,13 +2,13 @@ module RestFtpDaemon module API class Status < Grape::API + ### ENDPOINTS desc "Show daemon status" get "/" do - mem = GetProcessMem.new status 200 # Get counters counters = $counters.stats.dup @@ -21,27 +21,21 @@ counters[:transferred] = counters[:data][:transferred] || 0 end # Generate sutrcture return { + name: Conf.app_name, + version: Conf.app_ver, + started: Conf.app_started, hostname: `hostname`.to_s.chomp, - version: APP_VER, - - started: APP_STARTED, - uptime: (Time.now - APP_STARTED).round(1), - - memory_bytes: mem.bytes.to_i, - memory_mb: mem.mb.round(0), - - status: $queue.jobs_by_status, jobs_count: $queue.jobs_count, + metrics: Metrics.sample, + counters: counters, - rate_by_pool: $queue.rate_by(:pool), - rate_by_targethost: $queue.rate_by(:targethost), - workers: $pool.worker_variables, + } end end end