feat: support for ns,ms,us,s in lineprotol

This commit is contained in:
Aditya Ujeniya
2024-11-20 13:58:49 +01:00
parent 2d510b2890
commit bab4295a83
3 changed files with 26 additions and 1 deletions

View File

@@ -313,7 +313,20 @@ func decodeLine(dec *lineprotocol.Decoder,
}
if t, err = dec.Time(lineprotocol.Second, t); err != nil {
return fmt.Errorf("timestamp : %#v with error : %#v", lineprotocol.Second, err.Error())
t = time.Now()
if t, err = dec.Time(lineprotocol.Millisecond, t); err != nil {
t = time.Now()
if t, err = dec.Time(lineprotocol.Microsecond, t); err != nil {
t = time.Now()
if t, err = dec.Time(lineprotocol.Nanosecond, t); err != nil {
return fmt.Errorf("timestamp : %#v with error : %#v", t, err.Error())
}
}
}
}
if err != nil {
return fmt.Errorf("timestamp : %#v with error : %#v", t, err.Error())
}
if err := ms.WriteToLevel(lvl, selector, t.Unix(), []memorystore.Metric{metric}); err != nil {