|
| 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