tune metrics
This commit is contained in:
parent
4fd84c74fb
commit
efc9864613
|
|
@ -389,10 +389,10 @@ func getLastMetrics(deveui string) OneMetric {
|
|||
url := "http://localhost:8086/api/v2/query?org=wobischorg"
|
||||
data := []byte(fmt.Sprintf(`from(bucket:"wobischbucket")
|
||||
|> range(start:-365d)
|
||||
|> tail(n:10)
|
||||
|> filter(fn: (r) => r._measurement == "measurement" and r.deveui == "%s")
|
||||
|> filter(fn: (r) => r._field == "lon" or r._field == "lat" or r._field == "vbat" or r._field == "fw")
|
||||
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|
||||
|> filter(fn: (r) => r.lon != 0)
|
||||
|> last(column: "_time")`, deveui))
|
||||
|
||||
req, err := http.NewRequest("POST", url, bytes.NewBuffer(data))
|
||||
|
|
@ -429,10 +429,10 @@ func getLastMetrics(deveui string) OneMetric {
|
|||
for scanner.Scan() {
|
||||
s := strings.Split(scanner.Text(), ",")
|
||||
fmt.Printf("BlaBla: %v\n", 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