From 99d56b88157e8630837d057eab548ddba1b35c98 Mon Sep 17 00:00:00 2001 From: Michel Bongard Date: Mon, 28 Feb 2022 16:31:19 +0100 Subject: [PATCH 1/2] Return all properties for TelemetryRequests when no properties are provieded --- influxdb/fetch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/influxdb/fetch.go b/influxdb/fetch.go index bf536d4..38ecaf2 100644 --- a/influxdb/fetch.go +++ b/influxdb/fetch.go @@ -113,6 +113,10 @@ func Fetch(logger *logrus.Entry, request *jagw.TelemetryRequest) []string { } func formatSelection(properties []string) string { + if len(properties) == 0 { + return "*" + } + var b strings.Builder for i, property := range properties { b.Reset() From 39eeead1a576fd31e5ebbe2e08b84858e502493c Mon Sep 17 00:00:00 2001 From: Michel Bongard Date: Mon, 28 Feb 2022 16:38:34 +0100 Subject: [PATCH 2/2] Fixed query string builder --- influxdb/fetch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/influxdb/fetch.go b/influxdb/fetch.go index 38ecaf2..1d483a5 100644 --- a/influxdb/fetch.go +++ b/influxdb/fetch.go @@ -145,10 +145,10 @@ func formatFilters(request *jagw.TelemetryRequest) string { if request.RangeFilter == nil { return b.String() + " limit 1" } else { - if len(request.StringFilters) > 0 { + if b.Len() > 0 { formatRangeFilter(" AND ", &b, request.RangeFilter) } else { - formatRangeFilter(" ", &b, request.RangeFilter) + formatRangeFilter("WHERE ", &b, request.RangeFilter) } return b.String()