-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,18 @@ export default function transformTraceData(data: TraceData & { spans: SpanData[] | |
const max = data.spans.length; | ||
for (let i = 0; i < max; i++) { | ||
const span: Span = data.spans[i] as Span; | ||
const { startTime, duration, processID } = span; | ||
const { startTime, duration, processID, tags } = span; | ||
|
||
// avoid display value precision loss in case of value overflow Number.MAX_VALUE | ||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
but i got the right console output after i converted it to bigint, it confused me. 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 commentThe reason will be displayed to describe this comment to others. Learn more.
{
"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 😂 |
||
tag.value = BigInt(tag.value).toString(); | ||
} | ||
} | ||
} | ||
|
||
// | ||
let spanID = span.spanID; | ||
// check for start / end time for the trace | ||
|
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