diff --git a/model/converter/json/fixtures/domain_01.json b/model/converter/json/fixtures/domain_01.json index 581d3ffc23c..0193d43f842 100644 --- a/model/converter/json/fixtures/domain_01.json +++ b/model/converter/json/fixtures/domain_01.json @@ -57,6 +57,11 @@ "vType": "FLOAT64", "vFloat64": 72.5 }, + { + "key": "javascript_limit", + "vType": "INT64", + "vInt64": 9223372036854775222 + }, { "key": "blob", "vType": "BINARY", diff --git a/model/converter/json/fixtures/ui_01.json b/model/converter/json/fixtures/ui_01.json index 06a61ddb6c7..7cc55463d36 100644 --- a/model/converter/json/fixtures/ui_01.json +++ b/model/converter/json/fixtures/ui_01.json @@ -62,6 +62,11 @@ "type": "float64", "value": 72.5 }, + { + "key": "javascript_limit", + "type": "int64", + "value": "9223372036854775222" + }, { "key": "blob", "type": "binary", diff --git a/model/converter/json/from_domain.go b/model/converter/json/from_domain.go index 2786b63a6bc..26c2e47d6f0 100644 --- a/model/converter/json/from_domain.go +++ b/model/converter/json/from_domain.go @@ -16,12 +16,18 @@ package json import ( + "fmt" "strings" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/model/json" ) +const ( + jsMaxSafeInteger = int64(1)<<53 - 1 + jsMinSafeInteger = -jsMaxSafeInteger +) + // 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. @@ -122,6 +128,9 @@ func (fd fromDomain) convertKeyValues(keyValues model.KeyValues) []json.KeyValue value = kv.Bool() case model.Int64Type: value = kv.Int64() + if kv.Int64() > jsMaxSafeInteger || kv.Int64() < jsMinSafeInteger { + value = fmt.Sprintf("%d", value) + } case model.Float64Type: value = kv.Float64() case model.BinaryType: