Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Resolves #982 #983

wants to merge 1 commit into from

Conversation

SealinGp
Copy link

avoid value precision loss
Signed-off-by: seazhang [email protected]

Which problem is this PR solving?

Resolves #982

Short description of the changes

  • avoid display value precision loss in case of value overflow Number.MAX_VALUE

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)) {
Copy link
Member

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.

Copy link
Author

@SealinGp SealinGp Aug 23, 2022

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

image

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.

Copy link
Author

@SealinGp SealinGp Aug 23, 2022

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
}
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
Copy link
Member

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

@yurishkuro
Copy link
Member

I believe this needs to be addressed on the server side - jaegertracing/jaeger#3958

@yurishkuro yurishkuro closed this Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: span tags of type int64 may lose precision
2 participants