From 236500468325c71b2c795fca4c31158329360786 Mon Sep 17 00:00:00 2001
From: Tom Wilkie <tom.wilkie@gmail.com>
Date: Tue, 5 Feb 2019 19:27:03 +0000
Subject: [PATCH] Explicty encode the chunk.

I broke this when I updated the vendored Cortex, which includes https://github.com/cortexproject/cortex/commit/ac653065193fc9f9b91d0a3da38886cd20b816e5#diff-42196489d8c6339357699ab3656cb2e1R315.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
---
 pkg/ingester/flush.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pkg/ingester/flush.go b/pkg/ingester/flush.go
index 23a7d27a..ead1217a 100644
--- a/pkg/ingester/flush.go
+++ b/pkg/ingester/flush.go
@@ -221,12 +221,17 @@ func (i *Ingester) flushChunks(ctx context.Context, fp model.Fingerprint, labelP
 	wireChunks := make([]chunk.Chunk, 0, len(cs))
 	for _, c := range cs {
 		firstTime, lastTime := c.chunk.Bounds()
-		wireChunks = append(wireChunks, chunk.NewChunk(
+		c := chunk.NewChunk(
 			userID, fp, metric,
 			chunkenc.NewFacade(c.chunk),
 			model.TimeFromUnixNano(firstTime.UnixNano()),
 			model.TimeFromUnixNano(lastTime.UnixNano()),
-		))
+		)
+
+		if err := c.Encode(); err != nil {
+			return err
+		}
+		wireChunks = append(wireChunks, c)
 	}
 
 	return i.store.Put(ctx, wireChunks)
-- 
GitLab