Skip to content

Commit e29b50b

Browse files
authored
feat: [Unreal] Add transaction and span set_data documentation (#14599)
Preview: https://sentry-docs-git-unreal-attach-data.sentry.dev/platforms/unreal/tracing/instrumentation/custom-instrumentation/ ## DESCRIBE YOUR PR * Add transaction and span set_data documentation * Relates to getsentry/projects#524 ## 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:* - [x] Checked Vercel preview for correctness, including links - [x] 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) ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
1 parent 7b1731c commit e29b50b

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docs/platforms/unreal/tracing/instrumentation/custom-instrumentation.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ To capture transactions and spans customized to your organization's needs, you m
1414

1515
<PlatformContent includePath="performance/add-spans-example" />
1616

17+
<PlatformContent includePath="performance/improving-data" />
18+
1719
## Distributed Tracing
1820

1921
In order to use distributed tracing, follow the <PlatformLink to="/tracing/trace-propagation/custom-instrumentation/">custom instrumentation</PlatformLink> steps.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Improving Data on Transactions and Spans
2+
3+
### Adding Data Attributes to Transactions
4+
5+
You can add data attributes to your transactions. This data is visible and __queryable__ in the trace explorer in Sentry. Data attributes can be of type _string_, _number_ or _boolean_, as well as arrays and maps of these types:
6+
7+
```cpp
8+
USentryTransaction* transaction = SentrySubsystem->StartTransaction(TEXT("Automation transaction"), TEXT("Automation operation"));
9+
10+
transaction->SetData(TEXT("key1"), {{TEXT("data_key1"), TEXT("value")}});
11+
transaction->SetData(TEXT("key2"), {{TEXT("data_key2"), 123}});
12+
transaction->SetData(TEXT("key3"), {{TEXT("data_key3"), 123.456f}});
13+
transaction->SetData(TEXT("key4"), {{TEXT("data_key4"), TArray<FSentryVariant>{{123, 456}}}});
14+
transaction->SetData(TEXT("key5"), {{TEXT("data_key5"), TMap<FString, FSentryVariant>{{TEXT("inner_key1"), 123}}}});
15+
16+
transaction->Finish();
17+
```
18+
19+
### Adding Data Attributes to Spans
20+
21+
You can add data attributes to your transactions. This data is visible and __queryable__ in the trace explorer in Sentry. Data attributes can be of type _string_, _number_ or _boolean_, as well as arrays and maps of these types:
22+
23+
```cpp
24+
USentryTransaction* transaction = SentrySubsystem->StartTransaction(TEXT("Automation transaction"), TEXT("Automation operation"));
25+
USentrySpan* span = transaction->StartChildSpan(TEXT("Automation span"), TEXT("Description text"));
26+
27+
span->SetData(TEXT("key1"), {{TEXT("data_key1"), TEXT("value")}});
28+
span->SetData(TEXT("key2"), {{TEXT("data_key2"), 123}});
29+
span->SetData(TEXT("key3"), {{TEXT("data_key3"), 123.456f}});
30+
span->SetData(TEXT("key4"), {{TEXT("data_key4"), TArray<FSentryVariant>{{123, 456}}}});
31+
span->SetData(TEXT("key5"), {{TEXT("data_key5"), TMap<FString, FSentryVariant>{{TEXT("inner_key1"), 123}}}});
32+
33+
span->Finish();
34+
transaction->Finish();
35+
```

0 commit comments

Comments
 (0)