From 389395b7f87ee09df70531448e9ee5c1f033102c Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Tue, 31 Aug 2021 16:01:06 -0400 Subject: [PATCH 1/6] sdk built-in screenshot feature --- src/docs/sdk/features.mdx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 152da405d5..79fcd91442 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -141,6 +141,18 @@ envelope item, the SDK must discard items larger than the `maxAttachmentSize`. E useful because attachments could quickly eat up the users' disk space. Furthermore, Relay has a [maximum size for attachments](https://docs.sentry.io/product/relay/options/), and we want to reduce unnecessary requests. +## Screenshots + +When the user opts-in, if technically possible, take a screenshot of the application and include as an [attachments](#attachments) to the [envelope](/sdk/envelopes/) with the event. + +This is a best effort feature that only applies to SDKs with a user interface, such as Mobile and Desktop. +It's advised to provide this feature through a single option called `attachScreenshot`. That's a preferred way but in platforms such as Flutter, a wrapping widget is required so documentation can point users to that instead of the suggested option name. + +The feature is achieved by adding an attachment with: + +* File name `screenshot.jpg` or `screenshot.png` +* Image size, if possible should stay below 2 MB but quality/size could be configurable + ## Before-Send Hook Hook called with the event (and on some platforms the hint) that allow the user to decide whether an event should be sent or not. This can also be used to further modify the event. From 33ed6ec0c547c3c4f37636b49f0c14b88748cf11 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Tue, 31 Aug 2021 16:59:28 -0400 Subject: [PATCH 2/6] Update src/docs/sdk/features.mdx --- src/docs/sdk/features.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 79fcd91442..dff7c7750a 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -145,7 +145,8 @@ useful because attachments could quickly eat up the users' disk space. Furthermo When the user opts-in, if technically possible, take a screenshot of the application and include as an [attachments](#attachments) to the [envelope](/sdk/envelopes/) with the event. -This is a best effort feature that only applies to SDKs with a user interface, such as Mobile and Desktop. +This feature only applies to SDKs with a user interface, such as Mobile and Desktop. +In some environments such as native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. So inherently this feature will be a best effort. It's advised to provide this feature through a single option called `attachScreenshot`. That's a preferred way but in platforms such as Flutter, a wrapping widget is required so documentation can point users to that instead of the suggested option name. The feature is achieved by adding an attachment with: From 49976bd95d69a8a279264a65bed2185b02f82677 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Tue, 31 Aug 2021 17:10:08 -0400 Subject: [PATCH 3/6] Update src/docs/sdk/features.mdx --- src/docs/sdk/features.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index dff7c7750a..47612ee99a 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -153,6 +153,7 @@ The feature is achieved by adding an attachment with: * File name `screenshot.jpg` or `screenshot.png` * Image size, if possible should stay below 2 MB but quality/size could be configurable +* `ContentType: image/jpg` or `ContentType: image/png` ## Before-Send Hook From a96199af3f86c36fc12ac2c1b601652dbf6aad3f Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Tue, 14 Dec 2021 12:43:57 -0500 Subject: [PATCH 4/6] Update src/docs/sdk/features.mdx --- src/docs/sdk/features.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 47612ee99a..006b93e35f 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -155,6 +155,8 @@ The feature is achieved by adding an attachment with: * Image size, if possible should stay below 2 MB but quality/size could be configurable * `ContentType: image/jpg` or `ContentType: image/png` +Whenever possible, avoid adding the attachment altogether if taking the screenshot fails. Alternatively, when streaming, it's possible the envelope header was already flushed through before the attempt to take the screenshot happens. In this case, a 0 byte attachment will be included. In that case, Sentry will not show a screenshot preview. + ## Before-Send Hook Hook called with the event (and on some platforms the hint) that allow the user to decide whether an event should be sent or not. This can also be used to further modify the event. From 11d87c6b19e40deb7fd05567b02f6c9a792bda9b Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Tue, 14 Dec 2021 12:44:14 -0500 Subject: [PATCH 5/6] Update src/docs/sdk/features.mdx Co-authored-by: Rodolfo Carvalho --- src/docs/sdk/features.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 006b93e35f..bc780fb2c6 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -143,7 +143,7 @@ useful because attachments could quickly eat up the users' disk space. Furthermo ## Screenshots -When the user opts-in, if technically possible, take a screenshot of the application and include as an [attachments](#attachments) to the [envelope](/sdk/envelopes/) with the event. +When the user opts-in, if technically possible, take a screenshot of the application and include as an [attachment](#attachments) to the [envelope](/sdk/envelopes/) with the event. This feature only applies to SDKs with a user interface, such as Mobile and Desktop. In some environments such as native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. So inherently this feature will be a best effort. From 4e5ecc65d93464cab3d3bd1aa97ccc32ec60cacb Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Tue, 14 Dec 2021 12:48:42 -0500 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Abhijeet Prasad Co-authored-by: Rodolfo Carvalho --- src/docs/sdk/features.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index bc780fb2c6..026efc067d 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -146,8 +146,8 @@ useful because attachments could quickly eat up the users' disk space. Furthermo When the user opts-in, if technically possible, take a screenshot of the application and include as an [attachment](#attachments) to the [envelope](/sdk/envelopes/) with the event. This feature only applies to SDKs with a user interface, such as Mobile and Desktop. -In some environments such as native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. So inherently this feature will be a best effort. -It's advised to provide this feature through a single option called `attachScreenshot`. That's a preferred way but in platforms such as Flutter, a wrapping widget is required so documentation can point users to that instead of the suggested option name. +In some environments such as native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. So inherently this feature will be a best effort solution. +It's advised to provide this feature through a single option called `attachScreenshot`. That's the preferred way but in platforms such as Flutter, a wrapping widget is required so documentation can point users to that instead of the suggested option name. The feature is achieved by adding an attachment with: