Class: PrometheusExporter::Instrumentation::Hutch
- Inherits:
-
Object
- Object
- PrometheusExporter::Instrumentation::Hutch
- Defined in:
- lib/prometheus_exporter/instrumentation/hutch.rb
Instance Method Summary collapse
- #handle(message) ⇒ Object
-
#initialize(klass) ⇒ Hutch
constructor
A new instance of Hutch.
Constructor Details
#initialize(klass) ⇒ Hutch
Returns a new instance of Hutch.
5 6 7 8 |
# File 'lib/prometheus_exporter/instrumentation/hutch.rb', line 5 def initialize(klass) @klass = klass @client = PrometheusExporter::Client.default end |
Instance Method Details
#handle(message) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/prometheus_exporter/instrumentation/hutch.rb', line 10 def handle() success = false start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) result = @klass.process() success = true result ensure duration = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start @client.send_json( type: "hutch", name: @klass.class.to_s, success: success, duration: duration, ) end |