Class: LogStash::Api::Commands::Stats
- Inherits:
-
Base
- Object
- Base
- LogStash::Api::Commands::Stats
show all
- Defined in:
- lib/logstash/api/commands/stats.rb
Defined Under Namespace
Modules: PluginsStats
Instance Attribute Summary
Attributes inherited from Base
#service
Instance Method Summary
collapse
Methods inherited from Base
#extract_metrics, #initialize, #started_at, #uptime
Instance Method Details
#events ⇒ Object
41
42
43
44
45
46
|
# File 'lib/logstash/api/commands/stats.rb', line 41
def events
(
[:stats, :events],
:in, :filtered, :out, :duration_in_millis
)
end
|
#gc ⇒ Object
80
81
82
|
# File 'lib/logstash/api/commands/stats.rb', line 80
def gc
service.get_shallow(:jvm, :gc)
end
|
#hot_threads(options = {}) ⇒ Object
84
85
86
|
# File 'lib/logstash/api/commands/stats.rb', line 84
def hot_threads(options={})
HotThreadsReport.new(self, options)
end
|
#jvm ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/logstash/api/commands/stats.rb', line 13
def jvm
{
:threads => (
[:jvm, :threads],
:count,
:peak_count
),
:mem => memory,
:gc => gc,
:uptime_in_millis => service.get_shallow(:jvm, :uptime_in_millis),
}
end
|
#memory ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/logstash/api/commands/stats.rb', line 54
def memory
memory = service.get_shallow(:jvm, :memory)
{
:heap_used_in_bytes => memory[:heap][:used_in_bytes],
:heap_used_percent => memory[:heap][:used_percent],
:heap_committed_in_bytes => memory[:heap][:committed_in_bytes],
:heap_max_in_bytes => memory[:heap][:max_in_bytes],
:heap_used_in_bytes => memory[:heap][:used_in_bytes],
:non_heap_used_in_bytes => memory[:non_heap][:used_in_bytes],
:non_heap_committed_in_bytes => memory[:non_heap][:committed_in_bytes],
:pools => memory[:pools].inject({}) do |acc, (type, hash)|
hash.delete("committed_in_bytes")
acc[type] = hash
acc
end
}
end
|
#os ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/logstash/api/commands/stats.rb', line 72
def os
service.get_shallow(:os)
rescue
{}
end
|
#pipeline(pipeline_id = LogStash::SETTINGS.get("pipeline.id").to_sym) ⇒ Object
48
49
50
51
52
|
# File 'lib/logstash/api/commands/stats.rb', line 48
def pipeline(pipeline_id = LogStash::SETTINGS.get("pipeline.id").to_sym)
stats = service.get_shallow(:stats, :pipelines, pipeline_id)
stats = PluginsStats.report(stats)
stats.merge(:id => pipeline_id)
end
|
#process ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/logstash/api/commands/stats.rb', line 30
def process
(
[:jvm, :process],
:open_file_descriptors,
:peak_open_file_descriptors,
:max_file_descriptors,
[:mem, [:total_virtual_in_bytes]],
[:cpu, [:total_in_millis, :percent, :load_average]]
)
end
|
#reloads ⇒ Object
26
27
28
|
# File 'lib/logstash/api/commands/stats.rb', line 26
def reloads
service.get_shallow(:stats, :reloads)
end
|