Class: SimpleFlow::MiddleWare::Instrumentation
- Inherits:
-
Object
- Object
- SimpleFlow::MiddleWare::Instrumentation
- Defined in:
- lib/simple_flow/middleware.rb
Instance Method Summary collapse
- #call(result) ⇒ Object
-
#initialize(callable, api_key: nil) ⇒ Instrumentation
constructor
A new instance of Instrumentation.
Constructor Details
#initialize(callable, api_key: nil) ⇒ Instrumentation
Returns a new instance of Instrumentation.
23 24 25 |
# File 'lib/simple_flow/middleware.rb', line 23 def initialize(callable, api_key: nil) @callable, @api_key = callable, api_key end |
Instance Method Details
#call(result) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/simple_flow/middleware.rb', line 27 def call(result) start_time = Time.now result = @callable.call(result) duration = Time.now - start_time puts "Instrumentation: #{@api_key} took #{duration}s" result end |