Commit Graph

175 Commits

Author SHA1 Message Date
Jorge Martin Espinosa
f7bfcedd57 Try fixing performance metrics (#6046)
We've detected outliers in the `Up-to-date room list` and `Open a room` transactions in Sentry.

This commit tries to make sure we're starting/stopping the long running transactions when needed.
2026-01-26 15:41:58 +01:00
Benoit Marty
657a610f53 Metro 0.10.0: Classes annotated with ContributesIntoSet do not need to be annotated with Inject. 2026-01-20 10:13:39 +01:00
Jorge Martin Espinosa
28b63745f4 When a duplicate room list entry is found, report it and remove it (#6006)
* When a duplicate room list entry is found, report it and remove it

* Fix tests and fixtures

* Simplify how the updates are described in the Sentry reports
2026-01-14 10:56:45 +00:00
Jorge Martin Espinosa
536227883c Change the title for AnalyticsTransactions.coldStart and .catchUp (#5998) 2026-01-12 14:54:13 +00:00
Jorge Martin Espinosa
71031008dd Adjust metrics to the new specifications (#5937)
* Add `AnalyticsTransactions` with a set of `TransactionDefinition` items matching those in the user story

* Use that for `AnalyticsLongRunningTransactions`, make sure we send the right fields (name, operation, description)

* Add `AnalyticsSendMessageWatcher` to track how long it takes for an event to be sent and for us to get a call back for that from sync

* Add `Noop` implementation for enterprise
2026-01-05 16:23:26 +01:00
Jorge Martín
dd7649414d Fix wrong variable being used, improve tests 2025-12-18 14:08:38 +01:00
Jorge Martín
165032ea02 Make sure we don't upload any user ids in tags either 2025-12-18 14:08:38 +01:00
Jorge Martín
515f7f4946 Add more tests to SentryAnalyticsProviderTest 2025-12-18 14:08:38 +01:00
Jorge Martín
b5d6843725 Inject SentryDsn the same way we do with SentrySdkDsn so we can fake it for tests 2025-12-18 14:08:38 +01:00
Jorge Martín
9a9e84f6c8 Add tests for SentryAnalyticsProvider 2025-12-18 14:08:38 +01:00
Jorge Martín
7fe3b18699 Distinguish between indexable and non-indexable extra data 2025-12-18 14:08:38 +01:00
Jorge Martín
20c0d0190e Add extra code to make sure we can't upload a session/user id as an extra by mistake 2025-12-18 14:08:38 +01:00
Jorge Martín
a4b908bc18 Integrate the new use case with Sentry
We'll upload the store sizes as different fields so we can later use them to filter transaction/issues
2025-12-18 14:08:38 +01:00
Jorge Martín
18482a99e3 Add AnalyticsUserData, with keys for several extras we want to upload to Sentry.
Add the `HOMESERVER` extra, with a hashed homeserver value. This is only so we can identify devices using a problematic HS (like matrix.org under heavy load).
2025-12-18 14:08:38 +01:00
Jorge Martín
367bbc7e4b Create addUserData method in the analytics providers
This allows us to globally add arbitrary data to the events and transactions
2025-12-18 14:08:38 +01:00
Jorge Martín
7e3acd6b58 Add Sentry transaction so we can check how long it takes to vacuum and if there were any errors when doing it 2025-12-10 15:22:16 +01:00
Jorge Martín
9e997a2fa6 Fix: use the right BuildTimeConfig field for the SDK DSN
We were using `SERVICES_SENTRY_SDK_DSN`, but the enterprise template uses `SERVICES_SENTRY_DSN_RUST`
2025-12-04 22:53:39 +01:00
Jorge Martín
739f12d603 Replace AnalyticsSdkSpanFactory with AnalyticsSdkManager.
`AnalyticsSdkManager` also enables and disables Sentry logging in the SDK based on analytics user content.
2025-12-04 12:17:52 +01:00
Jorge Martín
b31267d7c7 Make SentrySdkDsn a value class instead of a qualifier 2025-12-04 12:17:52 +01:00
Jorge Martín
c7a5ce152e Fix providing the Sentry SDK DSN in Element Pro when no analytic modules are enabled 2025-12-04 12:17:52 +01:00
Jorge Martín
6dd6ce1ad4 Add missing doc 2025-12-04 12:17:52 +01:00
Jorge Martín
11f41629c1 Allow bridging Sentry spans to the SDK ones.
Add distributed tracing for `Room.timelineWithConfiguration`, so we can inspect the associated Rust trace.
2025-12-04 12:17:52 +01:00
Jorge Martín
53ab38d990 Enable Sentry in the SDK: add SDK Sentry DSN value
This is provided to the SDK in `PlatformInitializer`.
2025-12-04 12:17:52 +01:00
Jorge Martín
568c1ae90d Reuse coroutine in DefaultAnalyticsRoomListStateWatcher instead of creating and cancelling the same one 2025-11-28 14:15:54 +01:00
Jorge Martín
f098c5e027 Add Noop variants for the new watcher interfaces in :analytics:api 2025-11-28 14:15:54 +01:00
Jorge Martín
29117ce93d Add AnalyticsService.cancelLongRunningTransaction and AnalyticsService.finishLongRunningTransaction 2025-11-28 14:15:54 +01:00
Jorge Martín
884c547123 Extract from_notification extra to a constant in IntentNavigationExtras
Allow `IntentProvider` to receive extras and `PendingIntentFactory` to send them.
2025-11-28 14:15:54 +01:00
Jorge Martín
71bfffe58f Move analytic watchers to :services:analytics 2025-11-28 14:15:54 +01:00
Jorge Martín
93feed38bf Add transaction trees for opening a room so we can have a nice trace view 2025-11-28 14:15:54 +01:00
Jorge Martín
2a011bf072 Add OpenRoom long running analytic transaction 2025-11-28 14:15:54 +01:00
Jorge Martín
c0e66e9d49 Add another performance check for cold start time until the cached room list is displayed 2025-11-28 14:15:54 +01:00
Jorge Martín
5681d7c611 Add a performance check for notification tap -> populated timeline time 2025-11-28 14:15:54 +01:00
Jorge Martín
1b868e73c7 Add a 'warm' room list performance check:
We want to measure how long it takes the SDK to update the room list when the app comes back from being in background.

Note we don't want to check this in cold starts, only warm ones.
2025-11-28 14:15:54 +01:00
Jorge Martín
766c23721e Have long running analytic transactions return actual transactions.
Also add `AnalyticsService.getLongRunningTransaction` and change `AnalyticsService.stopLongRunningTransaction` to `removeLongRunningTransaction`.
2025-11-28 14:15:54 +01:00
Jorge Martin Espinosa
8718bd5239 Add NIGHTLY env for Sentry (#5779)
Previously, nightly issue reports and performance transactions were uploaded to 'DEBUG', which may make sense for issues, but not for performance traces.
2025-11-20 15:17:32 +01:00
Jorge Martin Espinosa
c6c2f4a267 Add some performance metrics for Sentry (#5760)
- Add `AnalyticsService.startTransaction(...)` to start a logging transaction that can be uploaded to Sentry if the user enabled the analytics upload.
- Add `AnalyticsTransaction` wrapper to abstract the Sentry ones.
- Added several helper methods to improve the UX around these transactions.
- Then measure:
  - Time until the first sync, and how it ended.
  - Time until the first rooms are displayed.
  - Time to load a room or a preview.
  - Time to load a timeline.
2025-11-19 11:42:55 +00:00
Benoit Marty
b3ec256dfa API modules do not need to setup dependency injection.
Move the implementation to the impl modules.
2025-11-12 19:05:39 +01:00
Benoit Marty
1292da2a72 Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
Benoit Marty
b748fcc631 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty
0a0224b586 Copyright: run command uv run license-editor --repository ../element-x-android 2025-11-10 10:09:26 +01:00
Benoit Marty
1b4aeaa79a Merge pull request #5604 from element-hq/feature/bma/noAnalytics
Add missing tests on the analytic modules
2025-10-24 11:03:53 +02:00
Benoit Marty
948c68b1ad Cleanup 2025-10-24 09:47:04 +02:00
Benoit Marty
b1033c4bf6 Add missing test on DefaultScreenTracker 2025-10-24 09:41:46 +02:00
Benoit Marty
4fd860687f Add missing test on NoopScreenTracker 2025-10-24 09:12:54 +02:00
Benoit Marty
514f4d0541 Add missing test on NoopAnalyticsService 2025-10-24 09:07:32 +02:00
Benoit Marty
dae44ccab7 Use parameter wasLastSession 2025-10-23 16:48:25 +02:00
Benoit Marty
66d8e6210d Add default implementation to SessionListener 2025-10-23 16:48:20 +02:00
Benoit Marty
44e125dbc7 Add parameter wasLastSession to SessionListener.onSessionDeleted 2025-10-23 16:20:15 +02:00
Benoit Marty
826cacf209 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty
73a6ba2849 Multi accounts - experimental first implementation (#5285)
* Multi account - Do not reset analytics store on sign out.

Else when 1 of many accounts is removed, the analytics opt in screen is displayed again.

* Multi accounts - first implementation.

* Multi accounts - Prevent user from logging twice with the same account

* Multi accounts - ignore automatic GoBack in case of error.

* Multi accounts - update first view when adding an account.

* Rename method storeData to addSession.

* Multi accounts - handle account switch when coming from a notification

* Multi accounts - handle login link when there is already an account.

* Multi accounts - handle click on push history for not current account.

* Multi accounts - improve layout and add preview.

* Add accountselect modules

* Multi accounts - incoming share with account selection

* Multi accounts - check the feature flag before allowing login using login link.

* Multi accounts - swipe on account icon

* Cleanup

* Multi accounts - fix other implementation of SessionStore

* Multi accounts - fix PreferencesRootPresenterTest

* Multi accounts - Add test on AccountSelectPresenter

* Multi accounts - Fix test on HomePresenter - WIP

* Update database to be able to sort accounts by creation date.

* Add unit test on takeCurrentUserWithNeighbors

* Fix test and improve code.

* Add exception

* Multi accounts - handle permalink

* Code quality

* Multi accounts - localization

* Fix issue after rebase on develop

* Fix issue after rebase on develop

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Update Multi accounts flag details.

* Add missing test on DatabaseSessionStore

* Add missing preview on LoginModeView

* Remove dead code.

* Add missing preview on PushHistoryView

* Document API.

* Rename API and update test.

* Remove MatrixAuthenticationService.loggedInStateFlow()

* Update screenshots

* Remove unused import

* Add exception

* Fix compilation issue after rebase on develop.

* Update screenshots

* Fix test

* Avoid calling getLatestSession() twice

* Rename `matrixUserAndNeighbors` to `currentUserAndNeighbors`

* Extract code to its own class.

* Add comment to clarify the code.

* Init current user profile with what we now have in the database.

It allows having the cached data (user display name and avatar) when starting the application when no network is available.

* Let the RustMatrixClient update the profile in the session database

* Fix test.

* When logging out from Pin code screen, logout from all the sessions.

tom

* Make PushData.clientSecret mandatory.
Also do not restore the last session as a fallback, it can lead to error in a multi account context, or even when a ghost pusher send a Push.

* Change test in RustMatrixAuthenticationServiceTest

* Do not use MatrixAuthenticationService in RootFlowNode, only use SessionStore

* Remove MatrixAuthenticationService.getLatestSessionId()

* Fix compilation issue after merging develop

* Add test on DefaultAccountSelectEntryPoint

* Fix compilation issue after merging develop

* Introduce LoggedInAccountSwitcherNode, to improve animation when switching between accounts.

* Rename Node to follow naming convention.

* Fix navigation issue after login.

* Remove unused import

* Revert "Fix navigation issue after login."

This reverts commit e409630856d7a7e741548016d7afe174ff1b40f7.

* Revert "Rename Node to follow naming convention."

This reverts commit 883b1f37c7207512d9f6605749977ad9045846a1.

* Revert "Introduce LoggedInAccountSwitcherNode, to improve animation when switching between accounts."

This reverts commit 9c698ff8152aceb5fd2b8b5ab5f609d28de64d24.

* Metro now have `@AssistedInject`.

* Update screenshots

* Introduce DelegateTransitionHandler and use it in RootFlowNode

---------

Co-authored-by: ElementBot <android@element.io>
Co-authored-by: ganfra <francoisg@element.io>
2025-09-26 15:45:06 +02:00