Class: Thrift::Metrics::Middleware::Exception

Inherits:
Object
  • Object
show all
Defined in:
lib/thrift/metrics.rb

Class Method Summary collapse

Class Method Details

.instrument(name, &block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/thrift/metrics.rb', line 37

def instrument(name, &block)
  begin
    r = block.call
    Metrics.client.increment("#{name}.success")
    r
  rescue => e
    Metrics.client.increment("#{name}.exceptions.#{e.class.name.downcase}")
    raise e
  end
end