From 79ad637d6684d5b075522b91d6620e7940880ef9 Mon Sep 17 00:00:00 2001 From: Friedrich Gonzalez Date: Mon, 6 Nov 2023 09:50:34 +0100 Subject: [PATCH] Include instance label if not present Signed-off-by: Friedrich Gonzalez --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 3fe4be3..669973c 100644 --- a/main.go +++ b/main.go @@ -143,6 +143,9 @@ func federate(ctx context.Context, w http.ResponseWriter, r *http.Request, apiCl func printVector(w http.ResponseWriter, v model.Value) { vec := v.(model.Vector) for _, sample := range vec { + if _, ok := sample.Metric[model.InstanceLabel]; !ok { + sample.Metric[model.InstanceLabel] = "" + } fmt.Fprintf(w, "%v %v %v\n", sample.Metric, sample.Value, int(sample.Timestamp)) } }