Skip to content

Introduce crashlogging / Sentry #109

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
merged 17 commits into from
Aug 13, 2025
Merged

Introduce crashlogging / Sentry #109

merged 17 commits into from
Aug 13, 2025

Conversation

wzieba
Copy link
Member

@wzieba wzieba commented Aug 12, 2025

Closes: AINFRA-954

Description

This PR introduces integration of Sentry via our internal crashlogging wrapper. In addition, it introduces Sentry Gradle Plugin to send mapping files and source context.

Screenshots

Proguard deobfuscation + source context works fine

Screenshot 2025-08-12 at 17 39 02

Providing user data works fine as well

Screenshot 2025-08-12 at 18 04 30

Testing Steps

Install the prototype build and observe Sentry dashboard for incoming events (there's a test error reported on app start).

🚨 Before merge 🚨

git revert f672f18

@wpmobilebot
Copy link

wpmobilebot commented Aug 12, 2025

📲 You can test the changes from this Pull Request in Gravatar Android by scanning the QR code below to install the corresponding build.
App NameGravatar Android
Build TypeRelease
Commit791097c
Direct Downloadgravatar-app-prototype-build-pr109-791097c.apk

@wzieba wzieba changed the title Introduce crashlogging Introduce crashlogging / Sentry Aug 12, 2025
It doesn't seem to be needed in the current configuration
@wzieba wzieba added Do Not Merge enhancement New feature or request labels Aug 12, 2025
@wzieba wzieba requested a review from Copilot August 12, 2025 16:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates Sentry crash logging into the Gravatar Android app through an internal crashlogging wrapper module. The integration includes automatic crash reporting, user context tracking, and build-time source mapping for production releases.

Key changes:

  • Introduces a new crashlogging module with Gravatar-specific crash logging configuration
  • Adds Sentry Gradle Plugin for mapping file uploads and source context in CI builds
  • Updates dependency management to support the crash logging integration

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crashlogging/ New module implementing Sentry integration with user data and locale providers
app/ Integrates crash logging module and initializes Sentry in the application
build-logic/convention/ Adds Sentry Gradle Plugin configuration for automated mapping uploads
gradle/libs.versions.toml Updates dependency versions and adds Sentry-related libraries
loginUi/build.gradle.kts Refactors secrets properties function name for consistency
userComponent/build.gradle.kts Changes Gravatar core dependency from implementation to api
settings.gradle.kts Includes the new crashlogging module

@wzieba
Copy link
Member Author

wzieba commented Aug 12, 2025

Requesting review from multiple people here to speed up the process (I start AFK the day after tomorrow). 1 review will be completely fine 👍 Thanks!

@wzieba wzieba marked this pull request as ready for review August 12, 2025 16:40

internal class GravatarCrashLoggingDataProvider(
localeProvider: LocaleProvider,
userRepository: UserRepository
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware that this can circular DI dependency if crashlogging was about to be used in userComponent module. It's possible to address it one way or another, but until it won't be needed, I think there's no point to make this setup more complex now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although not ideal and I would imagine pushing the new profile (or rather CrashLoggingUser) when updated outside of the module rather than depending on the :userComponent I think this is okay for now.

if crashlogging was about to be used in userComponent module.

I assume that fatal crashes are reported automatically. So that would only be needed if we wanted to report non-fatal ones, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although not ideal and I would imagine pushing the new profile

I get you, but I also like the reactiveness of this solution - it'd be great if code related to user wouldn't have to remember about pushing a new profile to things like "crash logging".

I assume that fatal crashes are reported automatically. So that would only be needed if we wanted to report non-fatal ones, correct?

True, you're correct! 👍

Copy link

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @wzieba !

I have reviewed and tested this PR as per the instructions, everything works as expected, nicely done introducing Sentry here! 💯 x 💯 ^ 💯


I've tested the overall solution building the release build on CLI using this command below, and everything is working exactly as expected (give-or-take the mappings upload, see question).

CI=true SENTRY_AUTH_TOKEN=<SENTRY_AUTH_TOKEN> ./gradlew assembleRelease

ProGuard Deobfuscation + Source Context: ✅

image

User Data: ✅

image

Sentry ProGuard Mapping Upload: ✅ (ish, , see question)

image image

I have left one question (❓), few suggestions (💡) and one minor (🔍) comments for you to consider. I am going to approve this PR anyway, since none is blocking. I am NOT going to merge this PR yet to give you some time to apply any of my suggestions. However, feel free to ignore them and merge the PR yourself.

Copy link
Contributor

@AdamGrzybkowski AdamGrzybkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the crashes ✅ I left one question but other than that it looks good.


internal class GravatarCrashLoggingDataProvider(
localeProvider: LocaleProvider,
userRepository: UserRepository
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although not ideal and I would imagine pushing the new profile (or rather CrashLoggingUser) when updated outside of the module rather than depending on the :userComponent I think this is okay for now.

if crashlogging was about to be used in userComponent module.

I assume that fatal crashes are reported automatically. So that would only be needed if we wanted to report non-fatal ones, correct?

@wzieba wzieba enabled auto-merge August 13, 2025 15:35
@ParaskP7
Copy link

Thanks for the update @wzieba , another ✅ from me! :shipit:

@wzieba wzieba merged commit a22e0b6 into trunk Aug 13, 2025
9 of 10 checks passed
@wzieba wzieba deleted the introduce_crashlogging branch August 13, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants