Skip to content

Commit

Permalink
Rebase and trim test
Browse files Browse the repository at this point in the history
  • Loading branch information
bidetofevil committed Jul 26, 2024
1 parent fb147b1 commit 486b738
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 444 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal class LoadEventEmitter(
private val openEvents: LoadEvents,
private val clock: Clock,
private val versionChecker: VersionChecker,

Check warning on line 14 in embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt

View check run for this annotation

Codecov / codecov/patch

embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt#L11-L14

Added lines #L11 - L14 were not covered by tests
): ActivityLifecycleListener {
) : ActivityLifecycleListener {
override fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?) {
create(activity)

Check warning on line 17 in embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt

View check run for this annotation

Codecov / codecov/patch

embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt#L17

Added line #L17 was not covered by tests
}
Expand Down Expand Up @@ -106,4 +106,4 @@ internal class LoadEventEmitter(
private fun traceInstanceId(activity: Activity): Int = activity.hashCode()

Check warning on line 106 in embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt

View check run for this annotation

Codecov / codecov/patch

embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt#L106

Added line #L106 was not covered by tests

private fun nowMs(): Long = clock.now().nanosToMillis()

Check warning on line 108 in embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt

View check run for this annotation

Codecov / codecov/patch

embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/internal/capture/activity/LoadEventEmitter.kt#L108

Added line #L108 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ internal interface LoadEvents {
enum class EndEvent(val eventName: String) {
RENDER("render"), RESUME("open")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ internal class LoadTraceEmitter(
}

private fun traceName(
activityName: String,
activityName: String,
openType: LoadEvents.OpenType
): String = "$activityName-${openType.typeName}-${getEndEvent().eventName}"

Expand All @@ -171,7 +171,7 @@ internal class LoadTraceEmitter(
RESUME("resume"),
RENDER("render");

fun spanName(activityName: String): String = "activity-$typeName-$activityName"
fun spanName(activityName: String): String = "$activityName-$typeName"
}

private data class ActivityLoadTrace(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.embrace.android.embracesdk.internal.injection

import io.embrace.android.embracesdk.internal.capture.activity.LoadTraceEmitter
import io.embrace.android.embracesdk.internal.capture.crumbs.BreadcrumbService
import io.embrace.android.embracesdk.internal.capture.crumbs.PushNotificationCaptureService
import io.embrace.android.embracesdk.internal.capture.startup.AppStartupDataCollector
import io.embrace.android.embracesdk.internal.capture.startup.StartupService
import io.embrace.android.embracesdk.internal.capture.startup.StartupTracker
import io.embrace.android.embracesdk.internal.capture.webview.WebViewService
import io.embrace.android.embracesdk.internal.session.lifecycle.ActivityLifecycleListener

/**
* This modules provides services that capture data from within an application. It could be argued
Expand Down Expand Up @@ -40,5 +40,5 @@ internal interface DataCaptureServiceModule {

val appStartupDataCollector: AppStartupDataCollector

val activityCreateTraceEmitter: ActivityLifecycleListener
val activityCreateTraceEmitter: LoadTraceEmitter
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.embrace.android.embracesdk.internal.injection

import io.embrace.android.embracesdk.internal.Systrace
import io.embrace.android.embracesdk.internal.capture.activity.LoadTraceEmitter
import io.embrace.android.embracesdk.internal.capture.crumbs.BreadcrumbService
import io.embrace.android.embracesdk.internal.capture.crumbs.EmbraceBreadcrumbService
import io.embrace.android.embracesdk.internal.capture.crumbs.PushNotificationCaptureService
Expand Down Expand Up @@ -69,9 +70,8 @@ internal class DataCaptureServiceModuleImpl @JvmOverloads constructor(
)
}

override val activityCreateTraceEmitter: ActivityCreateTraceEmitter by singleton {
ActivityCreateTraceEmitter(
clock = initModule.openTelemetryClock,
override val activityCreateTraceEmitter: LoadTraceEmitter by singleton {
LoadTraceEmitter(
spanService = openTelemetryModule.spanService,
backgroundWorker = workerThreadModule.backgroundWorker(WorkerName.BACKGROUND_REGISTRATION),
versionChecker = versionChecker,
Expand Down
Loading

0 comments on commit 486b738

Please sign in to comment.