From 8fff7ca6e883f45208839f90425ea856af4bb201 Mon Sep 17 00:00:00 2001 From: samkirsch10 Date: Sat, 21 Jan 2023 14:51:35 -0500 Subject: [PATCH] Fix metric updates when invoked via HTTP API --- 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.