lib/prometheus/client/rack/collector.rb in prometheus-client-mmap-0.7.0.beta2 vs lib/prometheus/client/rack/collector.rb in prometheus-client-mmap-0.7.0.beta3
- old
+ new
@@ -39,10 +39,14 @@
:http_requests_total,
'A counter of the total number of HTTP requests made.',
)
@durations = @registry.summary(
:http_request_duration_seconds,
+ 'A summary of the response latency.',
+ )
+ @durations_hist = @registry.histogram(
+ :http_req_duration_seconds,
'A histogram of the response latency.',
)
end
def init_exception_metrics
@@ -70,11 +74,13 @@
end
def record(labels, duration)
@requests.increment(labels)
@durations.observe(labels, duration)
- rescue
- # TODO: log unexpected exception during request recording
+ @durations_hist.observe(labels, duration)
+ rescue => exception
+ @exceptions.increment(exception: exception.class.name)
+ raise
nil
end
end
end
end