Sha256: a772b1cf4e6c1f717f4649eba98bf1df76e6d9030c2234b8f559309d5aebfc31

Contents?: true

Size: 1.35 KB

Versions: 49

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"] || 10
            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

49 entries across 49 versions & 1 rubygems

Version Path
logstash-core-6.8.23-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.22-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.21-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.20-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.19-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.18-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.17-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.16-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.15-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.14-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.13-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.12-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.11-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.10-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.9-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.8-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.7-java lib/logstash/api/modules/stats.rb
logstash-core-7.5.2-java lib/logstash/api/modules/stats.rb
logstash-core-7.5.1-java lib/logstash/api/modules/stats.rb
logstash-core-6.8.6-java lib/logstash/api/modules/stats.rb