InfluxDB: Use json-iterator package for json operations (#88562)

* return error early

* enable gzip between grafana and influxdb

* use json-iterator package for json operations

* revert gzip changes

* update test

* go mod tidy
go work sync
This commit is contained in:
ismail simsek
2024-06-06 20:14:53 +03:00
committed by GitHub
parent e21d357d67
commit 808cf75ff8
5 changed files with 39 additions and 27 deletions
+2 -6
View File
@@ -98,18 +98,14 @@ func BuildFrameNameFromQuery(rowName, column string, tags map[string]string, fra
}
func ParseTimestamp(value any) (time.Time, error) {
timestampNumber, ok := value.(json.Number)
timestampNumber, ok := value.(float64)
if !ok {
return time.Time{}, fmt.Errorf("timestamp-value has invalid type: %#v", value)
}
timestampInMilliseconds, err := timestampNumber.Int64()
if err != nil {
return time.Time{}, err
}
// currently in the code the influxdb-timestamps are requested with
// milliseconds-precision, meaning these values are milliseconds
t := time.UnixMilli(timestampInMilliseconds).UTC()
t := time.UnixMilli(int64(timestampNumber)).UTC()
return t, nil
}