Skip to content

Commit 257a02c

Browse files
author
Rudolf Vriend
committed
Use millisecond resolution for timers, since the statsd exporter expects it that way and buckets are filled wrong otherwise: https://github.com/prometheus/statsd_exporter/blob/master/exporter.go#L407
1 parent 0d09c7d commit 257a02c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

watcher/watcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ def _start_response_wrapper(status, headers, exc_info=None):
241241
labels.append("status:{0}".format(status_code))
242242
detail_labels.append("status:{0}".format(status_code))
243243

244-
self.metric_client.timing('api_requests_duration_seconds', time.time() - start, tags=labels)
244+
self.metric_client.timing('api_requests_duration_seconds', int(round(1000 * (time.time() - start))),
245+
tags=labels)
245246
self.metric_client.increment('api_requests_total', tags=detail_labels)
246247
except Exception as e:
247248
self.logger.debug("failed to submit metrics for %s: %s" % (str(labels), str(e)))

0 commit comments

Comments
 (0)