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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user