field order has changed with influxdb 2.0.8
This commit is contained in:
parent
61f61c474f
commit
a505fc5709
18
metrics.go
18
metrics.go
|
|
@ -164,10 +164,10 @@ func metricsHandler(response http.ResponseWriter, request *http.Request) {
|
|||
for scanner.Scan() {
|
||||
s := strings.Split(scanner.Text(), ",")
|
||||
fmt.Printf("Scanned Line: %v, %d elements\n", s, len(s))
|
||||
if (len(s) >= 12) && !(strings.HasPrefix(s[3], "_")) {
|
||||
t, err := time.Parse(time.RFC3339, s[3])
|
||||
if (len(s) >= 12) && !(strings.HasPrefix(s[5], "_")) {
|
||||
t, err := time.Parse(time.RFC3339, s[5])
|
||||
if err != nil {
|
||||
fmt.Printf("error converting time: %s\n", s[3])
|
||||
fmt.Printf("error converting time: %s\n", s[5])
|
||||
continue
|
||||
}
|
||||
a := t.Unix()
|
||||
|
|
@ -317,7 +317,7 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request)
|
|||
for scanner.Scan() {
|
||||
s := strings.Split(scanner.Text(), ",")
|
||||
fmt.Printf("Scanned Line: %v, elements: %d\n", s, len(s))
|
||||
if (len(s) >= 10) && !(strings.HasPrefix(s[3], "_")) {
|
||||
if (len(s) >= 10) && !(strings.HasPrefix(s[5], "_")) {
|
||||
s_flags := ""
|
||||
lat := s[len(s)-2]
|
||||
lon := s[len(s)-1]
|
||||
|
|
@ -335,9 +335,9 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request)
|
|||
s_flags = s_flags + "+OUTSIDE_GREENZONE"
|
||||
}
|
||||
}
|
||||
t, err := time.Parse(time.RFC3339, s[3])
|
||||
t, err := time.Parse(time.RFC3339, s[5])
|
||||
if err != nil {
|
||||
fmt.Printf("error converting time: %s\n", s[3])
|
||||
fmt.Printf("error converting time: %s\n", s[5])
|
||||
continue
|
||||
}
|
||||
mytime := t.In(location).Format("02.01.2006 15:04")
|
||||
|
|
@ -450,10 +450,10 @@ func getLastMetrics(deveui string) OneMetric {
|
|||
for scanner.Scan() {
|
||||
s := strings.Split(scanner.Text(), ",")
|
||||
fmt.Printf("BlaBla: %v, elements: %d\n", s, len(s))
|
||||
if (len(s) >= 12) && !(strings.HasPrefix(s[3], "_")) {
|
||||
t, err := time.Parse(time.RFC3339, s[3])
|
||||
if (len(s) >= 12) && !(strings.HasPrefix(s[5], "_")) {
|
||||
t, err := time.Parse(time.RFC3339, s[5])
|
||||
if err != nil {
|
||||
fmt.Printf("error converting time: %s\n", s[3])
|
||||
fmt.Printf("error converting time: %s\n", s[5])
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue