Class: LitmusPaper::Metric::UnixSocketUtilization
- Inherits:
-
SocketUtilization
- Object
- SocketUtilization
- LitmusPaper::Metric::UnixSocketUtilization
- Defined in:
- lib/litmus_paper/metric/unix_socket_utilization.rb
Instance Attribute Summary collapse
-
#socket_path ⇒ Object
readonly
Returns the value of attribute socket_path.
Attributes inherited from SocketUtilization
Instance Method Summary collapse
- #_stats ⇒ Object
-
#initialize(weight, socket_path, maxconn) ⇒ UnixSocketUtilization
constructor
A new instance of UnixSocketUtilization.
- #to_s ⇒ Object
Methods inherited from SocketUtilization
Constructor Details
#initialize(weight, socket_path, maxconn) ⇒ UnixSocketUtilization
Returns a new instance of UnixSocketUtilization.
8 9 10 11 |
# File 'lib/litmus_paper/metric/unix_socket_utilization.rb', line 8 def initialize(weight, socket_path, maxconn) super(weight, maxconn) @socket_path = socket_path end |
Instance Attribute Details
#socket_path ⇒ Object (readonly)
Returns the value of attribute socket_path.
6 7 8 |
# File 'lib/litmus_paper/metric/unix_socket_utilization.rb', line 6 def socket_path @socket_path end |
Instance Method Details
#_stats ⇒ Object
13 14 15 |
# File 'lib/litmus_paper/metric/unix_socket_utilization.rb', line 13 def _stats Raindrops::Linux.unix_listener_stats([socket_path])[socket_path] end |
#to_s ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/litmus_paper/metric/unix_socket_utilization.rb', line 17 def to_s current_stats = stats active = current_stats[:socket_active] queued = current_stats[:socket_queued] utilization = current_stats[:socket_utilization] "Metric::UnixSocketUtilization(weight: #{weight}, maxconn: #{maxconn}, active: #{active}, queued: #{queued}, utilization: #{utilization}, path: #{socket_path})" end |