Class: Flexirest::Instrumentation
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Flexirest::Instrumentation
- Defined in:
- lib/flexirest/instrumentation.rb
Class Method Summary collapse
- .calls_made ⇒ Object
- .calls_made=(value) ⇒ Object
- .reset ⇒ Object
- .time_spent ⇒ Object
- .time_spent=(value) ⇒ Object
Instance Method Summary collapse
Class Method Details
.calls_made ⇒ Object
22 23 24 |
# File 'lib/flexirest/instrumentation.rb', line 22 def self.calls_made @@calls_made ||= 0 end |
.calls_made=(value) ⇒ Object
18 19 20 |
# File 'lib/flexirest/instrumentation.rb', line 18 def self.calls_made=(value) @@calls_made = value end |
.reset ⇒ Object
26 27 28 29 |
# File 'lib/flexirest/instrumentation.rb', line 26 def self.reset @@time_spent = 0 @@calls_made = 0 end |
.time_spent ⇒ Object
14 15 16 |
# File 'lib/flexirest/instrumentation.rb', line 14 def self.time_spent @@time_spent ||= 0 end |
.time_spent=(value) ⇒ Object
10 11 12 |
# File 'lib/flexirest/instrumentation.rb', line 10 def self.time_spent=(value) @@time_spent = value end |
Instance Method Details
#logger ⇒ Object
31 32 33 |
# File 'lib/flexirest/instrumentation.rb', line 31 def logger Flexirest::Logger end |
#request_call(event) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/flexirest/instrumentation.rb', line 3 def request_call(event) self.class.time_spent += event.duration self.class.calls_made += 1 name = '%s (%.1fms)' % [Flexirest.name, event.duration] Flexirest::Logger.debug " \033[1;4;32m#{name}\033[0m #{event.payload[:name]}" unless event.payload[:quiet] end |