Skip to content

Commit 5ca87a3

Browse files
committed
fix(native): code snippet syntax
1 parent f51a974 commit 5ca87a3

File tree

1 file changed

+9
-12
lines changed
  • platform-includes/distributed-tracing/custom-instrumentation

1 file changed

+9
-12
lines changed

platform-includes/distributed-tracing/custom-instrumentation/native.mdx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,21 @@ To obtain headers from a transaction so it can be continued from a downstream se
88

99
```c
1010
static void
11-
copy_headers_to(const char *key, const char *value, void *userdata)
12-
{
13-
sentry_value_t *headers
14-
= (sentry_value_t *)userdata;
15-
sentry_value_set_by_key(*headers, key, value);
11+
copy_headers_to(const char *key, const char *value, void *userdata) {
12+
sentry_value_t *headers = (sentry_value_t *)userdata;
13+
sentry_value_set_by_key(*headers, key, sentry_value_new_string(value));
1614
}
1715

1816
int main(int argc, char **argv) {
19-
...
20-
// Transaction to continue off of
17+
// Transaction to continue off of
2118
sentry_transaction_context_t *tx_ctx = sentry_transaction_context_new(
2219
"honk",
23-
NULL,
20+
NULL
2421
);
2522
sentry_transaction_t *tx = sentry_transaction_start(tx_ctx, sentry_value_new_null());
2623

27-
sentry_value_t *headers = sentry_value_new_object();
28-
sentry_transaction_iter_headers(tx, copy_headers_to, (void *)headers);
24+
sentry_value_t headers = sentry_value_new_object();
25+
sentry_transaction_iter_headers(tx, copy_headers_to, (void *) &headers);
2926
}
3027
```
3128
@@ -34,12 +31,12 @@ To create a transaction as a continuation of a trace retrieved from an upstream
3431
```c
3532
sentry_transaction_context_t *tx_ctx = sentry_transaction_context_new(
3633
"honk",
37-
NULL,
34+
NULL
3835
);
3936
sentry_transaction_context_update_from_header(
4037
tx_ctx,
4138
"sentry-trace",
42-
"atraceid-aspanid-issampled",
39+
"atraceid-aspanid-issampled"
4340
);
4441
4542
```

0 commit comments

Comments
 (0)