Class: Salemove::ProcessHandler::PivotProcess::Benchmarker
- Inherits:
-
Object
- Object
- Salemove::ProcessHandler::PivotProcess::Benchmarker
- Defined in:
- lib/salemove/process_handler/pivot_process.rb
Instance Method Summary collapse
- #call(input, &block) ⇒ Object
-
#initialize(statsd:, application:, execution_time_key:) ⇒ Benchmarker
constructor
A new instance of Benchmarker.
Constructor Details
#initialize(statsd:, application:, execution_time_key:) ⇒ Benchmarker
Returns a new instance of Benchmarker.
211 212 213 214 215 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 211 def initialize(statsd:, application:, execution_time_key:) @statsd = statsd @application = application @execution_time_key = execution_time_key end |
Instance Method Details
#call(input, &block) ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 217 def call(input, &block) type = input[:type] if input.is_a?(Hash) result = nil bm = Benchmark.measure { result = block.call } @statsd.histogram(@execution_time_key, bm.real, tags: [ "application:#{@application}", "type:#{type || 'unknown'}" ]) result end |