From d61fda90f25f6825a39cacd9f103e614bc50e33a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Pazos?= Date: Tue, 19 Dec 2023 12:13:01 -0300 Subject: [PATCH] fix server example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolás Pazos --- .../example_write_adapter/server.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/documentation/examples/remote_storage/example_write_adapter/server.go b/documentation/examples/remote_storage/example_write_adapter/server.go index 7c6511b40..bb5235e38 100644 --- a/documentation/examples/remote_storage/example_write_adapter/server.go +++ b/documentation/examples/remote_storage/example_write_adapter/server.go @@ -58,7 +58,7 @@ func main() { }) http.HandleFunc("/receiveMinimized", func(w http.ResponseWriter, r *http.Request) { - req, err := remote.DecodeMinimizedWriteRequest(r.Body) + req, err := remote.DecodeMinimizedWriteRequestStr(r.Body) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return @@ -70,17 +70,12 @@ func main() { for labelIdx < len(ts.LabelSymbols) { // todo, check for overflow? - offset := ts.LabelSymbols[labelIdx] + nameIdx := ts.LabelSymbols[labelIdx] labelIdx++ - length := ts.LabelSymbols[labelIdx] + valueIdx := ts.LabelSymbols[labelIdx] labelIdx++ - name := req.Symbols[offset : offset+length] - // todo, check for overflow? - offset = ts.LabelSymbols[labelIdx] - labelIdx++ - length = ts.LabelSymbols[labelIdx] - labelIdx++ - value := req.Symbols[offset : offset+length] + name := req.Symbols[nameIdx] + value := req.Symbols[valueIdx] m[model.LabelName(name)] = model.LabelValue(value) } fmt.Println(m)