From f58d212ac148c560c315028b7a5a69bc2d256231 Mon Sep 17 00:00:00 2001 From: Surbhi Agarwal Date: Wed, 27 Nov 2024 14:33:42 -0800 Subject: [PATCH 1/5] Extarct modules from core --- android-agent/build.gradle.kts | 1 + .../android/agent/OtelRumConfigExtensions.kt | 2 +- common/build.gradle.kts | 24 +++++++++++++++++++ common/consumer-rules.pro | 0 .../android/common/RumConstants.java | 0 .../common}/RuntimeDetailsExtractor.java | 2 +- .../CurrentNetworkAttributesExtractor.java | 4 ++-- .../features/networkattrs}/data/Carrier.kt | 2 +- .../networkattrs}/data/CurrentNetwork.java | 2 +- .../networkattrs}/data/NetworkState.java | 2 +- .../common}/RuntimeDetailsExtractorTest.java | 2 +- ...CurrentNetworkAttributesExtractorTest.java | 8 +++---- core/build.gradle.kts | 7 ++++-- .../NetworkAttributesSpanAppender.java | 3 ++- .../android/OpenTelemetryRumBuilderTest.java | 2 +- .../NetworkAttributesSpanAppenderTest.java | 4 ++-- instrumentation/activity/build.gradle.kts | 4 +++- .../android-instrumentation/build.gradle.kts | 21 ++++++++++++++++ .../consumer-rules.pro | 0 .../instrumentation/AndroidInstrumentation.kt | 2 -- .../AndroidInstrumentationLoader.kt | 2 +- .../instrumentation/InstallationContext.kt | 0 .../AndroidInstrumentationLoaderImpl.kt | 2 +- .../AndroidInstrumentationLoaderTest.kt | 0 .../TestAndroidInstrumentation.kt | 15 ++++++++++++ .../AndroidInstrumentationLoaderImplTest.kt | 2 +- ...oid.instrumentation.AndroidInstrumentation | 1 + instrumentation/anr/build.gradle.kts | 3 ++- instrumentation/common-api/build.gradle.kts | 2 +- instrumentation/crash/build.gradle.kts | 4 +++- .../crash/CrashReporterInstrumentation.java | 2 +- instrumentation/fragment/build.gradle.kts | 4 +++- .../library/build.gradle.kts | 2 +- instrumentation/network/build.gradle.kts | 5 ++-- .../network/NetworkApplicationListener.java | 2 +- .../NetworkChangeAttributesExtractor.java | 6 ++--- .../network/NetworkChangeInstrumentation.java | 2 +- .../network/NetworkChangeMonitor.java | 2 +- .../network/NetworkChangeMonitorTest.java | 6 ++--- .../okhttp-3.0/library/build.gradle.kts | 2 +- .../slowrendering/build.gradle.kts | 5 ++-- instrumentation/startup/build.gradle.kts | 3 +++ services/build.gradle.kts | 24 +++++++++++++++++++ services/consumer-rules.pro | 0 services/src/main/AndroidManifest.xml | 8 +++++++ .../internal/services/CacheStorage.java | 0 .../internal/services/Preferences.java | 3 +-- .../internal/services/ServiceManager.kt | 0 .../internal/services/ServiceManagerImpl.kt | 0 .../android/internal/services/Startable.java | 0 .../android/internal/services}/SystemTime.kt | 2 +- .../applifecycle/AppLifecycleService.kt | 0 .../ApplicationStateListener.java | 0 .../applifecycle/ApplicationStateWatcher.kt | 0 .../services/network/CarrierFinder.java | 2 +- .../network/CurrentNetworkProvider.java | 4 ++-- .../network/NetworkChangeListener.java | 2 +- .../network/detector/NetworkDetector.java | 2 +- .../detector/PostApi28NetworkDetector.java | 6 ++--- .../detector/SimpleNetworkDetector.java | 4 ++-- .../services/periodicwork/PeriodicRunnable.kt | 2 +- .../periodicwork/PeriodicWorkService.kt | 0 .../visiblescreen/VisibleScreenService.kt | 1 + .../DefaultingActivityLifecycleCallbacks.kt | 0 .../Pre29VisibleScreenLifecycleBinding.kt | 0 .../VisibleScreenLifecycleBinding.kt | 0 .../RumFragmentActivityRegisterer.java | 0 .../fragments/VisibleFragmentTracker.kt | 0 .../services/ServiceManagerImplTest.kt | 0 .../applifecycle/AppLifecycleServiceTest.kt | 0 .../ApplicationStateWatcherTest.java | 0 .../services/network/CarrierFinderTest.java | 2 +- .../network/CurrentNetworkProviderTest.java | 4 ++-- .../network/detector/NetworkDetectorTest.java | 0 .../PostApi28NetworkDetectorTest.java | 6 ++--- .../detector/SimpleNetworkDetectorTest.java | 4 ++-- .../periodicwork/PeriodicRunnableTest.kt | 2 +- .../periodicwork/PeriodicWorkServiceTest.kt | 0 .../VisibleScreenServiceTest.java | 0 ...re29VisibleScreenLifecycleBindingTest.java | 0 .../VisibleScreenLifecycleBindingTest.java | 0 .../RumFragmentActivityRegistererTest.java | 0 .../fragments/VisibleFragmentTrackerTest.kt | 0 settings.gradle.kts | 3 +++ 84 files changed, 178 insertions(+), 67 deletions(-) create mode 100644 common/build.gradle.kts create mode 100644 common/consumer-rules.pro rename {core => common}/src/main/java/io/opentelemetry/android/common/RumConstants.java (100%) rename {core/src/main/java/io/opentelemetry/android => common/src/main/java/io/opentelemetry/android/common}/RuntimeDetailsExtractor.java (98%) rename {core/src/main/java/io/opentelemetry/android => common/src/main/java/io/opentelemetry/android/common}/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java (91%) rename {core/src/main/java/io/opentelemetry/android/internal/services/network => common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs}/data/Carrier.kt (89%) rename {core/src/main/java/io/opentelemetry/android/internal/services/network => common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs}/data/CurrentNetwork.java (97%) rename {core/src/main/java/io/opentelemetry/android/internal/services/network => common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs}/data/NetworkState.java (92%) rename {core/src/test/java/io/opentelemetry/android => common/src/test/java/io/opentelemetry/android/common}/RuntimeDetailsExtractorTest.java (97%) rename {core/src/test/java/io/opentelemetry/android => common/src/test/java/io/opentelemetry/android/common}/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java (88%) create mode 100644 instrumentation/android-instrumentation/build.gradle.kts create mode 100644 instrumentation/android-instrumentation/consumer-rules.pro rename {core => instrumentation/android-instrumentation}/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt (97%) rename {core => instrumentation/android-instrumentation}/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt (95%) rename {core => instrumentation/android-instrumentation}/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt (100%) rename {core/src/main/java/io/opentelemetry/android/internal/instrumentation => instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal}/AndroidInstrumentationLoaderImpl.kt (95%) rename {core => instrumentation/android-instrumentation}/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt (100%) create mode 100644 instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt rename {core/src/test/java/io/opentelemetry/android/internal/instrumentation => instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal}/AndroidInstrumentationLoaderImplTest.kt (95%) create mode 100644 instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation create mode 100644 services/build.gradle.kts create mode 100644 services/consumer-rules.pro create mode 100644 services/src/main/AndroidManifest.xml rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/Preferences.java (87%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/Startable.java (100%) rename {core/src/main/java/io/opentelemetry/android/internal/tools/time => services/src/main/java/io/opentelemetry/android/internal/services}/SystemTime.kt (93%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java (95%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java (97%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java (79%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java (93%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java (95%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java (92%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt (96%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt (99%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java (100%) rename {core => services}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java (95%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java (98%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java (95%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java (97%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt (98%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java (100%) rename {core => services}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt (100%) diff --git a/android-agent/build.gradle.kts b/android-agent/build.gradle.kts index a162286fe..2312e2d16 100644 --- a/android-agent/build.gradle.kts +++ b/android-agent/build.gradle.kts @@ -9,6 +9,7 @@ android { dependencies { api(project(":core")) + implementation(project(":common")) implementation(libs.opentelemetry.instrumentation.api) // Default instrumentations: diff --git a/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt index c3a011208..141b1fc85 100644 --- a/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt +++ b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt @@ -5,6 +5,7 @@ package io.opentelemetry.android.agent +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork import io.opentelemetry.android.config.OtelRumConfig import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader import io.opentelemetry.android.instrumentation.activity.ActivityLifecycleInstrumentation @@ -15,7 +16,6 @@ import io.opentelemetry.android.instrumentation.crash.CrashReporterInstrumentati import io.opentelemetry.android.instrumentation.fragment.FragmentLifecycleInstrumentation import io.opentelemetry.android.instrumentation.network.NetworkChangeInstrumentation import io.opentelemetry.android.instrumentation.slowrendering.SlowRenderingInstrumentation -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork import io.opentelemetry.api.trace.Tracer import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor import java.time.Duration diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 000000000..5862bcdf7 --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id("otel.android-library-conventions") +} + +description = "OpenTelemetry android common utils" + +android { + namespace = "io.opentelemetry.android.common" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + +dependencies { + api(platform(libs.opentelemetry.platform.alpha)) + api(libs.opentelemetry.api) + implementation(libs.opentelemetry.sdk) + implementation(libs.opentelemetry.instrumentation.api) + implementation(libs.opentelemetry.semconv.incubating) + implementation(libs.androidx.core) + + testImplementation(libs.robolectric) +} diff --git a/common/consumer-rules.pro b/common/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/core/src/main/java/io/opentelemetry/android/common/RumConstants.java b/common/src/main/java/io/opentelemetry/android/common/RumConstants.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/common/RumConstants.java rename to common/src/main/java/io/opentelemetry/android/common/RumConstants.java diff --git a/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java b/common/src/main/java/io/opentelemetry/android/common/RuntimeDetailsExtractor.java similarity index 98% rename from core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java rename to common/src/main/java/io/opentelemetry/android/common/RuntimeDetailsExtractor.java index 307ff4c13..3c0ce9ceb 100644 --- a/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java +++ b/common/src/main/java/io/opentelemetry/android/common/RuntimeDetailsExtractor.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android; +package io.opentelemetry.android.common; import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; diff --git a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java similarity index 91% rename from core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java index 66eff3110..8916bf763 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.features.networkattrs; +package io.opentelemetry.android.common.internal.features.networkattrs; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_ICC; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_MCC; @@ -13,7 +13,7 @@ import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CONNECTION_TYPE; import androidx.annotation.Nullable; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/Carrier.kt similarity index 89% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/Carrier.kt index 5531892b1..99300ec4d 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/Carrier.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services.network.data +package io.opentelemetry.android.common.internal.features.networkattrs.data import android.os.Build import android.telephony.TelephonyManager diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/CurrentNetwork.java similarity index 97% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/CurrentNetwork.java index 56675b0fc..49d818468 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/CurrentNetwork.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services.network.data; +package io.opentelemetry.android.common.internal.features.networkattrs.data; import android.os.Build; import androidx.annotation.Nullable; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/NetworkState.java similarity index 92% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/NetworkState.java index cc178289d..93e6d3733 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/NetworkState.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services.network.data; +package io.opentelemetry.android.common.internal.features.networkattrs.data; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NetworkConnectionTypeIncubatingValues; diff --git a/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java b/common/src/test/java/io/opentelemetry/android/common/RuntimeDetailsExtractorTest.java similarity index 97% rename from core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java rename to common/src/test/java/io/opentelemetry/android/common/RuntimeDetailsExtractorTest.java index 17dc5c59c..2ccc197e6 100644 --- a/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java +++ b/common/src/test/java/io/opentelemetry/android/common/RuntimeDetailsExtractorTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android; +package io.opentelemetry.android.common; import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; diff --git a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java b/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java similarity index 88% rename from core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java rename to common/src/test/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java index 476bad126..844cdc39d 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java +++ b/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.features.networkattrs; +package io.opentelemetry.android.common.internal.features.networkattrs; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_ICC; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_MCC; @@ -14,9 +14,9 @@ import static org.assertj.core.api.Assertions.entry; import android.os.Build; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/build.gradle.kts b/core/build.gradle.kts index f3ba3cab5..9dfcdcec7 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -62,9 +62,11 @@ android { } dependencies { + implementation(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) + implementation(libs.androidx.core) - implementation(libs.androidx.navigation.fragment) - implementation(libs.androidx.lifecycle.process) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) @@ -74,6 +76,7 @@ dependencies { implementation(libs.opentelemetry.instrumentation.api) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.diskBuffering) + testImplementation(libs.opentelemetry.api.incubator) testImplementation(libs.androidx.test.core) testImplementation(libs.awaitility) diff --git a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java index f71e29c2e..a1b727d03 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java +++ b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java @@ -5,8 +5,9 @@ package io.opentelemetry.android.internal.features.networkattrs; +import io.opentelemetry.android.common.internal.features.networkattrs.CurrentNetworkAttributesExtractor; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.trace.ReadWriteSpan; diff --git a/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index 67d425115..28654643c 100644 --- a/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -34,8 +34,8 @@ import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader; import io.opentelemetry.android.instrumentation.InstallationContext; +import io.opentelemetry.android.instrumentation.internal.AndroidInstrumentationLoaderImpl; import io.opentelemetry.android.internal.initialization.InitializationEvents; -import io.opentelemetry.android.internal.instrumentation.AndroidInstrumentationLoaderImpl; import io.opentelemetry.android.internal.services.CacheStorage; import io.opentelemetry.android.internal.services.Preferences; import io.opentelemetry.android.internal.services.ServiceManager; diff --git a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java index 50e1cb23e..6537df2d0 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java +++ b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java @@ -12,9 +12,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.trace.ReadWriteSpan; diff --git a/instrumentation/activity/build.gradle.kts b/instrumentation/activity/build.gradle.kts index c92ee2ca0..dae90c26d 100644 --- a/instrumentation/activity/build.gradle.kts +++ b/instrumentation/activity/build.gradle.kts @@ -17,7 +17,9 @@ dependencies { api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) - api(project(":core")) + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) implementation(libs.opentelemetry.sdk) implementation(libs.androidx.core) implementation(libs.androidx.navigation.fragment) diff --git a/instrumentation/android-instrumentation/build.gradle.kts b/instrumentation/android-instrumentation/build.gradle.kts new file mode 100644 index 000000000..8ccb6dd87 --- /dev/null +++ b/instrumentation/android-instrumentation/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("otel.android-library-conventions") + id("otel.publish-conventions") +} + +description = "OpenTelemetry Android Instrumentation Auto Service" + +android { + namespace = "io.opentelemetry.android.instrumentation" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + +dependencies { + implementation(project(":services")) + + api(platform(libs.opentelemetry.platform.alpha)) + api(libs.opentelemetry.api) +} diff --git a/instrumentation/android-instrumentation/consumer-rules.pro b/instrumentation/android-instrumentation/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt similarity index 97% rename from core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt index c3934bfec..0cf57516e 100644 --- a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt +++ b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt @@ -5,8 +5,6 @@ package io.opentelemetry.android.instrumentation -import io.opentelemetry.android.OpenTelemetryRum - /** * This interface defines a tool that automatically generates telemetry for a specific use-case, * without the need for end users to directly interact with the OpenTelemetry SDK to create telemetry manually. diff --git a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt similarity index 95% rename from core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt index 480dc95c4..ec921b650 100644 --- a/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt +++ b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoader.kt @@ -5,7 +5,7 @@ package io.opentelemetry.android.instrumentation -import io.opentelemetry.android.internal.instrumentation.AndroidInstrumentationLoaderImpl +import io.opentelemetry.android.instrumentation.internal.AndroidInstrumentationLoaderImpl /** * Loads and provides [AndroidInstrumentation] instances from the runtime classpath. diff --git a/core/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/InstallationContext.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImpl.kt b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImpl.kt similarity index 95% rename from core/src/main/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImpl.kt rename to instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImpl.kt index cd4d91b1a..0228ae50a 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImpl.kt +++ b/instrumentation/android-instrumentation/src/main/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImpl.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.instrumentation +package io.opentelemetry.android.instrumentation.internal import io.opentelemetry.android.instrumentation.AndroidInstrumentation import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader diff --git a/core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt rename to instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationLoaderTest.kt diff --git a/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt new file mode 100644 index 000000000..deec8cab8 --- /dev/null +++ b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt @@ -0,0 +1,15 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.android.instrumentation + +class TestAndroidInstrumentation : AndroidInstrumentation { + var installed = false + private set + + override fun install(ctx: InstallationContext) { + installed = true + } +} diff --git a/core/src/test/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImplTest.kt similarity index 95% rename from core/src/test/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt rename to instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImplTest.kt index a4374859b..aaa42917b 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/instrumentation/AndroidInstrumentationLoaderImplTest.kt +++ b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/internal/AndroidInstrumentationLoaderImplTest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.instrumentation +package io.opentelemetry.android.instrumentation.internal import io.mockk.mockk import io.opentelemetry.android.instrumentation.TestAndroidInstrumentation diff --git a/instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation b/instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation new file mode 100644 index 000000000..ddf212907 --- /dev/null +++ b/instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation @@ -0,0 +1 @@ +io.opentelemetry.android.instrumentation.TestAndroidInstrumentation \ No newline at end of file diff --git a/instrumentation/anr/build.gradle.kts b/instrumentation/anr/build.gradle.kts index be9edc570..8621bc0d7 100644 --- a/instrumentation/anr/build.gradle.kts +++ b/instrumentation/anr/build.gradle.kts @@ -18,9 +18,10 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/common-api/build.gradle.kts b/instrumentation/common-api/build.gradle.kts index e845a681c..fd01a3fd9 100644 --- a/instrumentation/common-api/build.gradle.kts +++ b/instrumentation/common-api/build.gradle.kts @@ -14,7 +14,7 @@ android { } dependencies { - api(project(":core")) + implementation(project(":common")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) implementation(libs.androidx.navigation.fragment) diff --git a/instrumentation/crash/build.gradle.kts b/instrumentation/crash/build.gradle.kts index c03511dea..b84f22f4a 100644 --- a/instrumentation/crash/build.gradle.kts +++ b/instrumentation/crash/build.gradle.kts @@ -14,9 +14,11 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":common")) + implementation(project(":services")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java b/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java index 13dd2fe91..e7513115c 100644 --- a/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java +++ b/instrumentation/crash/src/main/java/io/opentelemetry/android/instrumentation/crash/CrashReporterInstrumentation.java @@ -7,7 +7,7 @@ import androidx.annotation.NonNull; import com.google.auto.service.AutoService; -import io.opentelemetry.android.RuntimeDetailsExtractor; +import io.opentelemetry.android.common.RuntimeDetailsExtractor; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.InstallationContext; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; diff --git a/instrumentation/fragment/build.gradle.kts b/instrumentation/fragment/build.gradle.kts index 1752678fa..e3de91974 100644 --- a/instrumentation/fragment/build.gradle.kts +++ b/instrumentation/fragment/build.gradle.kts @@ -17,7 +17,9 @@ dependencies { api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) - api(project(":core")) + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) implementation(libs.androidx.core) api(libs.androidx.navigation.fragment) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/httpurlconnection/library/build.gradle.kts b/instrumentation/httpurlconnection/library/build.gradle.kts index 447ae2e07..ea0b31b2c 100644 --- a/instrumentation/httpurlconnection/library/build.gradle.kts +++ b/instrumentation/httpurlconnection/library/build.gradle.kts @@ -10,10 +10,10 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(libs.opentelemetry.context) - api(project(":core")) implementation(libs.opentelemetry.instrumentation.apiSemconv) implementation(libs.opentelemetry.instrumentation.api) } diff --git a/instrumentation/network/build.gradle.kts b/instrumentation/network/build.gradle.kts index e0caa2c3b..abb4a3696 100644 --- a/instrumentation/network/build.gradle.kts +++ b/instrumentation/network/build.gradle.kts @@ -19,10 +19,11 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) - api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java index f0374032b..23a3d967d 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java @@ -7,10 +7,10 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.android.internal.services.network.NetworkChangeListener; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java index 47c50e857..9bf557e43 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java @@ -8,9 +8,9 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CONNECTION_TYPE; -import io.opentelemetry.android.internal.features.networkattrs.CurrentNetworkAttributesExtractor; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattrs.CurrentNetworkAttributesExtractor; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java index d0245db19..5e994be15 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java @@ -7,9 +7,9 @@ import androidx.annotation.NonNull; import com.google.auto.service.AutoService; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.InstallationContext; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import java.util.ArrayList; import java.util.Collections; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java index 39dbe2b8a..934451dfd 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.network; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; diff --git a/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java b/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java index 51df0f253..26424eb7f 100644 --- a/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java +++ b/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java @@ -18,13 +18,13 @@ import static org.mockito.Mockito.verify; import android.os.Build; +import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService; import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.android.internal.services.network.NetworkChangeListener; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule; import io.opentelemetry.sdk.trace.data.SpanData; import java.util.Collections; diff --git a/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts b/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts index b80525bb1..59861c4e3 100644 --- a/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts +++ b/instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts @@ -14,8 +14,8 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) compileOnly(libs.okhttp) api(libs.opentelemetry.instrumentation.okhttp) - api(project(":core")) implementation(libs.opentelemetry.instrumentation.apiSemconv) } diff --git a/instrumentation/slowrendering/build.gradle.kts b/instrumentation/slowrendering/build.gradle.kts index f5bd09c79..9df6786e5 100644 --- a/instrumentation/slowrendering/build.gradle.kts +++ b/instrumentation/slowrendering/build.gradle.kts @@ -14,10 +14,11 @@ android { } dependencies { + api(project(":instrumentation:android-instrumentation")) + implementation(project(":services")) + implementation(project(":common")) api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) - api(project(":core")) - api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/startup/build.gradle.kts b/instrumentation/startup/build.gradle.kts index fd802a2f7..91d61d1fc 100644 --- a/instrumentation/startup/build.gradle.kts +++ b/instrumentation/startup/build.gradle.kts @@ -17,6 +17,9 @@ dependencies { api(platform(libs.opentelemetry.platform.alpha)) api(libs.opentelemetry.api) api(project(":core")) + api(project(":instrumentation:android-instrumentation")) + implementation(project(":common")) + implementation(project(":services")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/services/build.gradle.kts b/services/build.gradle.kts new file mode 100644 index 000000000..587ca9bee --- /dev/null +++ b/services/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id("otel.android-library-conventions") +} + +description = "OpenTelemetry android internal services" + +android { + namespace = "io.opentelemetry.android.internal.services" + + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + +dependencies { + implementation(project(":common")) + + implementation(libs.androidx.core) + implementation(libs.androidx.navigation.fragment) + implementation(libs.androidx.lifecycle.process) + + testImplementation(libs.androidx.test.core) + testImplementation(libs.robolectric) +} diff --git a/services/consumer-rules.pro b/services/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/services/src/main/AndroidManifest.xml b/services/src/main/AndroidManifest.xml new file mode 100644 index 000000000..298c8b6e8 --- /dev/null +++ b/services/src/main/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java b/services/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java rename to services/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java b/services/src/main/java/io/opentelemetry/android/internal/services/Preferences.java similarity index 87% rename from core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java rename to services/src/main/java/io/opentelemetry/android/internal/services/Preferences.java index 6c600ac67..ebcd2788c 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/Preferences.java @@ -7,7 +7,6 @@ import android.content.Context; import android.content.SharedPreferences; -import io.opentelemetry.android.BuildConfig; /** * Utility to store and retrieve apps' preferences. @@ -21,7 +20,7 @@ public class Preferences { public static Preferences create(Context context) { return new Preferences( context.getSharedPreferences( - BuildConfig.LIBRARY_PACKAGE_NAME + ".prefs", Context.MODE_PRIVATE)); + "io.opentelemetry.android" + ".prefs", Context.MODE_PRIVATE)); } private Preferences(SharedPreferences sharedPreferences) { diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt b/services/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt b/services/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/Startable.java b/services/src/main/java/io/opentelemetry/android/internal/services/Startable.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/Startable.java rename to services/src/main/java/io/opentelemetry/android/internal/services/Startable.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt b/services/src/main/java/io/opentelemetry/android/internal/services/SystemTime.kt similarity index 93% rename from core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/SystemTime.kt index d5a76164f..212201a59 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt +++ b/services/src/main/java/io/opentelemetry/android/internal/services/SystemTime.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.tools.time +package io.opentelemetry.android.internal.services /** * Utility to be able to mock the current system time for testing purposes. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java b/services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java rename to services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt b/services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java similarity index 95% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java index 7690e0540..a4195da9f 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java @@ -8,7 +8,7 @@ import android.os.Build; import android.telephony.TelephonyManager; import androidx.annotation.RequiresApi; -import io.opentelemetry.android.internal.services.network.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java similarity index 97% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java index 2da0fcc9a..9879d60a3 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java @@ -15,9 +15,9 @@ import android.util.Log; import androidx.annotation.NonNull; import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.android.internal.services.Startable; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import io.opentelemetry.android.internal.services.network.detector.NetworkDetector; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java similarity index 79% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java index c1b46ba7f..04d683fd0 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.internal.services.network; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java similarity index 93% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java index 27a6483e9..830c286c0 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java @@ -9,8 +9,8 @@ import android.net.ConnectivityManager; import android.os.Build; import android.telephony.TelephonyManager; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; import io.opentelemetry.android.internal.services.network.CarrierFinder; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java similarity index 95% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java index 09edde22e..aadfbb7bb 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java @@ -18,10 +18,10 @@ import android.telephony.TelephonyManager; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; +import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.android.internal.services.network.CarrierFinder; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java similarity index 92% rename from core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java rename to services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java index bba6ef27a..f7d1dd30e 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java @@ -10,8 +10,8 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt similarity index 96% rename from core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt index 3fb9662a8..905b459ee 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt +++ b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt @@ -5,7 +5,7 @@ package io.opentelemetry.android.internal.services.periodicwork -import io.opentelemetry.android.internal.tools.time.SystemTime +import io.opentelemetry.android.internal.services.SystemTime /** * Utility for creating a Runnable that needs to run multiple times. diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt similarity index 99% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt index 6449fd9d8..0d412e726 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt +++ b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt @@ -17,6 +17,7 @@ import io.opentelemetry.android.internal.services.visiblescreen.activities.Visib import io.opentelemetry.android.internal.services.visiblescreen.fragments.RumFragmentActivityRegisterer import io.opentelemetry.android.internal.services.visiblescreen.fragments.VisibleFragmentTracker import java.util.concurrent.atomic.AtomicReference +import kotlin.jvm.javaClass /** * Wherein we do our best to figure out what "screen" is visible and what was the previously visible diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.kt diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt similarity index 100% rename from core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt rename to services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java similarity index 95% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java index 4d94d512c..e263a55aa 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java @@ -10,7 +10,7 @@ import static org.mockito.Mockito.when; import android.telephony.TelephonyManager; -import io.opentelemetry.android.internal.services.network.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; import org.junit.jupiter.api.Test; class CarrierFinderTest { diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java similarity index 98% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java index 4c7f6a72f..261f4c5cc 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java @@ -21,8 +21,8 @@ import android.net.Network; import android.net.NetworkRequest; import android.os.Build; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.android.internal.services.network.detector.NetworkDetector; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Assert; diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java similarity index 95% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java index 7acb9bea5..e40b73057 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java @@ -15,10 +15,10 @@ import android.net.NetworkCapabilities; import android.os.Build; import android.telephony.TelephonyManager; +import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import io.opentelemetry.android.internal.services.network.CarrierFinder; -import io.opentelemetry.android.internal.services.network.data.Carrier; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java similarity index 97% rename from core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java index 697fbd551..64a1299dd 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java @@ -13,8 +13,8 @@ import android.net.NetworkInfo; import android.os.Build; import androidx.test.core.app.ApplicationProvider; -import io.opentelemetry.android.internal.services.network.data.CurrentNetwork; -import io.opentelemetry.android.internal.services.network.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt similarity index 98% rename from core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt index 8013ac01a..369330500 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt +++ b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt @@ -10,7 +10,7 @@ import io.mockk.every import io.mockk.just import io.mockk.mockk import io.mockk.verify -import io.opentelemetry.android.internal.tools.time.SystemTime +import io.opentelemetry.android.internal.services.SystemTime import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java diff --git a/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt similarity index 100% rename from core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt rename to services/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index 0ed23cc0d..b095e855c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,3 +18,6 @@ include(":instrumentation:httpurlconnection:agent") include(":instrumentation:httpurlconnection:library") include(":instrumentation:httpurlconnection:testing") include(":test-common") +include(":instrumentation:android-instrumentation") +include(":services") +include(":common") From a49ff87cc30a5b84bb0480b6e4a8446c51bb3495 Mon Sep 17 00:00:00 2001 From: Surbhi Agarwal Date: Mon, 2 Dec 2024 18:55:23 -0800 Subject: [PATCH 2/5] Move SystemTime to common module --- .../android/common/internal/tools/time}/SystemTime.kt | 4 ++-- .../internal/services/periodicwork/PeriodicRunnable.kt | 2 +- .../internal/services/periodicwork/PeriodicRunnableTest.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename {services/src/main/java/io/opentelemetry/android/internal/services => common/src/main/java/io/opentelemetry/android/common/internal/tools/time}/SystemTime.kt (89%) diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/SystemTime.kt b/common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt similarity index 89% rename from services/src/main/java/io/opentelemetry/android/internal/services/SystemTime.kt rename to common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt index 212201a59..64ff0778e 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/SystemTime.kt +++ b/common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.internal.services +package io.opentelemetry.android.common.internal.tools.time /** * Utility to be able to mock the current system time for testing purposes. @@ -11,7 +11,7 @@ package io.opentelemetry.android.internal.services *

This class is internal and not for public use. Its APIs are unstable and can change at any * time. */ -internal interface SystemTime { +interface SystemTime { companion object { private var instance: SystemTime = DefaultSystemTime() diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt index 905b459ee..5ddd3c68f 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt +++ b/services/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt @@ -5,7 +5,7 @@ package io.opentelemetry.android.internal.services.periodicwork -import io.opentelemetry.android.internal.services.SystemTime +import io.opentelemetry.android.common.internal.tools.time.SystemTime /** * Utility for creating a Runnable that needs to run multiple times. diff --git a/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt index 369330500..9be39c642 100644 --- a/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt +++ b/services/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt @@ -10,7 +10,7 @@ import io.mockk.every import io.mockk.just import io.mockk.mockk import io.mockk.verify -import io.opentelemetry.android.internal.services.SystemTime +import io.opentelemetry.android.common.internal.tools.time.SystemTime import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test From 97c367cb6f3016c1365210bc801d39be0b35aa3e Mon Sep 17 00:00:00 2001 From: Surbhi Agarwal Date: Mon, 2 Dec 2024 20:57:16 -0800 Subject: [PATCH 3/5] Remove TestAndroidInstrumentation from core and check if tests still work --- .../instrumentation/TestAndroidInstrumentation.kt | 15 --------------- ...android.instrumentation.AndroidInstrumentation | 1 - 2 files changed, 16 deletions(-) delete mode 100644 core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt delete mode 100644 core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation diff --git a/core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt b/core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt deleted file mode 100644 index deec8cab8..000000000 --- a/core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.android.instrumentation - -class TestAndroidInstrumentation : AndroidInstrumentation { - var installed = false - private set - - override fun install(ctx: InstallationContext) { - installed = true - } -} diff --git a/core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation b/core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation deleted file mode 100644 index ddf212907..000000000 --- a/core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation +++ /dev/null @@ -1 +0,0 @@ -io.opentelemetry.android.instrumentation.TestAndroidInstrumentation \ No newline at end of file From 8518950d4e4d328f6623ba9d8ce4bb4d66f59b47 Mon Sep 17 00:00:00 2001 From: Surbhi Agarwal Date: Thu, 5 Dec 2024 13:42:12 -0800 Subject: [PATCH 4/5] Rename networkattrs to networkattributes --- .../android/agent/OtelRumConfigExtensions.kt | 2 +- .../CurrentNetworkAttributesExtractor.java | 4 ++-- .../{networkattrs => networkattributes}/data/Carrier.kt | 2 +- .../data/CurrentNetwork.java | 2 +- .../data/NetworkState.java | 2 +- .../CurrentNetworkAttributesExtractorTest.java | 8 ++++---- .../networkattrs/NetworkAttributesSpanAppender.java | 4 ++-- .../networkattrs/NetworkAttributesSpanAppenderTest.java | 4 ++-- .../network/NetworkApplicationListener.java | 2 +- .../network/NetworkChangeAttributesExtractor.java | 6 +++--- .../network/NetworkChangeInstrumentation.java | 2 +- .../instrumentation/network/NetworkChangeMonitor.java | 2 +- .../instrumentation/network/NetworkChangeMonitorTest.java | 6 +++--- .../android/internal/services/network/CarrierFinder.java | 2 +- .../internal/services/network/CurrentNetworkProvider.java | 4 ++-- .../internal/services/network/NetworkChangeListener.java | 2 +- .../services/network/detector/NetworkDetector.java | 2 +- .../network/detector/PostApi28NetworkDetector.java | 6 +++--- .../services/network/detector/SimpleNetworkDetector.java | 4 ++-- .../internal/services/network/CarrierFinderTest.java | 2 +- .../services/network/CurrentNetworkProviderTest.java | 4 ++-- .../network/detector/PostApi28NetworkDetectorTest.java | 6 +++--- .../network/detector/SimpleNetworkDetectorTest.java | 4 ++-- 23 files changed, 41 insertions(+), 41 deletions(-) rename common/src/main/java/io/opentelemetry/android/common/internal/features/{networkattrs => networkattributes}/CurrentNetworkAttributesExtractor.java (97%) rename common/src/main/java/io/opentelemetry/android/common/internal/features/{networkattrs => networkattributes}/data/Carrier.kt (97%) rename common/src/main/java/io/opentelemetry/android/common/internal/features/{networkattrs => networkattributes}/data/CurrentNetwork.java (99%) rename common/src/main/java/io/opentelemetry/android/common/internal/features/{networkattrs => networkattributes}/data/NetworkState.java (98%) rename common/src/test/java/io/opentelemetry/android/common/internal/features/{networkattrs => networkattributes}/CurrentNetworkAttributesExtractorTest.java (96%) diff --git a/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt index 141b1fc85..4139ae9a8 100644 --- a/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt +++ b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt @@ -5,7 +5,7 @@ package io.opentelemetry.android.agent -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork import io.opentelemetry.android.config.OtelRumConfig import io.opentelemetry.android.instrumentation.AndroidInstrumentationLoader import io.opentelemetry.android.instrumentation.activity.ActivityLifecycleInstrumentation diff --git a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractor.java similarity index 97% rename from common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractor.java index 8916bf763..22a69779f 100644 --- a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractor.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common.internal.features.networkattrs; +package io.opentelemetry.android.common.internal.features.networkattributes; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_ICC; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_MCC; @@ -13,7 +13,7 @@ import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CONNECTION_TYPE; import androidx.annotation.Nullable; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; diff --git a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/Carrier.kt b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt similarity index 97% rename from common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/Carrier.kt rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt index 99300ec4d..1b558f3ec 100644 --- a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/Carrier.kt +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common.internal.features.networkattrs.data +package io.opentelemetry.android.common.internal.features.networkattributes.data import android.os.Build import android.telephony.TelephonyManager diff --git a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/CurrentNetwork.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/CurrentNetwork.java similarity index 99% rename from common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/CurrentNetwork.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/CurrentNetwork.java index 49d818468..f776ccec3 100644 --- a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/CurrentNetwork.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/CurrentNetwork.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common.internal.features.networkattrs.data; +package io.opentelemetry.android.common.internal.features.networkattributes.data; import android.os.Build; import androidx.annotation.Nullable; diff --git a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/NetworkState.java b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/NetworkState.java similarity index 98% rename from common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/NetworkState.java rename to common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/NetworkState.java index 93e6d3733..b6402e42e 100644 --- a/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattrs/data/NetworkState.java +++ b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/NetworkState.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common.internal.features.networkattrs.data; +package io.opentelemetry.android.common.internal.features.networkattributes.data; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NetworkConnectionTypeIncubatingValues; diff --git a/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java b/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractorTest.java similarity index 96% rename from common/src/test/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java rename to common/src/test/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractorTest.java index 844cdc39d..a191f0041 100644 --- a/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java +++ b/common/src/test/java/io/opentelemetry/android/common/internal/features/networkattributes/CurrentNetworkAttributesExtractorTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common.internal.features.networkattrs; +package io.opentelemetry.android.common.internal.features.networkattributes; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_ICC; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CARRIER_MCC; @@ -14,9 +14,9 @@ import static org.assertj.core.api.Assertions.entry; import android.os.Build; -import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java index a1b727d03..28febe03b 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java +++ b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java @@ -5,8 +5,8 @@ package io.opentelemetry.android.internal.features.networkattrs; -import io.opentelemetry.android.common.internal.features.networkattrs.CurrentNetworkAttributesExtractor; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.CurrentNetworkAttributesExtractor; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.context.Context; diff --git a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java index 6537df2d0..f6c8e1329 100644 --- a/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java +++ b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java @@ -12,8 +12,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.context.Context; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java index 23a3d967d..32d94aa98 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkApplicationListener.java @@ -7,7 +7,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.android.internal.services.network.NetworkChangeListener; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java index 9bf557e43..1f9ce895d 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeAttributesExtractor.java @@ -8,9 +8,9 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NETWORK_CONNECTION_TYPE; -import io.opentelemetry.android.common.internal.features.networkattrs.CurrentNetworkAttributesExtractor; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.CurrentNetworkAttributesExtractor; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.context.Context; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java index 5e994be15..d5540c27e 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeInstrumentation.java @@ -7,7 +7,7 @@ import androidx.annotation.NonNull; import com.google.auto.service.AutoService; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.instrumentation.InstallationContext; import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; diff --git a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java index 934451dfd..3b2d72511 100644 --- a/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java +++ b/instrumentation/network/src/main/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitor.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.instrumentation.network; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; import io.opentelemetry.api.OpenTelemetry; diff --git a/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java b/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java index 26424eb7f..3899f1d62 100644 --- a/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java +++ b/instrumentation/network/src/test/java/io/opentelemetry/android/instrumentation/network/NetworkChangeMonitorTest.java @@ -18,9 +18,9 @@ import static org.mockito.Mockito.verify; import android.os.Build; -import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService; import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener; import io.opentelemetry.android.internal.services.network.CurrentNetworkProvider; diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java index a4195da9f..432f63dd8 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java @@ -8,7 +8,7 @@ import android.os.Build; import android.telephony.TelephonyManager; import androidx.annotation.RequiresApi; -import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java index 9879d60a3..8d1e06a6f 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java @@ -15,8 +15,8 @@ import android.util.Log; import androidx.annotation.NonNull; import io.opentelemetry.android.common.RumConstants; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.Startable; import io.opentelemetry.android.internal.services.network.detector.NetworkDetector; import java.util.List; diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java index 04d683fd0..54c697d8e 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.internal.services.network; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java index 830c286c0..5a2c730bd 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java @@ -9,7 +9,7 @@ import android.net.ConnectivityManager; import android.os.Build; import android.telephony.TelephonyManager; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; import io.opentelemetry.android.internal.services.network.CarrierFinder; /** diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java index aadfbb7bb..da622fcbc 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java @@ -18,9 +18,9 @@ import android.telephony.TelephonyManager; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; -import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.CarrierFinder; /** diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java index f7d1dd30e..6022c3cce 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java +++ b/services/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java @@ -10,8 +10,8 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; /** * This class is internal and not for public use. Its APIs are unstable and can change at any time. diff --git a/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java index e263a55aa..b7cc49052 100644 --- a/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java @@ -10,7 +10,7 @@ import static org.mockito.Mockito.when; import android.telephony.TelephonyManager; -import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; import org.junit.jupiter.api.Test; class CarrierFinderTest { diff --git a/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java index 261f4c5cc..87f2eff80 100644 --- a/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java @@ -21,8 +21,8 @@ import android.net.Network; import android.net.NetworkRequest; import android.os.Build; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.detector.NetworkDetector; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Assert; diff --git a/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java index e40b73057..81f6645a8 100644 --- a/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java @@ -15,9 +15,9 @@ import android.net.NetworkCapabilities; import android.os.Build; import android.telephony.TelephonyManager; -import io.opentelemetry.android.common.internal.features.networkattrs.data.Carrier; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.Carrier; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import io.opentelemetry.android.internal.services.network.CarrierFinder; import org.junit.Assert; import org.junit.Before; diff --git a/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java index 64a1299dd..2484dcb2f 100644 --- a/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java +++ b/services/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java @@ -13,8 +13,8 @@ import android.net.NetworkInfo; import android.os.Build; import androidx.test.core.app.ApplicationProvider; -import io.opentelemetry.android.common.internal.features.networkattrs.data.CurrentNetwork; -import io.opentelemetry.android.common.internal.features.networkattrs.data.NetworkState; +import io.opentelemetry.android.common.internal.features.networkattributes.data.CurrentNetwork; +import io.opentelemetry.android.common.internal.features.networkattributes.data.NetworkState; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; From 992192b92ed50d23bab79523341f8cc658355c4a Mon Sep 17 00:00:00 2001 From: Surbhi Agarwal Date: Thu, 5 Dec 2024 14:04:14 -0800 Subject: [PATCH 5/5] Remove the extra import that sneaked in --- .../internal/services/visiblescreen/VisibleScreenService.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt index 0d412e726..6449fd9d8 100644 --- a/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt +++ b/services/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt @@ -17,7 +17,6 @@ import io.opentelemetry.android.internal.services.visiblescreen.activities.Visib import io.opentelemetry.android.internal.services.visiblescreen.fragments.RumFragmentActivityRegisterer import io.opentelemetry.android.internal.services.visiblescreen.fragments.VisibleFragmentTracker import java.util.concurrent.atomic.AtomicReference -import kotlin.jvm.javaClass /** * Wherein we do our best to figure out what "screen" is visible and what was the previously visible