-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[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
+37
−0
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("key"), {{TEXT("data_key1"), TEXT("value")}}); | ||
transaction->SetData(TEXT("key"), {{TEXT("data_key2"), 123}}); | ||
transaction->SetData(TEXT("key"), {{TEXT("data_key3"), 123.456f}}); | ||
transaction->SetData(TEXT("key"), {{TEXT("data_key4"), TArray<FSentryVariant>{{123, 456}}}}); | ||
transaction->SetData(TEXT("key"), {{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("key"), {{TEXT("data_key1"), TEXT("value")}}); | ||
span->SetData(TEXT("key"), {{TEXT("data_key2"), 123}}); | ||
span->SetData(TEXT("key"), {{TEXT("data_key3"), 123.456f}}); | ||
span->SetData(TEXT("key"), {{TEXT("data_key4"), TArray<FSentryVariant>{{123, 456}}}}); | ||
span->SetData(TEXT("key"), {{TEXT("data_key5"), TMap<FString, FSentryVariant>{{TEXT("inner_key1"), 123}}}}); | ||
|
||
span->Finish(); | ||
transaction->Finish(); | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: The Unreal `SetData` documentation example incorrectly uses the same key for multiple calls, which will cause data to be overwritten, with only the last value being saved.
SetData
in the Unreal documentation repeatedly use the same key,TEXT("key")
, for multiple calls. Standard key-value map behavior, which Unreal'sTMap
follows, dictates that using the same key overwrites the previous value. Consequently, if a user implements this example, only the data from the finalSetData
call will be preserved on the transaction, and all previously set attributes will be lost. This contradicts the documentation's stated goal of demonstrating how to add multiple, queryable data attributes and is inconsistent with examples for all other Sentry SDKs.SetData
call. For instance, use keys likeTEXT("data_key1")
,TEXT("data_key2")
, etc., to align with the intended functionality and the pattern established in other Sentry SDK documentation.severity: 0.45, confidence: 0.98
Did we get this right? 👍 / 👎 to inform future reviews.