lib/kishu/pipeline.rb in kishu-1.0.1 vs lib/kishu/pipeline.rb in kishu-1.0.2

- old
+ new

@@ -1,7 +1,8 @@ require 'faraday' require 'logger' +require 'json' require_relative 'utils' require_relative 'base' module Kishu @@ -15,14 +16,23 @@ def is_ready? main = @conn.get do |req| req.url '/_node/stats/pipelines/main' end - return nil unless main.dig("pipelines","main","events","out") == 0 + response = JSON.parse(main.body) + return nil unless response.dig("pipelines","main","events","out") == 0 end - def is_running? - + def status? + main = @conn.get do |req| + req.url '/_node/stats/pipelines/main' + req.options.timeout = 200 + end + response = JSON.parse(main.body) + puts "Pipeline Status" + puts response.dig("pipelines","main","events") + puts response.dig("pipelines","main","events","in") + puts response.dig("pipelines","main","events","out") end end end