Sha256: 4179c7ca38f71831bbf907ae35a1d21a72143551715c7cecde6dfbd3c543e233

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8
module LogStash
  module Api
    module Modules
      class Stats < ::LogStash::Api::Modules::Base

        def stats_command
          factory.build(:stats)
        end

        # return hot threads information
        get "/jvm/hot_threads" do
          top_threads_count = params["threads"] || 3
          ignore_idle_threads = params["ignore_idle_threads"] || true
          options = {
            :threads => top_threads_count.to_i,
            :ignore_idle_threads => as_boolean(ignore_idle_threads)
          }

          respond_with(stats_command.hot_threads(options))
        end

        # return hot threads information
        get "/jvm/memory" do
          respond_with({ :memory => stats_command.memory })
        end

        get "/?:filter?" do
          payload = {
            :events => stats_command.events,
            :jvm => {
              :timestamp => stats_command.started_at,
              :uptime_in_millis => stats_command.uptime,
              :memory => stats_command.memory
            }
          }
          respond_with(payload, {:filter => params["filter"]})
        end

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-base64-1.0.4 vendor/bundle/jruby/2.2.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-base64-1.0.3 vendor/bundle/jruby/2.2.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-delta-1.0.0 vendor/bundle/jruby/2.2.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-base64-1.0.2 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-base64-1.0.1 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-filter-base64-1.0.0 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.0.0.alpha6.snapshot5-java/lib/logstash/api/modules/stats.rb
logstash-core-5.0.0.alpha6.snapshot5-java lib/logstash/api/modules/stats.rb
logstash-core-5.0.0.alpha6.snapshot4-java lib/logstash/api/modules/stats.rb
logstash-core-5.0.0.alpha6.snapshot3-java lib/logstash/api/modules/stats.rb
logstash-core-5.0.0.alpha6.snapshot2-java lib/logstash/api/modules/stats.rb
logstash-core-5.0.0.alpha6.snapshot1-java lib/logstash/api/modules/stats.rb
logstash-core-5.0.0.alpha5.snapshot1-java lib/logstash/api/modules/stats.rb