-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolves #982 #983
Resolves #982 #983
Conversation
avoid value precision loss Signed-off-by: seazhang <[email protected]>
if(tags) { | ||
for(let j = 0; j < tags.length; j++) { | ||
const tag = tags[j] | ||
if(Number.isInteger(tag.value) && !Number.isSafeInteger(tag.value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the type of tag.value at this point? If it's a string, no need to convert, if it's a number then the precision may already be lost. I would've thought the fix needs to be on the server side such that big numeric numbers are sent as strings in JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"if it's number then the precision may already be lost"
but i got the right console output after i converted it to bigint, it confused me.
transform-trace-data.tsx:103 tag.value 780177723283783700 number
transform-trace-data.tsx:107 tag.value convert to big int 780177723283783680 string
api return
{
"key": "xxx_id",
"type": "int64",
"value": 780177723283783680
},
i'll consider output string when it is big numeric numbers. it's a way to solve it after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- should business server side return below data instead
{
"key": "xx_id1",
"type": "int64",
"value": 123
},
{
"key": "xx_id2",
"type": "string",
"value": "780177723283783680"
},
{
"key": "xx_id3",
"type": "int64",
"value": "780177723283783680" // json:"value,string" will be able to do it
}
- or should jaeger json model return value as json string ?
https://github.com/jaegertracing/jaeger/blob/main/model/json/model.go#L100
type KeyValue struct {
Key string `json:"key"`
Type ValueType `json:"type,omitempty"`
Value interface{} `json:"value"` //json output string ?
}
all ways seems to be strange in some logic way 😂
{ | ||
key: "bigintkey", | ||
type: "int64", | ||
value: 780177723283783680 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) this isn't a test by itself since it's not checking anything
b) defining data in code is not equivalent to parsing the data from a JSON
I believe this needs to be addressed on the server side - jaegertracing/jaeger#3958 |
avoid value precision loss
Signed-off-by: seazhang [email protected]
Which problem is this PR solving?
Resolves #982
Short description of the changes