Skip to content

Commit a060e71

Browse files
fix(native): update sentry_value_t example with 64-bit integer types (#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)
1 parent ca5f330 commit a060e71

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

platform-includes/enriching-events/set-context/native.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
sentry_value_t character = sentry_value_new_object();
55
sentry_value_set_by_key(character, "name", sentry_value_new_string("Mighty Fighter"));
66
sentry_value_set_by_key(character, "age", sentry_value_new_int32(19));
7-
sentry_value_set_by_key(character, "attack_type", sentry_value_new_string("melee"));
7+
sentry_value_set_by_key(character, "height", sentry_value_new_double(184.6));
8+
sentry_value_set_by_key(character, "is_alive", sentry_value_new_bool(true));
9+
sentry_value_set_by_key(character, "exp", sentry_value_new_uint64(6442450941));
10+
11+
sentry_value_t inventory = sentry_value_new_list();
12+
sentry_value_append(inventory, sentry_value_new_string("sword"));
13+
sentry_value_append(inventory, sentry_value_new_string("shield"));
14+
sentry_value_set_by_key(character, "inventory", inventory);
15+
816
sentry_set_context("character", character);
917
```

platform-includes/performance/improving-data/native.mdx

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
You can add Data Attributes to both Spans and Transactions. This data is visible in the trace explorer in Sentry.
33
The data must be of type `sentry_value_t`, which can store:
44
* 32-bit signed integers,
5+
* 64-bit signed integers,
6+
* 64-bit unsigned integers (due to a current limitation in processing, these will be converted to strings before sending),
57
* double-precision floating-points,
68
* null-terminated strings, as well as
79
* lists and string-keyed maps containing `sentry_value_t` entries
@@ -21,25 +23,33 @@ sentry_transaction_set_data(tx, "my-data-attribute-1",
2123
sentry_transaction_set_data(tx, "my-data-attribute-2",
2224
sentry_value_new_int32(42));
2325
sentry_transaction_set_data(tx, "my-data-attribute-3",
24-
sentry_value_new_double(3.14));
26+
sentry_value_new_int64(-9223372036854775808));
2527
sentry_transaction_set_data(tx, "my-data-attribute-4",
28+
sentry_value_new_uint64(18446744073709551615));
29+
sentry_transaction_set_data(tx, "my-data-attribute-5",
30+
sentry_value_new_double(3.14));
31+
sentry_transaction_set_data(tx, "my-data-attribute-6",
2632
sentry_value_new_bool(true));
2733

2834
sentry_value_t value_list = sentry_value_new_list();
2935
sentry_value_append(value_list, sentry_value_new_string("value1"));
3036
sentry_value_append(value_list, sentry_value_new_int32(42));
37+
sentry_value_append(value_list, sentry_value_new_int64(-5123456789));
38+
sentry_value_append(value_list, sentry_value_new_uint64(18446744073709551615));
3139
sentry_value_append(value_list, sentry_value_new_double(3.14));
3240
sentry_value_append(value_list, sentry_value_new_bool(true));
3341

34-
sentry_transaction_set_data(tx, "my-data-attribute-5", value_list);
42+
sentry_transaction_set_data(tx, "my-data-attribute-7", value_list);
3543

3644
sentry_value_t value_object = sentry_value_new_object();
3745
sentry_value_set_by_key(value_object, "key_1", sentry_value_new_string("value1"));
3846
sentry_value_set_by_key(value_object, "key_2", sentry_value_new_int32(42));
39-
sentry_value_set_by_key(value_object, "key_3", sentry_value_new_double(3.14));
40-
sentry_value_set_by_key(value_object, "key_4", sentry_value_new_bool(true));
47+
sentry_value_set_by_key(value_object, "key_3", sentry_value_new_int64(-5123456789));
48+
sentry_value_set_by_key(value_object, "key_4", sentry_value_new_uint64(18446744073709551615));
49+
sentry_value_set_by_key(value_object, "key_5", sentry_value_new_double(3.14));
50+
sentry_value_set_by_key(value_object, "key_6", sentry_value_new_bool(true));
4151

42-
sentry_transaction_set_data(tx, "my-data-attribute-6", value_object);
52+
sentry_transaction_set_data(tx, "my-data-attribute-8", value_object);
4353
```
4454
4555
### Adding Data Attributes to Spans
@@ -59,23 +69,31 @@ sentry_span_set_data(span, "my-data-attribute-1",
5969
sentry_span_set_data(span, "my-data-attribute-2",
6070
sentry_value_new_int32(42));
6171
sentry_span_set_data(span, "my-data-attribute-3",
62-
sentry_value_new_double(3.14));
72+
sentry_value_new_int64(-9223372036854775808));
6373
sentry_span_set_data(span, "my-data-attribute-4",
74+
sentry_value_new_uint64(18446744073709551615));
75+
sentry_span_set_data(span, "my-data-attribute-5",
76+
sentry_value_new_double(3.14));
77+
sentry_span_set_data(span, "my-data-attribute-6",
6478
sentry_value_new_bool(true));
6579
6680
sentry_value_t value_list = sentry_value_new_list();
6781
sentry_value_append(value_list, sentry_value_new_string("value1"));
6882
sentry_value_append(value_list, sentry_value_new_int32(42));
83+
sentry_value_append(value_list, sentry_value_new_int64(-5123456789));
84+
sentry_value_append(value_list, sentry_value_new_uint64(18446744073709551615));
6985
sentry_value_append(value_list, sentry_value_new_double(3.14));
7086
sentry_value_append(value_list, sentry_value_new_bool(true));
7187
72-
sentry_span_set_data(span, "my-data-attribute-5", value_list);
88+
sentry_span_set_data(span, "my-data-attribute-7", value_list);
7389
7490
sentry_value_t value_object = sentry_value_new_object();
7591
sentry_value_set_by_key(value_object, "key_1", sentry_value_new_string("value1"));
7692
sentry_value_set_by_key(value_object, "key_2", sentry_value_new_int32(42));
77-
sentry_value_set_by_key(value_object, "key_3", sentry_value_new_double(3.14));
78-
sentry_value_set_by_key(value_object, "key_4", sentry_value_new_bool(true));
93+
sentry_value_set_by_key(value_object, "key_3", sentry_value_new_int64(-5123456789));
94+
sentry_value_set_by_key(value_object, "key_4", sentry_value_new_uint64(18446744073709551615));
95+
sentry_value_set_by_key(value_object, "key_5", sentry_value_new_double(3.14));
96+
sentry_value_set_by_key(value_object, "key_6", sentry_value_new_bool(true));
7997
80-
sentry_span_set_data(span, "my-data-attribute-6", value_object);
98+
sentry_span_set_data(span, "my-data-attribute-8", value_object);
8199
```

0 commit comments

Comments
 (0)