Class: Mayu::Metrics::Collector::Server
- Inherits:
-
Object
- Object
- Mayu::Metrics::Collector::Server
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/metrics/collector.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Method Summary collapse
- #all_values(metric_name) ⇒ Object
-
#initialize(endpoint) ⇒ Server
constructor
A new instance of Server.
- #run(internal_store, name: self.class.name.to_s, restart: true) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(endpoint) ⇒ Server
107 108 109 |
# File 'lib/mayu/metrics/collector.rb', line 107 def initialize(endpoint) @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
104 105 106 |
# File 'lib/mayu/metrics/collector.rb', line 104 def endpoint @endpoint end |
Instance Method Details
#all_values(metric_name) ⇒ Object
112 113 114 |
# File 'lib/mayu/metrics/collector.rb', line 112 def all_values(metric_name) raise NotImplementedError, "Should this even be implemented?" end |
#run(internal_store, name: self.class.name.to_s, restart: true) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/mayu/metrics/collector.rb', line 131 def run(internal_store, name: self.class.name.to_s, restart: true) wrapper = Wrapper.new Console.logger.info( self, "Starting metrics collection on #{File.expand_path(@endpoint.path)}" ) @endpoint.accept do |peer| store = internal_store.store(peer, {}) unpacker = wrapper.unpacker(peer) unpacker.each do || case in [:store, data] store.merge!(data) else Console .logger .warn(self) { "Unhandled mesage: #{message.inspect}" } end end ensure internal_store.delete(peer) end end |
#start ⇒ Object
117 118 |
# File 'lib/mayu/metrics/collector.rb', line 117 def start end |
#stop ⇒ Object
121 122 |
# File 'lib/mayu/metrics/collector.rb', line 121 def stop end |