Skip to content

[Unreal] Add transaction and span set_data documentation #14599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 12, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ To capture transactions and spans customized to your organization's needs, you m

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

<PlatformContent includePath="performance/improving-data" />

## Distributed Tracing

In order to use distributed tracing, follow the <PlatformLink to="/tracing/trace-propagation/custom-instrumentation/">custom instrumentation</PlatformLink> steps.
35 changes: 35 additions & 0 deletions platform-includes/performance/improving-data/unreal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Improving Data on Transactions and Spans

### Adding Data Attributes to Transactions

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:

```cpp
USentryTransaction* transaction = SentrySubsystem->StartTransaction(TEXT("Automation transaction"), TEXT("Automation operation"));

transaction->SetData(TEXT("key1"), {{TEXT("data_key1"), TEXT("value")}});
transaction->SetData(TEXT("key2"), {{TEXT("data_key2"), 123}});
transaction->SetData(TEXT("key3"), {{TEXT("data_key3"), 123.456f}});
transaction->SetData(TEXT("key4"), {{TEXT("data_key4"), TArray<FSentryVariant>{{123, 456}}}});
transaction->SetData(TEXT("key5"), {{TEXT("data_key5"), TMap<FString, FSentryVariant>{{TEXT("inner_key1"), 123}}}});

transaction->Finish();
```

### Adding Data Attributes to Spans

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:

```cpp
USentryTransaction* transaction = SentrySubsystem->StartTransaction(TEXT("Automation transaction"), TEXT("Automation operation"));
USentrySpan* span = transaction->StartChildSpan(TEXT("Automation span"), TEXT("Description text"));

span->SetData(TEXT("key1"), {{TEXT("data_key1"), TEXT("value")}});
span->SetData(TEXT("key2"), {{TEXT("data_key2"), 123}});
span->SetData(TEXT("key3"), {{TEXT("data_key3"), 123.456f}});
span->SetData(TEXT("key4"), {{TEXT("data_key4"), TArray<FSentryVariant>{{123, 456}}}});
span->SetData(TEXT("key5"), {{TEXT("data_key5"), TMap<FString, FSentryVariant>{{TEXT("inner_key1"), 123}}}});

span->Finish();
transaction->Finish();
```