From 87c5695e845f6c35af8ddb1b828ffca75571b490 Mon Sep 17 00:00:00 2001 From: Sam Kirsch Date: Sun, 22 Jan 2023 03:03:45 -0500 Subject: [PATCH] fix: update metrics from sessions started via API (#1531) fixes https://github.com/containrrr/watchtower/issues/1530 --- cmd/root.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 8e20b95..dbb7e89 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -182,7 +182,10 @@ func Run(c *cobra.Command, names []string) { httpAPI := api.New(apiToken) if enableUpdateAPI { - updateHandler := update.New(func(images []string) { runUpdatesWithNotifications(filters.FilterByImage(images, filter)) }, updateLock) + updateHandler := update.New(func(images []string) { + metric := runUpdatesWithNotifications(filters.FilterByImage(images, filter)) + metrics.RegisterScan(metric) + }, updateLock) httpAPI.RegisterFunc(updateHandler.Path, updateHandler.Handle) // If polling isn't enabled the scheduler is never started and // we need to trigger the startup messages manually.