-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Record dropped spans in client reports #2154
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6eb6dbe
Record dropped spans
buenaflor ab8e9ea
Changelog
buenaflor 8ad162f
Naming
buenaflor d8744bf
Merge branch 'main' into feat/report-dropped-spans
buenaflor dccede3
Update CHANGELOG.md
buenaflor 1e0eafe
Send dropped event as well for rate limit and network error
buenaflor dc50f69
Update
buenaflor 747ee85
Dart analyze
buenaflor 077c21b
Fix test
buenaflor d275793
Improve comments
buenaflor 783e595
improvements
buenaflor 701e56f
Apply same logic of beforeSend to event processor
buenaflor 4a4d2df
Fix test
buenaflor 8364dac
Formatting
buenaflor fddfed4
Comments
buenaflor 03a297d
Rename mock
buenaflor 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -12,7 +12,10 @@ import 'sentry_user_feedback.dart'; | |
|
||
/// Item holding header information and JSON encoded data. | ||
class SentryEnvelopeItem { | ||
SentryEnvelopeItem(this.header, this.dataFactory); | ||
/// The original, non-encoded object, used when direct access to the source data is needed. | ||
Object? originalObject; | ||
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. used so we don't have to deserialize the envelope when we want to access the number of spans in a transaction for example |
||
|
||
SentryEnvelopeItem(this.header, this.dataFactory, {this.originalObject}); | ||
|
||
/// Creates a [SentryEnvelopeItem] which sends [SentryTransaction]. | ||
factory SentryEnvelopeItem.fromTransaction(SentryTransaction transaction) { | ||
|
@@ -24,7 +27,8 @@ class SentryEnvelopeItem { | |
cachedItem.getDataLength, | ||
contentType: 'application/json', | ||
); | ||
return SentryEnvelopeItem(header, cachedItem.getData); | ||
return SentryEnvelopeItem(header, cachedItem.getData, | ||
originalObject: transaction); | ||
} | ||
|
||
factory SentryEnvelopeItem.fromAttachment(SentryAttachment attachment) { | ||
|
@@ -37,7 +41,8 @@ class SentryEnvelopeItem { | |
fileName: attachment.filename, | ||
attachmentType: attachment.attachmentType, | ||
); | ||
return SentryEnvelopeItem(header, cachedItem.getData); | ||
return SentryEnvelopeItem(header, cachedItem.getData, | ||
originalObject: attachment); | ||
} | ||
|
||
/// Create a [SentryEnvelopeItem] which sends [SentryUserFeedback]. | ||
|
@@ -50,7 +55,8 @@ class SentryEnvelopeItem { | |
cachedItem.getDataLength, | ||
contentType: 'application/json', | ||
); | ||
return SentryEnvelopeItem(header, cachedItem.getData); | ||
return SentryEnvelopeItem(header, cachedItem.getData, | ||
originalObject: feedback); | ||
} | ||
|
||
/// Create a [SentryEnvelopeItem] which holds the [SentryEvent] data. | ||
|
@@ -59,13 +65,13 @@ class SentryEnvelopeItem { | |
_CachedItem(() async => utf8JsonEncoder.convert(event.toJson())); | ||
|
||
return SentryEnvelopeItem( | ||
SentryEnvelopeItemHeader( | ||
SentryItemType.event, | ||
cachedItem.getDataLength, | ||
contentType: 'application/json', | ||
), | ||
cachedItem.getData, | ||
); | ||
SentryEnvelopeItemHeader( | ||
SentryItemType.event, | ||
cachedItem.getDataLength, | ||
contentType: 'application/json', | ||
), | ||
cachedItem.getData, | ||
originalObject: event); | ||
} | ||
|
||
/// Create a [SentryEnvelopeItem] which holds the [ClientReport] data. | ||
|
@@ -80,6 +86,7 @@ class SentryEnvelopeItem { | |
contentType: 'application/json', | ||
), | ||
cachedItem.getData, | ||
originalObject: clientReport, | ||
); | ||
} | ||
|
||
|
@@ -102,7 +109,8 @@ class SentryEnvelopeItem { | |
cachedItem.getDataLength, | ||
contentType: 'application/octet-stream', | ||
); | ||
return SentryEnvelopeItem(header, cachedItem.getData); | ||
return SentryEnvelopeItem(header, cachedItem.getData, | ||
originalObject: buckets); | ||
} | ||
|
||
/// Header with info about type and length of data in bytes. | ||
|
This file contains 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 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 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 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
Oops, something went wrong.
Oops, something went wrong.
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.
Can you add the same logic of the beforeSend callback here?
report discarded spans from a processor even if the transaction is not dropped
(note that computation should continue in that case, so no need to
break
)