From 20c84bf0c1747e6182467ddfe8f6c9cb08ce382b Mon Sep 17 00:00:00 2001
From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Date: Thu, 31 Jul 2025 11:59:37 +0200
Subject: [PATCH 1/6] update `sentry_value_t` example with 64-bit integer types
---
.../performance/improving-data/native.mdx | 43 ++++++++++++++-----
1 file changed, 33 insertions(+), 10 deletions(-)
diff --git a/platform-includes/performance/improving-data/native.mdx b/platform-includes/performance/improving-data/native.mdx
index cb1b96e225dde..83397578f310e 100644
--- a/platform-includes/performance/improving-data/native.mdx
+++ b/platform-includes/performance/improving-data/native.mdx
@@ -2,10 +2,17 @@
You can add Data Attributes to both Spans and Transactions. This data is visible in the trace explorer in Sentry.
The data must be of type `sentry_value_t`, which can store:
* 32-bit signed integers,
+* 64-bit signed and unsigned integers,
* double-precision floating-points,
* null-terminated strings, as well as
* lists and string-keyed maps containing `sentry_value_t` entries
+
+
+Currently, 64-bit unsigned integers are sent as strings, since they can't be processed as numerical values yet.
+
+
+
### Adding Data Attributes to Transactions
You can add data attributes to your transactions using the following API:
@@ -21,25 +28,33 @@ sentry_transaction_set_data(tx, "my-data-attribute-1",
sentry_transaction_set_data(tx, "my-data-attribute-2",
sentry_value_new_int32(42));
sentry_transaction_set_data(tx, "my-data-attribute-3",
- sentry_value_new_double(3.14));
+ sentry_value_new_int64(-9223372036854775808));
sentry_transaction_set_data(tx, "my-data-attribute-4",
+ sentry_value_new_uint64(18446744073709551615));
+sentry_transaction_set_data(tx, "my-data-attribute-5",
+ sentry_value_new_double(3.14));
+sentry_transaction_set_data(tx, "my-data-attribute-6",
sentry_value_new_bool(true));
sentry_value_t value_list = sentry_value_new_list();
sentry_value_append(value_list, sentry_value_new_string("value1"));
sentry_value_append(value_list, sentry_value_new_int32(42));
+sentry_value_append(value_list, sentry_value_new_int64(-5123456789));
+sentry_value_append(value_list, sentry_value_new_uint64(18446744073709551615));
sentry_value_append(value_list, sentry_value_new_double(3.14));
sentry_value_append(value_list, sentry_value_new_bool(true));
-sentry_transaction_set_data(tx, "my-data-attribute-5", value_list);
+sentry_transaction_set_data(tx, "my-data-attribute-7", value_list);
sentry_value_t value_object = sentry_value_new_object();
sentry_value_set_by_key(value_object, "key_1", sentry_value_new_string("value1"));
sentry_value_set_by_key(value_object, "key_2", sentry_value_new_int32(42));
-sentry_value_set_by_key(value_object, "key_3", sentry_value_new_double(3.14));
-sentry_value_set_by_key(value_object, "key_4", sentry_value_new_bool(true));
+sentry_value_set_by_key(value_object, "key_3", sentry_value_new_int64(-5123456789));
+sentry_value_set_by_key(value_object, "key_4", sentry_value_new_uint64(18446744073709551615));
+sentry_value_set_by_key(value_object, "key_5", sentry_value_new_double(3.14));
+sentry_value_set_by_key(value_object, "key_6", sentry_value_new_bool(true));
-sentry_transaction_set_data(tx, "my-data-attribute-6", value_object);
+sentry_transaction_set_data(tx, "my-data-attribute-8", value_object);
```
### Adding Data Attributes to Spans
@@ -59,23 +74,31 @@ sentry_span_set_data(span, "my-data-attribute-1",
sentry_span_set_data(span, "my-data-attribute-2",
sentry_value_new_int32(42));
sentry_span_set_data(span, "my-data-attribute-3",
- sentry_value_new_double(3.14));
+ sentry_value_new_int64(-9223372036854775808));
sentry_span_set_data(span, "my-data-attribute-4",
+ sentry_value_new_uint64(18446744073709551615));
+sentry_span_set_data(span, "my-data-attribute-5",
+ sentry_value_new_double(3.14));
+sentry_span_set_data(span, "my-data-attribute-6",
sentry_value_new_bool(true));
sentry_value_t value_list = sentry_value_new_list();
sentry_value_append(value_list, sentry_value_new_string("value1"));
sentry_value_append(value_list, sentry_value_new_int32(42));
+sentry_value_append(value_list, sentry_value_new_int64(-5123456789));
+sentry_value_append(value_list, sentry_value_new_uint64(18446744073709551615));
sentry_value_append(value_list, sentry_value_new_double(3.14));
sentry_value_append(value_list, sentry_value_new_bool(true));
-sentry_span_set_data(span, "my-data-attribute-5", value_list);
+sentry_span_set_data(span, "my-data-attribute-7", value_list);
sentry_value_t value_object = sentry_value_new_object();
sentry_value_set_by_key(value_object, "key_1", sentry_value_new_string("value1"));
sentry_value_set_by_key(value_object, "key_2", sentry_value_new_int32(42));
-sentry_value_set_by_key(value_object, "key_3", sentry_value_new_double(3.14));
-sentry_value_set_by_key(value_object, "key_4", sentry_value_new_bool(true));
+sentry_value_set_by_key(value_object, "key_3", sentry_value_new_int64(-5123456789));
+sentry_value_set_by_key(value_object, "key_4", sentry_value_new_uint64(18446744073709551615));
+sentry_value_set_by_key(value_object, "key_5", sentry_value_new_double(3.14));
+sentry_value_set_by_key(value_object, "key_6", sentry_value_new_bool(true));
-sentry_span_set_data(span, "my-data-attribute-6", value_object);
+sentry_span_set_data(span, "my-data-attribute-8", value_object);
```
From 23420937d420f49d8a8a1eb60305fbff6a67ea72 Mon Sep 17 00:00:00 2001
From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Date: Thu, 31 Jul 2025 12:18:53 +0200
Subject: [PATCH 2/6] add example to SDK usage page
---
platform-includes/capture-message/native.mdx | 13 +++++++++++++
.../performance/improving-data/native.mdx | 6 ------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/platform-includes/capture-message/native.mdx b/platform-includes/capture-message/native.mdx
index b09c560aa43a5..62955d4622906 100644
--- a/platform-includes/capture-message/native.mdx
+++ b/platform-includes/capture-message/native.mdx
@@ -20,6 +20,13 @@ To create and capture a manual event, follow these steps:
2. Add custom attributes to the event, like a `message` or an `exception`.
3. Send the event to Sentry by invoking `sentry_capture_event`.
+The custom attribute data must be of type `sentry_value_t`, which can store:
+* 32-bit signed integers,
+* 64-bit signed and unsigned integers,
+* double-precision floating-points,
+* null-terminated strings, as well as
+* lists and string-keyed maps containing `sentry_value_t` entries
+
In a more complex example, it looks like this:
```c
@@ -29,9 +36,15 @@ sentry_value_set_by_key(event, "message", sentry_value_new_string("Hello!"));
sentry_value_t screen = sentry_value_new_object();
sentry_value_set_by_key(screen, "width", sentry_value_new_int32(1920));
sentry_value_set_by_key(screen, "height", sentry_value_new_int32(1080));
+sentry_value_set_by_key(screen, "refresh_rate", sentry_value_new_double(29.97));
+
+sentry_value_t processed_files = sentry_value_new_list();
+sentry_value_append(processed_files, sentry_value_new_uint64(1073741824ULL));
+sentry_value_append(processed_files, sentry_value_new_uint64(2147483648ULL));
sentry_value_t contexts = sentry_value_new_object();
sentry_value_set_by_key(contexts, "screen_size", screen);
+sentry_value_set_by_key(contexts, "processed_files", processed_files);
sentry_value_set_by_key(event, "contexts", contexts);
sentry_capture_event(event);
diff --git a/platform-includes/performance/improving-data/native.mdx b/platform-includes/performance/improving-data/native.mdx
index 83397578f310e..d7aa5a47e3d19 100644
--- a/platform-includes/performance/improving-data/native.mdx
+++ b/platform-includes/performance/improving-data/native.mdx
@@ -7,12 +7,6 @@ The data must be of type `sentry_value_t`, which can store:
* null-terminated strings, as well as
* lists and string-keyed maps containing `sentry_value_t` entries
-
-
-Currently, 64-bit unsigned integers are sent as strings, since they can't be processed as numerical values yet.
-
-
-
### Adding Data Attributes to Transactions
You can add data attributes to your transactions using the following API:
From 4385de35715c760adea11387b5f73a89a0b8ebc3 Mon Sep 17 00:00:00 2001
From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Date: Thu, 31 Jul 2025 12:30:35 +0200
Subject: [PATCH 3/6] revert changes on capture-message
---
platform-includes/capture-message/native.mdx | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/platform-includes/capture-message/native.mdx b/platform-includes/capture-message/native.mdx
index 62955d4622906..4876d35eae495 100644
--- a/platform-includes/capture-message/native.mdx
+++ b/platform-includes/capture-message/native.mdx
@@ -20,15 +20,7 @@ To create and capture a manual event, follow these steps:
2. Add custom attributes to the event, like a `message` or an `exception`.
3. Send the event to Sentry by invoking `sentry_capture_event`.
-The custom attribute data must be of type `sentry_value_t`, which can store:
-* 32-bit signed integers,
-* 64-bit signed and unsigned integers,
-* double-precision floating-points,
-* null-terminated strings, as well as
-* lists and string-keyed maps containing `sentry_value_t` entries
-
In a more complex example, it looks like this:
-
```c
sentry_value_t event = sentry_value_new_event();
sentry_value_set_by_key(event, "message", sentry_value_new_string("Hello!"));
@@ -36,15 +28,9 @@ sentry_value_set_by_key(event, "message", sentry_value_new_string("Hello!"));
sentry_value_t screen = sentry_value_new_object();
sentry_value_set_by_key(screen, "width", sentry_value_new_int32(1920));
sentry_value_set_by_key(screen, "height", sentry_value_new_int32(1080));
-sentry_value_set_by_key(screen, "refresh_rate", sentry_value_new_double(29.97));
-
-sentry_value_t processed_files = sentry_value_new_list();
-sentry_value_append(processed_files, sentry_value_new_uint64(1073741824ULL));
-sentry_value_append(processed_files, sentry_value_new_uint64(2147483648ULL));
sentry_value_t contexts = sentry_value_new_object();
sentry_value_set_by_key(contexts, "screen_size", screen);
-sentry_value_set_by_key(contexts, "processed_files", processed_files);
sentry_value_set_by_key(event, "contexts", contexts);
sentry_capture_event(event);
From c436b419f4f3fb5cdfcd6676537cd5a3b6e19631 Mon Sep 17 00:00:00 2001
From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Date: Thu, 31 Jul 2025 12:31:29 +0200
Subject: [PATCH 4/6] cleanup
---
platform-includes/capture-message/native.mdx | 1 +
1 file changed, 1 insertion(+)
diff --git a/platform-includes/capture-message/native.mdx b/platform-includes/capture-message/native.mdx
index 4876d35eae495..b09c560aa43a5 100644
--- a/platform-includes/capture-message/native.mdx
+++ b/platform-includes/capture-message/native.mdx
@@ -21,6 +21,7 @@ To create and capture a manual event, follow these steps:
3. Send the event to Sentry by invoking `sentry_capture_event`.
In a more complex example, it looks like this:
+
```c
sentry_value_t event = sentry_value_new_event();
sentry_value_set_by_key(event, "message", sentry_value_new_string("Hello!"));
From b58f3f2f5a7b7aa2fe69e20fceeb52b68cd60caa Mon Sep 17 00:00:00 2001
From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Date: Thu, 31 Jul 2025 15:27:58 +0200
Subject: [PATCH 5/6] add example `sentry_value_t` usage for setting context
---
.../enriching-events/set-context/native.mdx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/platform-includes/enriching-events/set-context/native.mdx b/platform-includes/enriching-events/set-context/native.mdx
index c3355dcc94956..5bab14b0afeca 100644
--- a/platform-includes/enriching-events/set-context/native.mdx
+++ b/platform-includes/enriching-events/set-context/native.mdx
@@ -4,6 +4,14 @@
sentry_value_t character = sentry_value_new_object();
sentry_value_set_by_key(character, "name", sentry_value_new_string("Mighty Fighter"));
sentry_value_set_by_key(character, "age", sentry_value_new_int32(19));
-sentry_value_set_by_key(character, "attack_type", sentry_value_new_string("melee"));
+sentry_value_set_by_key(character, "height", sentry_value_new_double(184.6));
+sentry_value_set_by_key(character, "is_alive", sentry_value_new_bool(true));
+sentry_value_set_by_key(character, "exp", sentry_value_new_uint64(6442450941));
+
+sentry_value_t inventory = sentry_value_new_list();
+sentry_value_append(inventory, sentry_value_new_string("sword"));
+sentry_value_append(inventory, sentry_value_new_string("shield"));
+sentry_value_set_by_key(character, "inventory", inventory);
+
sentry_set_context("character", character);
```
From ea2a8f306e82de835b52989cb92526d61f92f791 Mon Sep 17 00:00:00 2001
From: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
Date: Thu, 31 Jul 2025 16:10:58 +0200
Subject: [PATCH 6/6] add note on uint64 string conversion
---
platform-includes/performance/improving-data/native.mdx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/platform-includes/performance/improving-data/native.mdx b/platform-includes/performance/improving-data/native.mdx
index d7aa5a47e3d19..4f274935971b8 100644
--- a/platform-includes/performance/improving-data/native.mdx
+++ b/platform-includes/performance/improving-data/native.mdx
@@ -2,7 +2,8 @@
You can add Data Attributes to both Spans and Transactions. This data is visible in the trace explorer in Sentry.
The data must be of type `sentry_value_t`, which can store:
* 32-bit signed integers,
-* 64-bit signed and unsigned integers,
+* 64-bit signed integers,
+* 64-bit unsigned integers (due to a current limitation in processing, these will be converted to strings before sending),
* double-precision floating-points,
* null-terminated strings, as well as
* lists and string-keyed maps containing `sentry_value_t` entries