Class: Thrifter::InstrumentedPool
- Inherits:
-
ConnectionPool
- Object
- ConnectionPool
- Thrifter::InstrumentedPool
- Defined in:
- lib/thrifter/instrumented_pool.rb
Instance Attribute Summary collapse
-
#statsd ⇒ Object
readonly
Returns the value of attribute statsd.
Instance Method Summary collapse
- #checkin(*args) ⇒ Object
- #checkout(*args) ⇒ Object
-
#initialize(options = { }, &block) ⇒ InstrumentedPool
constructor
A new instance of InstrumentedPool.
Constructor Details
#initialize(options = { }, &block) ⇒ InstrumentedPool
Returns a new instance of InstrumentedPool.
5 6 7 8 |
# File 'lib/thrifter/instrumented_pool.rb', line 5 def initialize( = { }, &block) super(, &block) @statsd = .fetch(:statsd) end |
Instance Attribute Details
#statsd ⇒ Object (readonly)
Returns the value of attribute statsd.
3 4 5 |
# File 'lib/thrifter/instrumented_pool.rb', line 3 def statsd @statsd end |
Instance Method Details
#checkin(*args) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/thrifter/instrumented_pool.rb', line 23 def checkin(*args) super.tap do statsd.increment('thread_pool.checkin') statsd.gauge('thread_pool.in_use', in_use) end end |
#checkout(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/thrifter/instrumented_pool.rb', line 10 def checkout(*args) statsd.gauge('thread_pool.size', @size) statsd.time('thread_pool.latency') do super.tap do |conn| statsd.increment('thread_pool.checkout') statsd.gauge('thread_pool.in_use', in_use) end end rescue Timeout::Error => ex statsd.increment('thread_pool.timeout') raise ex end |