fix: update metrics from sessions started via API (#1531)

fixes https://github.com/containrrr/watchtower/issues/1530
pull/1536/head
Sam Kirsch 2 years ago committed by GitHub
parent c16ac967c5
commit 87c5695e84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.

Loading…
Cancel
Save