sentry icon indicating copy to clipboard operation
sentry copied to clipboard

Long integer value is being rounded down when rendered

Open foslock opened this issue 9 years ago • 3 comments

Problem

I am running Sentry 8.13.0 in a self-deployed Heroku environment, and have noticed that even though the JSON blob of a certain event contains the correct value (meaning this has nothing to do with the client), the actual value that gets rendered in the Sentry Web UI seems to be rounded down to the nearest 1000.

Data

Here is the snippet from the event JSON blob sent by the client:

...
"vars": {
    ...
    "org_id": "u'2000550000891708'",
    "permission": "'readWrite'",
    "org_user_dsid": 999999000167639035,
    ...
}

And here is a screen grab of the rendered number from the exact same event, as you can see, it reads as ** 999999000167639000** instead of its true value: 999999000167639035.

sentry-grab

foslock avatar Nov 17 '17 22:11 foslock

This is an inherent issue with the JSON format.

There is no such thing as a "long integer value" in the standard specification (or any integer value, really — only double floating points), so any values above 2 ** 52 are going to drift from their "true" values depending on the implementation of the parser. This value might be stored correctly on the server because the parser will use Python integers (you can check by loading the JSON from the UI by clicking the link by the event ID that says "JSON"), but it's always going to be parsed as a floating point by the JavaScript JSON parser in the UI and lose precision at that point.

We might address this in some future revision of the event reporting schema in the future if/when we add type annotations (see GH-3050) and can represent them as something other than JSON numbers.

tkaemming avatar Nov 17 '17 22:11 tkaemming

Closing this issue due to staleness. Feel free to comment here if you think we should still work on this.

BYK avatar Oct 21 '20 18:10 BYK

@BYK was it ever fixed?

dentarg avatar Oct 21 '20 21:10 dentarg