Class: Upfluence::Instrumentation::PumaInstrumenter
Constant Summary
collapse
- KEYS =
%i[backlog_thread running_thread busy_thread pool_capacity requests_count].freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
#initialize, #start, #stop
Instance Attribute Details
#server=(value) ⇒ Object
Sets the attribute server
9
10
11
|
# File 'lib/upfluence/instrumentation/puma_instrumenter.rb', line 9
def server=(value)
@server = value
end
|
Instance Method Details
#metrics ⇒ Object
15
16
17
18
19
|
# File 'lib/upfluence/instrumentation/puma_instrumenter.rb', line 15
def metrics
KEYS.reduce({}) do |acc, k|
acc.merge(k => { docstring: "Gauge for #{k}" })
end
end
|
#prefix ⇒ Object
11
12
13
|
# File 'lib/upfluence/instrumentation/puma_instrumenter.rb', line 11
def prefix
'puma'
end
|
#values ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/upfluence/instrumentation/puma_instrumenter.rb', line 21
def values
return {} unless @server
stats = @server.stats
{
requests_count: stats[:requests_count],
backlog_thread: stats[:backlog],
running_thread: stats[:running],
busy_thread: stats[:busy_threads],
pool_capacity: stats[:max_threads]
}.compact.transform_values { |value| [{ value: value }] }
rescue NoMethodError
{}
end
|