Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion platform-includes/enriching-events/set-context/native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
38 changes: 28 additions & 10 deletions platform-includes/performance/improving-data/native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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 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
Expand All @@ -21,25 +23,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
Expand All @@ -59,23 +69,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);
```