Title: Decouple SentryAndroid initialisation from Events sending · Issue #1752 · getsentry/sentry-java · GitHub
Open Graph Title: Decouple SentryAndroid initialisation from Events sending · Issue #1752 · getsentry/sentry-java
X Title: Decouple SentryAndroid initialisation from Events sending · Issue #1752 · getsentry/sentry-java
Description: Discussed in #1751 Originally posted by PGliw October 4, 2021 SentryAndroid does call installDefaultIntegrations in init Method. There are some integrations included that are not "the best" choice for my use case. (SendCachedEventFireAnd...
Open Graph Description: Discussed in #1751 Originally posted by PGliw October 4, 2021 SentryAndroid does call installDefaultIntegrations in init Method. There are some integrations included that are not "the best" choice ...
X Description: Discussed in #1751 Originally posted by PGliw October 4, 2021 SentryAndroid does call installDefaultIntegrations in init Method. There are some integrations included that are not "the best&quo...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/1752
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decouple SentryAndroid initialisation from Events sending","articleBody":"### Discussed in https://github.com/getsentry/sentry-java/discussions/1751\r\n\r\n\u003cdiv type='discussions-op-text'>\r\n\r\n\u003csup>Originally posted by **PGliw** October 4, 2021\u003c/sup>\r\nSentryAndroid does call `installDefaultIntegrations` in `init` Method.\r\nThere are some integrations included that are not \"the best\" choice for my use case.\r\n(`SendCachedEventFireAndForgetIntegration` and `EnvelopeFileObserverIntegration` I suppose).\r\n\r\nThe workflow I do want to achieve is following (assuming [#1739](https://github.com/getsentry/sentry-java/pull/1739/commits) is closed by the time):\r\n\r\n1. First, init SentryAndroid framework, so breadcrumbs are collected\r\n2. Do not send any events automatically!\r\n3. Check if there was a crash during last app run\r\n4. If there was, ask the user what to do with the crash event\r\n5. If the user wants to send the cached event, send it. Otherwise just delete the event from the cache.\r\n\r\nSadly, because of coupling `SentryAndroid.init` with `SendCachedEventFireAndForgetIntegration`, the crash reports are being sent once the app was started after crash. So it's impossible to achieve step 2. having done step 1., isn't it?\r\nCould the initialisation of the framework (that is initialisation of collecting breadcrumbs etc.) be decoupled from sending the cached events? And could sending the events be made \"on-demand\"?\r\n\r\nI assume it's impossible because of coupling `SendCachedEventFireAndForgetIntegration` integration's `register` method to submitting sending tasks, isn't it? And there is no clean way to enable/disable it on demand.\r\n\r\nIt might be way of doing it by implementing custom `TransportGate`, but how to invoke `SendCachedEventFireAndForgetIntegration` later, once we need to send the event? (see point 5.)\r\n\r\nAlso sending the crash event should not be done after the crash, by on-demand on the next start of the app (`UncaughtExceptionHandlerIntegration` seems to do the opposite by default?)\r\n\r\n\u003c/div>","author":{"url":"https://github.com/pchoroscin","@type":"Person","name":"pchoroscin"},"datePublished":"2021-10-05T12:17:32Z","url":"https://github.com/getsentry/sentry-java/issues/1752"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:eab9b1ea-0857-476c-9bdd-1aab2cd9c2ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AAD2:CFA86:274763:355F4D:6B075EC7 |
| html-safe-nonce | cea0a6bf2344125167d934636e79afaffadaf925cda7289b465cfa998e8d8ea2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUQyOkNGQTg2OjI3NDc2MzozNTVGNEQ6NkIwNzVFQzciLCJ2aXNpdG9yX2lkIjoiODAwMzU5Mzk2MDcxNzUwODI5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 08a12f2fe75c51e297ff07326b65334082c7b459037555616e8dc8321d47b71b |
| hovercard-subject-tag | issue:1016255561 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/1752/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f928b14f8ead1497633c21d3191bcdb5f739e842bb4bd1c05026e5f5b0784ef8/getsentry/sentry-java/issues/1752 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f928b14f8ead1497633c21d3191bcdb5f739e842bb4bd1c05026e5f5b0784ef8/getsentry/sentry-java/issues/1752 |
| og:image:alt | Discussed in #1751 Originally posted by PGliw October 4, 2021 SentryAndroid does call installDefaultIntegrations in init Method. There are some integrations included that are not "the best" choice ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pchoroscin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a557ecc960a3ae6e299fc66b0bc9132072f8860191648e6749fee5d3ff00d82 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bd845eb7947c1ed8c850f7ab415a51339d162de3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width