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..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,6 +5,7 @@ package io.opentelemetry.android.agent +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 @@ -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/networkattributes/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/networkattributes/CurrentNetworkAttributesExtractor.java index 66eff3110..22a69779f 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/networkattributes/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.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.internal.services.network.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/core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt b/common/src/main/java/io/opentelemetry/android/common/internal/features/networkattributes/data/Carrier.kt similarity index 88% 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/networkattributes/data/Carrier.kt index 5531892b1..1b558f3ec 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/networkattributes/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.networkattributes.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/networkattributes/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/networkattributes/data/CurrentNetwork.java index 56675b0fc..f776ccec3 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/networkattributes/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.networkattributes.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/networkattributes/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/networkattributes/data/NetworkState.java index cc178289d..b6402e42e 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/networkattributes/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.networkattributes.data; import static io.opentelemetry.semconv.incubating.NetworkIncubatingAttributes.NetworkConnectionTypeIncubatingValues; diff --git a/core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt b/common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt similarity index 89% rename from core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt rename to common/src/main/java/io/opentelemetry/android/common/internal/tools/time/SystemTime.kt index d5a76164f..64ff0778e 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/tools/time/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.tools.time +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.tools.time *
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/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/networkattributes/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/networkattributes/CurrentNetworkAttributesExtractorTest.java
index 476bad126..a191f0041 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/networkattributes/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.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.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.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/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..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,9 @@
package io.opentelemetry.android.internal.features.networkattrs;
+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.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..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,9 +12,9 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+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.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/core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt b/instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt
similarity index 100%
rename from core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt
rename to instrumentation/android-instrumentation/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt
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/core/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
similarity index 100%
rename from core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation
rename to instrumentation/android-instrumentation/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation
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..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,10 +7,10 @@
import static io.opentelemetry.api.common.AttributeKey.stringKey;
+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;
-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..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.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.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 d0245db19..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,9 +7,9 @@
import androidx.annotation.NonNull;
import com.google.auto.service.AutoService;
+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.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..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,9 +5,9 @@
package io.opentelemetry.android.instrumentation.network;
+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.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..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,13 +18,13 @@
import static org.mockito.Mockito.verify;
import android.os.Build;
+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;
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 @@
+
+