From f741a6f172eeef8c73661e1d7f72ea10154cc6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Cendrzak?= Date: Thu, 17 Oct 2024 10:39:29 +0200 Subject: [PATCH] Moved http handler (#9) Co-authored-by: Pawel Cendrzak --- cmd/podman_events_exporter/main.go | 5 +++-- version | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/podman_events_exporter/main.go b/cmd/podman_events_exporter/main.go index 4e4679c..8b565e5 100644 --- a/cmd/podman_events_exporter/main.go +++ b/cmd/podman_events_exporter/main.go @@ -37,6 +37,9 @@ func printBuildData() { } func loop(config *utils.ConfigOpts) { + klog.Infof("Listening on %s/metrics", config.HostWithPort) + http.Handle("/metrics", promhttp.Handler()) + ctx, err := utils.ConnectToPodmanSocket(config.Socket) if err != nil { os.Exit(1) @@ -72,8 +75,6 @@ func loop(config *utils.ConfigOpts) { utils.GetInfoLabels(ctx) go utils.CreateListener(ctx, &eventChan, &exitChan, &breakChan) - klog.Infof("Listening on %s/metrics", config.HostWithPort) - http.Handle("/metrics", promhttp.Handler()) go http.ListenAndServe(config.HostWithPort, nil) for run { diff --git a/version b/version index 845639e..9faa1b7 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.1.4 +0.1.5