From 613e56c92a0db2b71426f71324a5396d83310a85 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Wed, 6 Oct 2021 10:37:45 +0100 Subject: [PATCH] Better numpy.datetime64 mathematics --- dockstat.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dockstat.py b/dockstat.py index 66adeef..b2ae33e 100644 --- a/dockstat.py +++ b/dockstat.py @@ -114,15 +114,16 @@ class HTTPHandler(MetricsHandler): alert_threshold = int( data['Config']['Labels'].get('io.prometheus.alert.downtime', 3600) ) - starttime = numpy.datetime64(started_at) + starttime = numpy.datetime64(started_at, 's').astype('long') status_gauge.labels( container.id, container.name, ).set(int(running)) - started_at_gauge.labels(container.id, container.name,).set( - int(int(starttime) / 1000000000) # strip nanoseconds - ) + started_at_gauge.labels( + container.id, + container.name, + ).set(starttime) exit_code_gauge.labels( container.id, container.name,