Skip to content

Commit

Permalink
[Bug]: span tags of type int64 may lose precision jaegertracing#3958
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Sawaiker <[email protected]>
  • Loading branch information
shubbham1215 committed Nov 8, 2022
1 parent ff61b0e commit 7567490
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions model/converter/json/fixtures/domain_01.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
"vType": "FLOAT64",
"vFloat64": 72.5
},
{
"key":"javascript_limit",
"vType":"INT64",
"vInt64":9223372036854775222
},
{
"key": "blob",
"vType": "BINARY",
Expand Down
5 changes: 5 additions & 0 deletions model/converter/json/fixtures/ui_01.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"type": "float64",
"value": 72.5
},
{
"key":"javascript_limit",
"vType":"INT64",
"vInt64":9223372036854775222
},
{
"key": "blob",
"type": "binary",
Expand Down
10 changes: 10 additions & 0 deletions model/converter/json/from_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
package json

import (
"fmt"
"strings"

"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/model/json"
)

const (
js_limit_max = 9007199254740991
js_limit_min = -9007199254740991
)

// FromDomain converts model.Trace into json.Trace format.
// It assumes that the domain model is valid, namely that all enums
// have valid values, so that it does not need to check for errors.
Expand Down Expand Up @@ -122,6 +128,10 @@ 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 {
kv.VType = 0
value = fmt.Sprintf("%d", value)
}
case model.Float64Type:
value = kv.Float64()
case model.BinaryType:
Expand Down

0 comments on commit 7567490

Please sign in to comment.