From ae3f76bdcf747342f67f837ddc02b924503fbeae Mon Sep 17 00:00:00 2001 From: Shubham Sawaiker Date: Tue, 8 Nov 2022 23:07:38 +0530 Subject: [PATCH] Signed-off-by: Shubham Sawaiker [Bug]: span tags of type int64 may lose precision #3958 Signed-off-by: Shubham Sawaiker --- model/converter/json/from_domain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model/converter/json/from_domain.go b/model/converter/json/from_domain.go index 64fca0d9032..a11cc060eb5 100644 --- a/model/converter/json/from_domain.go +++ b/model/converter/json/from_domain.go @@ -24,8 +24,8 @@ import ( ) const ( - js_limit_max = 9007199254740991 - js_limit_min = -9007199254740991 + jsMaxSafeInteger = int64(1)<<53 - 1 + jsMinSafeInteger = -jsMaxSafeInteger ) // FromDomain converts model.Trace into json.Trace format. @@ -128,7 +128,7 @@ func (fd fromDomain) convertKeyValues(keyValues model.KeyValues) []json.KeyValue value = kv.Bool() case model.Int64Type: value = kv.Int64() - if kv.Int64() > js_limit_max || kv.Int64() < js_limit_min { + if kv.Int64() > jsMaxSafeInteger || kv.Int64() < jsMinSafeInteger { kv.VType = 0 value = fmt.Sprintf("%d", value) }