Skip to content

Commit

Permalink
fix: correct syntax for native-sdk custom trace instrumentation (#11309)
Browse files Browse the repository at this point in the history
* fix: correct syntax for native-sdk custom trace instrumentation

* Update native-sdk manual instrumentation code snippet with more descriptive comment

Co-authored-by: Mischan Toosarani-Hausberger <mischan@abovevacant.com>

---------

Co-authored-by: Mischan Toosarani-Hausberger <mischan@abovevacant.com>
  • Loading branch information
JoshuaMoelans and supervacuus authored Sep 10, 2024
1 parent fb3df1a commit 262877d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions platform-includes/performance/add-spans-example/native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void perform_checkout() {
sentry_span_t *validation_span = sentry_transaction_start_child(
tx,
"validation",
"validating shopping cart",
"validating shopping cart"
);

validate_shopping_cart(); // Some long process, maybe a sync http request.
Expand All @@ -25,8 +25,8 @@ void perform_checkout() {
sentry_span_t *process_span = sentry_transaction_start_child(
tx,
"process",
"processing shopping cart",
)
"processing shopping cart"
);

process_shopping_cart(); // Another time consuming process.

Expand Down
4 changes: 2 additions & 2 deletions platform-includes/performance/connect-errors-spans/native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Errors reported to Sentry are automatically linked to any running transaction or
```c
sentry_transaction_context_t *tx_ctx = sentry_transaction_context_new(
"checkout",
"perform-checkout",
"perform-checkout"
);
sentry_transaction_t *tx = sentry_transaction_start(tx_ctx, sentry_value_new_null());

Expand All @@ -17,7 +17,7 @@ sentry_set_span(tx);
// Errors captured after the line above will be linked to the transaction
sentry_value_t exc = sentry_value_new_exception(
"ParseIntError",
"invalid digit found in string",
"invalid digit found in string"
);

sentry_value_t event = sentry_value_new_event();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ To instrument certain regions of your code, you can create transactions to captu
// Enable tracing by setting a sample rate above 0
sentry_options_t *options = sentry_options_new();
sentry_options_set_traces_sample_rate(options, 0.2);
...
// ...
// (Configure tracing unrelated options as you see fit)
// ...
sentry_init(options);

// Transactions can be started by providing the name and the operation
sentry_transaction_context_t *tx_ctx = sentry_transaction_context_new(
"transaction name",
"transaction operation",
"transaction operation"
);
sentry_transaction_t *tx = sentry_transaction_start(tx_ctx, sentry_value_new_null());

// Transactions can have child spans (and those spans can have child spans as well)
sentry_span_t *span = sentry_transaction_start_child(
tx,
"child operation",
"child description",
"child description"
);

// ...
Expand Down

0 comments on commit 262877d

Please sign in to comment.