fixed opentsdbListenAddr timestamp conversion (#3810)

Co-authored-by: Andrei Ivanov <a.ivanov@corp.mail.ru>
This commit is contained in:
Droxenator 2023-02-13 18:07:53 +03:00 committed by Aliaksandr Valialkin
parent 253a78b9ab
commit 3961836476
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -174,9 +174,13 @@ func (uw *unmarshalWork) Unmarshal() {
} }
} }
// Convert timestamps from seconds to milliseconds // Convert timestamps in seconds to milliseconds if needed.
// See http://opentsdb.net/docs/javadoc/net/opentsdb/core/Const.html#SECOND_MASK
for i := range rows { for i := range rows {
rows[i].Timestamp *= 1e3 r := &rows[i]
if r.Timestamp&secondMask == 0 {
r.Timestamp *= 1e3
}
} }
// Trim timestamps if required. // Trim timestamps if required.
@ -191,6 +195,8 @@ func (uw *unmarshalWork) Unmarshal() {
putUnmarshalWork(uw) putUnmarshalWork(uw)
} }
const secondMask int64 = 0x7FFFFFFF00000000
func getUnmarshalWork() *unmarshalWork { func getUnmarshalWork() *unmarshalWork {
v := unmarshalWorkPool.Get() v := unmarshalWorkPool.Get()
if v == nil { if v == nil {