Sha256: d7255482e7448fe145a67716998293c63bd3e22bfb937bc9bbec12452a2c4d01

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

# encoding: utf-8
module LogStash
  module Api
    module Modules
      class NodeStats < ::LogStash::Api::Modules::Base
        #set :environment, :test
        #set :dump_errors, true
        #set :raise_errors, true
        #set :logging, Logger.new(STDERR)
        
        
        before do
          @stats = factory.build(:stats)
        end

        # Global _stats resource where all information is
        # retrieved and show
        get "/" do          
          payload = {
            :events => events_payload,
            :jvm => jvm_payload,
            :process => process_payload,
            :mem => mem_payload
          }

          respond_with payload
        end

        # Show all events stats information
        # (for ingested, emitted, dropped)
        # - #events since startup
        # - #data (bytes) since startup
        # - events/s
        # - bytes/s
        # - dropped events/s
        # - events in the pipeline
        get "/events" do
          respond_with({ :events => events_payload })
        end

        get "/jvm" do
          respond_with :jvm => jvm_payload
        end

        get "/process" do
          respond_with :process => process_payload
        end

        get "/mem" do
          respond_with :mem => mem_payload
        end

        get "/pipeline" do
          respond_with :pipeline => pipeline_payload
        end

        private

        def events_payload
          @stats.events
        end

        def jvm_payload
          @stats.jvm
        end

        def process_payload
          @stats.process
        end

        def mem_payload
          @stats.memory
        end

        def pipeline_payload
          @stats.pipeline
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-core-5.0.0.alpha4.snapshot3-java lib/logstash/api/modules/node_stats.rb