-
-
Notifications
You must be signed in to change notification settings - Fork 192
feat: add (u)int64 sentry_value_t
type
#1326
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
Conversation
84fb966
to
09f46d8
Compare
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- add `(u)int64 sentry_value_t` type ([#1326](https://github.com/getsentry/sentry-native/pull/1326)) If none of the above apply, you can opt out of this check by adding |
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.
Regarding sentry__value_from_json
, I'd try to avoid manual integer parsing (is_integer_string
). I suppose we need to check for '-'
to determine whether unsigned values are allowed but besides that, I'd only operate with strtoxxx
together with the appropriate errno and range checks. Can we keep it closer to the original code and basically just add extra checks to the "else" branch where it previously had the double fallback? Also, would one strtoll
or strtoull
call be enough and then we'll do the cast manually based on the sign and range?
src/sentry_json.c
Outdated
// TODO currently all uint64 values should be sent as strings; update when | ||
// this changes |
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 happened? what is this needed for? i was't part of the original reviews and might be missing some background context but i tried reverting "always send uint64 as string" and the unit tests pass. :)
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.
Ah seems that I forgot to link to the develop docs; basically for Logs it is specified that we cannot ingest unsigned 64-bit integers yet (see this section), and I tried whether this is the case in general by trying to send some transactions with 64-bit unsigned integer data. Turns out we cannot handle this in the Sentry UI (yet), so for now I think it makes sense to send all uint64 values as strings instead.
In the Logs PR we just store the uint64 arguments as string sentry_value_t
types, but with this more general change we could have logs store them as uint64, and then we only need to update thesentry__jsonwriter_write_uint64
function once these values can get handled.
Reverting this should make the value_uint64
test fail, since it expects "" around the numbers in the json representation.
To test the UI handling of these values, I added this in the example.c
before sending a transaction:
sentry_transaction_set_data(tx, "bigger", sentry_value_new_int32(INT64_MIN));
sentry_transaction_set_data(tx, "biggest", sentry_value_new_uint64(UINT64_MAX));
And without the uint64->string conversion, the UI shows this:
Adding the conversion makes it show up correctly.
@sentry review |
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.
LGTM 👍
Only minor changes after already having been thoroughly reviewed in #1301
#14509) <!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR Related to the changes in getsentry/sentry-native#1326 , we update our docs where they explicitly mention the available `sentry_value_t` types. ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs)
only the new commits added after previous PR was merged
Extracted from #1301 as this is relevant not only to Logs, but also for the read/capture envelopes feature (see comment). We can merge this to main before logs is finished.
The feature is mostly done already, but needs some more testing (e.g. seeing if values end up in the UI)
Also this needs to be tackled:
TODO
-> need to send uint64 as strings (see Logs spec)
sentry__value_from_json
for (u)int64sentry_value_t
example with 64-bit integer types sentry-docs#14509