From ff7b6cc94e56ccc2952369558383a183fa3700f6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka <bwplotka@gmail.com> Date: Wed, 7 Oct 2020 16:52:44 +0200 Subject: [PATCH] Added Content-Length HTTP header to remote write requests. Tiny change, but as well improve a little bit allocating memory for reading the body. Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com> --- storage/remote/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/remote/client.go b/storage/remote/client.go index 674db6f31e..01d89298f0 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -160,6 +160,7 @@ func (c *Client) Store(ctx context.Context, req []byte) error { } httpReq.Header.Add("Content-Encoding", "snappy") httpReq.Header.Set("Content-Type", "application/x-protobuf") + httpReq.Header.Set("Content-Length", fmt.Sprintf("%v", len(req))) httpReq.Header.Set("User-Agent", UserAgent) httpReq.Header.Set("X-Prometheus-Remote-Write-Version", "0.1.0") ctx, cancel := context.WithTimeout(ctx, c.timeout) -- GitLab