Skip to content
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

Fixes #5243: Technical Analytics Milestone 3 - New App Health Metrics #5320

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b8b1360
feat: Add code for the onboarding completed logs
kkmurerwa Jan 2, 2024
c78b85a
feat: Add event contexts for app-in-foregroun-time, retrofit calls an…
kkmurerwa Jan 2, 2024
60304b6
feat: Add ability to log app-in-foreground-time
kkmurerwa Jan 2, 2024
bf7534f
feat: Add implementations for the various logs created
kkmurerwa Jan 4, 2024
6c42dfe
fix: Fix linting issues
kkmurerwa Jan 4, 2024
c10fecd
chore: Add dependencies to ensure bazel builds
kkmurerwa Jan 4, 2024
cdfc748
Merge branch 'oppia:develop' into technical-analytics-milestone-3
kkmurerwa Jan 4, 2024
f45e165
backup: Push failing changes for backup purposes
kkmurerwa Jan 9, 2024
56d99e7
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Jan 23, 2024
f69d31d
feat: Add some tests for the network logging interceptor
kkmurerwa Jan 23, 2024
07a16d7
fix: False positives on the logging interceptor tests
kkmurerwa Jan 23, 2024
5961680
feat: Add comprehensive tests for the logging interceptor.
kkmurerwa Jan 23, 2024
b03b19f
feat: Add test file for the console logger
kkmurerwa Jan 23, 2024
466f2ce
feat: Add test file for the console logger file
kkmurerwa Jan 23, 2024
a97d6ea
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Jan 29, 2024
a02af61
feat: Add ability to log app-onboarding completed
kkmurerwa Jan 30, 2024
300b16b
Merge branch 'technical-analytics-milestone-3' of github.com:kkmurerw…
kkmurerwa Jan 30, 2024
14b6138
fix: Fix failing lint checks
kkmurerwa Jan 30, 2024
720178d
fix: Fix failing tests on app and data modules
kkmurerwa Jan 30, 2024
932b0e5
fix: Fix failing test on NetworkModuleTest
kkmurerwa Jan 30, 2024
acb4ff4
fix: Fix failing tests
kkmurerwa Jan 30, 2024
c80c78b
fix: Fix failing tests
kkmurerwa Jan 30, 2024
0adff1a
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Feb 3, 2024
67ddb4e
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Feb 8, 2024
bf9039a
fix: Make changes from preliminary review
kkmurerwa Feb 9, 2024
e14781c
merge changes from develop
kkmurerwa Feb 9, 2024
f8cd1b2
fix: Fix failing tests
kkmurerwa Feb 12, 2024
5cb647f
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Feb 13, 2024
e306487
fix: Fix flaky tests on ApplicationLifecycleObserverTest class
kkmurerwa Feb 15, 2024
db5e237
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Feb 15, 2024
6cb4104
chore: Make improvements to test classes
kkmurerwa Feb 15, 2024
58f44f2
test: Add integration tests for the flow observers in the AnalyticsCo…
kkmurerwa Feb 19, 2024
fed6626
fix: Fix lint issues
kkmurerwa Feb 19, 2024
1762518
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Feb 20, 2024
6b748cb
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Mar 6, 2024
778fe4d
chore: Reset erroneous change
kkmurerwa Mar 6, 2024
713f99e
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Mar 13, 2024
e0cbb02
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Mar 25, 2024
0474e1f
fix: Add fixes for latest suggestions after review
kkmurerwa Apr 1, 2024
773f0f2
fix: Fix lint issues
kkmurerwa Apr 1, 2024
4106575
chore: Remove commented out code
kkmurerwa Apr 7, 2024
78dc3e1
Merge branch 'develop' into technical-analytics-milestone-3
kkmurerwa Apr 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class NetworkLoggingInterceptorTest {
}

@Test
fun testLoggingInterceptor_makeNetworkCall_emitsRetrofitCallContext() = runBlockingTest {
fun testLoggingInterceptor_makeNetworkCall_succeeds() = runBlockingTest {
mockWebServer.enqueue(MockResponse().setBody(testResponseBody))
client.newCall(request).execute()
testCoroutineDispatchers.advanceUntilIdle()
Expand All @@ -102,7 +102,8 @@ class NetworkLoggingInterceptorTest {
}

@Test
fun testLoggingInterceptor_makeFailingNetworkCall_emitsRetrofitCall_andCallFailedContext() =
// fun testLoggingInterceptor_makeFailingNetworkCall_emitsRetrofitCall_andCallFailedContext() =
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
fun testLoggingInterceptor_makeNetworkCallWithInvalidUrl_failsAndCompletes() =
runBlockingTest {
val pageNotFound = HttpURLConnection.HTTP_NOT_FOUND
val mockResponse = MockResponse()
Expand Down Expand Up @@ -137,7 +138,7 @@ class NetworkLoggingInterceptorTest {
}

@Test
fun testLoggingInterceptor_makeCrashingNetworkCall_emitsRetrofitCallFailedContext() =
fun testLoggingInterceptor_makeCrashingNetworkCall_failsAndCompletes() =
runBlockingTest {
mockWebServer.shutdown()
try { client.newCall(request).execute() } catch (e: Exception) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ApplicationLifecycleObserver @Inject constructor(
}.invokeOnCompletion { failure ->
if (failure != null) {
oppiaLogger.e(
"ActivityLifecycleObserver",
"ApplicationLifecycleObserver",
"Encountered error while trying to log app's time in the foreground.",
failure
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import java.net.HttpURLConnection
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.APP_IN_FOREGROUND_TIME

private const val TEST_TIMESTAMP_IN_MILLIS_ONE = 1556094000000
private const val TEST_TIMESTAMP_IN_MILLIS_TWO = 1556094100000
Expand Down Expand Up @@ -421,19 +422,19 @@ class ApplicationLifecycleObserverTest {
applicationLifecycleObserver.onAppInBackground()
testCoroutineDispatchers.runCurrent()

val eventLog = getOneOfLastTwoEventsLogged(ActivityContextCase.APP_IN_FOREGROUND_TIME)
val eventLog = getOneOfLastTwoEventsLogged(APP_IN_FOREGROUND_TIME)
val eventLogContext = eventLog.context

assertThat(eventLogContext.activityContextCase)
.isEqualTo(ActivityContextCase.APP_IN_FOREGROUND_TIME)
.isEqualTo(APP_IN_FOREGROUND_TIME)
assertThat(eventLogContext.appInForegroundTime.foregroundTime.toLong())
.isEqualTo(TEST_TIMESTAMP_APP_IN_FOREGROUND_MILLIS)
assertThat(eventLogContext.appInForegroundTime.appSessionId).isEqualTo(sessionId)
assertThat(eventLogContext.appInForegroundTime.installationId).isEqualTo(installationId)
}

@Test
fun testObserver_onAppInForeground_observesAndLogsConsoleErrors() {
fun testObserver_onAppInForeground_onConsoleError_logsConsoleErrors() {
setUpTestApplicationComponent()

applicationLifecycleObserver.onCreate()
Expand All @@ -456,7 +457,7 @@ class ApplicationLifecycleObserverTest {
}

@Test
fun testObserver_onAppInForeground_observesAndLogsNetworkCalls() {
fun testObserver_onAppInForeground_onNetworkCall_logsNetworkCalls() {
setUpTestApplicationComponent()
setUpRetrofitApiCall()

Expand All @@ -481,7 +482,7 @@ class ApplicationLifecycleObserverTest {
}

@Test
fun testObserver_onAppInForeground_observesAndLogsFailedNetworkCalls() {
fun testObserver_onAppInForeground_onNetworkCall_logsFailedNetworkCalls() {
setUpTestApplicationComponent()
setUpRetrofitApiCall()

Expand Down