class Norikra::Client::Admin

Public Instance Methods

logs() click to toggle source
# File lib/norikra/client/cli.rb, line 308
def logs
  opt = parent_options
  client = client(parent_options)
  wrap do
    client.logs().each do |time, level, line|
      puts "#{time} [#{level}] #{line}"
    end
  end
end
stats() click to toggle source
# File lib/norikra/client/cli.rb, line 273
def stats
  opt = parent_options
  client = client(parent_options)

  targets = []
  queries = []

  wrap do
    queries = client.queries()

    client.targets().each do |t|
      fields = {}
      client.fields(t['name']).each do |f|
        next if f['type'] == 'hash' || f['type'] == 'array'
        fields[f['name']] = f
      end
      targets.push( { "name" => t['name'], "fields" => fields, "auto_field" => t['auto_field'] } )
    end
  end

  require 'json'

  puts JSON.pretty_generate({
      "threads" => {
        "engine" => { "inbound" => {}, "outbound" => {}, "route_exec" => {}, "timer_exec" => {} },
        "rpc" => {},
        "web" => {},
      },
      "log" => {},
      "targets" => targets,
      "queries" => queries,
    })
end