From fe970f4df073d1457d04bc0c617a965605d9df7a Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 25 Jul 2022 10:37:04 +0300 Subject: [PATCH] push.go: properly flush compressed metrics to pushURL --- push.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/push.go b/push.go index 31ad9e6..c592ae6 100644 --- a/push.go +++ b/push.go @@ -133,6 +133,9 @@ func InitPushExt(pushURL string, interval time.Duration, extraLabels string, wri if _, err := zw.Write(tmpBuf); err != nil { panic(fmt.Errorf("BUG: cannot write %d bytes to gzip writer: %s", len(tmpBuf), err)) } + if err := zw.Close(); err != nil { + panic(fmt.Errorf("BUG: cannot flush metrics to gzip writer: %s", err)) + } req, err := http.NewRequest("GET", pushURL, &bb) if err != nil { log.Printf("ERROR: metrics.push: cannot initialize request for metrics push to %q: %s", pushURLRedacted, err)