Sha256: 1317adc29baacfa7fb6689b00e5bb97a621010064276de90d8032b6978fa2176
Contents?: true
Size: 1.11 KB
Versions: 10
Compression:
Stored size: 1.11 KB
Contents
require "grape" module RestFtpDaemon module API class Debug < Grape::API ### HELPERS helpers do def debug_metrics Metrics.sample end def debug_encodings # Encodings encodings = {} jobs = $queue.jobs jobs.each do |job| # here = out[job.id] = {} me = encodings[job.id] = {} me[:error] = job.error.encoding.to_s unless job.error.nil? me[:status] = job.status.encoding.to_s unless job.status.nil? Job::FIELDS.each do |name| value = job.send(name) me[name] = value.encoding.to_s if value.is_a? String end job.infos.each do |name, value| me["infos_#{name}"] = value.encoding.to_s if value.is_a? String end end end end ### ENDPOINTS desc "debug" get "/" do # Build response return { metrics: debug_metrics, routes: RestFtpDaemon::API::Root.routes, encodings: debug_encodings, } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems