Sha256: 51636f4f1cb49cabacd924a7494e15f536cd039b5ec3a0b5d7367fe01e4fdad0

Contents?: true

Size: 1.35 KB

Versions: 23

Compression:

Stored size: 1.35 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
          begin
            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))
          rescue ArgumentError => e
            response = respond_with({"error" => e.message})
            status(400)
            response
          end
        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,
            },
            :os => stats_command.os
          }
          respond_with(payload, {:filter => params["filter"]})
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
logstash-core-6.5.4-java lib/logstash/api/modules/stats.rb
logstash-core-6.5.3-java lib/logstash/api/modules/stats.rb
logstash-core-6.5.2-java lib/logstash/api/modules/stats.rb
logstash-core-6.5.1-java lib/logstash/api/modules/stats.rb
logstash-core-7.0.0.alpha1-java lib/logstash/api/modules/stats.rb
logstash-core-6.5.0-java lib/logstash/api/modules/stats.rb
logstash-core-6.4.3-java lib/logstash/api/modules/stats.rb
logstash-core-6.4.2-java lib/logstash/api/modules/stats.rb
logstash-core-6.4.1-java lib/logstash/api/modules/stats.rb
logstash-core-6.4.0-java lib/logstash/api/modules/stats.rb
logstash-core-6.3.2-java lib/logstash/api/modules/stats.rb
logstash-core-6.3.1-java lib/logstash/api/modules/stats.rb
logstash-core-6.3.0-java lib/logstash/api/modules/stats.rb
logstash-core-6.2.4-java lib/logstash/api/modules/stats.rb
logstash-core-6.2.3-java lib/logstash/api/modules/stats.rb
logstash-core-6.1.4-java lib/logstash/api/modules/stats.rb
logstash-core-6.2.2-java lib/logstash/api/modules/stats.rb
logstash-core-6.2.1-java lib/logstash/api/modules/stats.rb
logstash-core-6.2.0-java lib/logstash/api/modules/stats.rb
logstash-core-6.1.3-java lib/logstash/api/modules/stats.rb