-
Notifications
You must be signed in to change notification settings - Fork 499
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
Technical Analytics: Milestone 2 - Add Ability To Log Feature Flags #5240
base: develop
Are you sure you want to change the base?
Technical Analytics: Milestone 2 - Add Ability To Log Feature Flags #5240
Conversation
… persistent cache store
Co-authored-by: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com>
…o a common constants file
…a/oppia-android into technical-analytics-milestone-1
…implify sync monitoring
…a/oppia-android into technical-analytics-milestone-1
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.
Thanks @kkmurerwa! Just a few follow-ups--PTAL.
domain/src/main/java/org/oppia/android/domain/oppialogger/LoggingIdentifierController.kt
Outdated
Show resolved
Hide resolved
...src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt
Outdated
Show resolved
Hide resolved
domain/src/test/java/org/oppia/android/domain/oppialogger/LoggingIdentifierControllerTest.kt
Show resolved
Hide resolved
Hi @kkmurerwa, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
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.
Thanks @kkmurerwa! It seems all that's left here is for the logging identifier controller test to be finalized once #5409 is merged. Please assign back once that's done.
…a/oppia-android into technical-analytics-milestone-2
@BenHenning PTAL at this PR. The tests are okay now. |
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.
Thanks @kkmurerwa! The new test looks good, I just had one suggestion for reformatting. PTAL.
val appSessionIdProvider = loggingIdentifierController.getAppSessionId() | ||
|
||
val appSessionId = monitorFactory.waitForNextSuccessfulResult(appSessionIdProvider) | ||
assertThat(appSessionId).isEqualTo("2a11efe0-70f8-3a40-8d94-4fc3a2bd4f14") | ||
|
||
// Simulate a second app open. | ||
TestLoggingIdentifierModule.applicationIdSeed = SECOND_APP_OPEN_APPLICATION_ID | ||
setUpNewTestApplicationComponent() | ||
|
||
val appSessionIdProvider2 = loggingIdentifierController.getAppSessionId() | ||
|
||
// The app session ID should be different on the second app open. | ||
val appSessionId2 = monitorFactory.waitForNextSuccessfulResult(appSessionIdProvider2) | ||
assertThat(appSessionId2).isEqualTo("c9d50545-33dc-3231-a1db-6a2672498c74") |
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.
val appSessionIdProvider = loggingIdentifierController.getAppSessionId() | |
val appSessionId = monitorFactory.waitForNextSuccessfulResult(appSessionIdProvider) | |
assertThat(appSessionId).isEqualTo("2a11efe0-70f8-3a40-8d94-4fc3a2bd4f14") | |
// Simulate a second app open. | |
TestLoggingIdentifierModule.applicationIdSeed = SECOND_APP_OPEN_APPLICATION_ID | |
setUpNewTestApplicationComponent() | |
val appSessionIdProvider2 = loggingIdentifierController.getAppSessionId() | |
// The app session ID should be different on the second app open. | |
val appSessionId2 = monitorFactory.waitForNextSuccessfulResult(appSessionIdProvider2) | |
assertThat(appSessionId2).isEqualTo("c9d50545-33dc-3231-a1db-6a2672498c74") | |
monitorFactory.ensureDataProviderExecutes(loggingIdentifierController.getAppSessionId()) | |
// Simulate a second app open. | |
TestLoggingIdentifierModule.applicationIdSeed = SECOND_APP_OPEN_APPLICATION_ID | |
setUpNewTestApplicationComponent() | |
// The app session ID should be different on the second app open. | |
val appSessionIdProvider = loggingIdentifierController.getAppSessionId() | |
val appSessionId = monitorFactory.waitForNextSuccessfulResult(appSessionIdProvider) | |
assertThat(appSessionId).isEqualTo("c9d50545-33dc-3231-a1db-6a2672498c74") |
Couple things:
- It's generally preferred to have just a single assert step (since otherwise it means the test is verifying more than one behavior, and we want to keep tests focused on one behavior at a time). We can rely on the earlier tests to verify that the "before" state is correct.
- This rearrangement intends to make the 'arrange/act/assert' blocks of the test a bit clearer.
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.
@BenHenning Thanks for this. I have updated the test to have a better flow.
Also @kkmurerwa please update the PR with the latest develop. |
Explanation
When merged, this PR will:
FeatureFlagLogger.kt
file that aggregates and logs all feature flags.FeatureFlagLoggerTest.kt
to test the FeatureFlagLogger.ApplicationLifecycleObserver.kt
file so that it is logged when the app is in foreground.Screenshot of the FeatureFlagContext log in the Event Logs page
Essential Checklist
For UI-specific PRs only
If your PR includes UI-related changes, then: