Module: FFWD::Reporter
- Included in:
- PluginChannel, Processor::CountProcessor, Processor::HistogramProcessor, Processor::RateProcessor, ProducingClient, TCP::Bind, TCP::FlushingConnect, TCP::PlainConnect, Tunnel::TCP, Tunnel::UDP, UDP::Bind, UDP::Connect
- Defined in:
- lib/ffwd/reporter.rb
Overview
$LICENSE Copyright 2013-2014 Spotify AB. All rights reserved.
The contents of this file are licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(mod) ⇒ Object
41 42 43 |
# File 'lib/ffwd/reporter.rb', line 41 def self.included mod mod.extend ClassMethods end |
.map_meta(meta) ⇒ Object
17 18 19 |
# File 'lib/ffwd/reporter.rb', line 17 def self. Hash[.map{|k, v| [k.to_s, v]}] end |
Instance Method Details
#increment(n, c = 1) ⇒ Object
50 51 52 53 |
# File 'lib/ffwd/reporter.rb', line 50 def increment n, c=1 reporter_data[n] += c reporter_data[:total] += c end |
#report! ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ffwd/reporter.rb', line 55 def report! ||= FFWD::Reporter.( self.class. || send(self.class.)) reporter_data.each do |k, v| yield(:key => k, :value => v, :meta => ) reporter_data[k] = 0 end end |
#reporter_data ⇒ Object
45 46 47 48 |
# File 'lib/ffwd/reporter.rb', line 45 def reporter_data @_reporter_keys ||= self.class.reporter_keys @_reporter_data ||= Hash[@_reporter_keys.map{|k| [k, 0]}] end |