From 37c83e29d2a087bbea98bc8d977aaccb0b30c2f1 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:56:54 +0200 Subject: [PATCH 01/13] Installing AndroidInstrumentations --- .../android/OpenTelemetryRum.java | 9 ++++- .../android/OpenTelemetryRumBuilder.java | 23 ++++++----- .../android/SdkPreconfiguredRumBuilder.kt | 38 +++++++++++-------- .../android/config/OtelRumConfig.java | 19 ++++++++++ 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java index c04633bf3..89222bc01 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java +++ b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java @@ -58,10 +58,15 @@ static OpenTelemetryRumBuilder builder(Application application, OtelRumConfig co * * @param application The {@link Application} that is being instrumented. * @param openTelemetrySdk The {@link OpenTelemetrySdk} that the user has already created. + * @param discoverInstrumentations TRUE to look for instrumentations in the classpath and + * applying them automatically. */ static SdkPreconfiguredRumBuilder builder( - Application application, OpenTelemetrySdk openTelemetrySdk) { - return new SdkPreconfiguredRumBuilder(application, openTelemetrySdk); + Application application, + OpenTelemetrySdk openTelemetrySdk, + boolean discoverInstrumentations) { + return new SdkPreconfiguredRumBuilder( + application, openTelemetrySdk, discoverInstrumentations); } /** Returns a no-op implementation of {@link OpenTelemetryRum}. */ diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java index 05b272d5e..12c2106e0 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java +++ b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java @@ -14,7 +14,7 @@ import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration; import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter; import io.opentelemetry.android.features.diskbuffering.scheduler.ExportScheduleHandler; -import io.opentelemetry.android.instrumentation.common.InstrumentedApplication; +import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.internal.features.networkattrs.NetworkAttributesSpanAppender; import io.opentelemetry.android.internal.features.persistence.DiskManager; import io.opentelemetry.android.internal.features.persistence.SimpleTemporaryFileProvider; @@ -74,10 +74,7 @@ public final class OpenTelemetryRumBuilder { private final List> loggerProviderCustomizers = new ArrayList<>(); private final OtelRumConfig config; - - private final List> instrumentationInstallers = - new ArrayList<>(); - + private final List instrumentations = new ArrayList<>(); private final List> otelSdkReadyListeners = new ArrayList<>(); private Function spanExporterCustomizer = a -> a; private Function @@ -184,14 +181,12 @@ public OpenTelemetryRumBuilder addLoggerProviderCustomizer( } /** - * Adds an instrumentation installer function that will be run on an {@link - * InstrumentedApplication} instance as a part of the {@link #build()} method call. + * Adds an instrumentation to be applied as a part of the {@link #build()} method call. * * @return {@code this} */ - public OpenTelemetryRumBuilder addInstrumentation( - Consumer instrumentationInstaller) { - instrumentationInstallers.add(instrumentationInstaller); + public OpenTelemetryRumBuilder addInstrumentation(AndroidInstrumentation instrumentation) { + instrumentations.add(instrumentation); return this; } @@ -319,8 +314,12 @@ OpenTelemetryRum build(ServiceManager serviceManager) { SdkPreconfiguredRumBuilder delegate = new SdkPreconfiguredRumBuilder( - application, sdk, sessionId, serviceManager::getAppLifecycleService); - instrumentationInstallers.forEach(delegate::addInstrumentation); + application, + sdk, + sessionId, + serviceManager::getAppLifecycleService, + config.shouldDiscoverInstrumentations()); + instrumentations.forEach(delegate::addInstrumentation); serviceManager.start(); return delegate.build(); } diff --git a/android-agent/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt b/android-agent/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt index 2803ce596..5ab869129 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt +++ b/android-agent/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt @@ -6,11 +6,11 @@ package io.opentelemetry.android import android.app.Application -import io.opentelemetry.android.instrumentation.common.InstrumentedApplication +import io.opentelemetry.android.instrumentation.AndroidInstrumentation +import io.opentelemetry.android.instrumentation.AndroidInstrumentationRegistry import io.opentelemetry.android.internal.services.ServiceManager import io.opentelemetry.android.internal.services.applifecycle.AppLifecycleService import io.opentelemetry.sdk.OpenTelemetrySdk -import java.util.function.Consumer class SdkPreconfiguredRumBuilder @JvmOverloads @@ -24,18 +24,18 @@ class SdkPreconfiguredRumBuilder appLifecycleServiceProvider: () -> AppLifecycleService = { ServiceManager.get().getAppLifecycleService() }, + private val discoverInstrumentations: Boolean, ) { - private val instrumentationInstallers: MutableList> = - ArrayList() + private val instrumentations = mutableListOf() private val appLifecycleService by lazy { appLifecycleServiceProvider.invoke() } /** - * Adds an instrumentation installer function that will be run on an [ ] instance as a part of the [.build] method call. + * Adds an instrumentation to be applied as a part of the [build] method call. * * @return `this` */ - fun addInstrumentation(instrumentationInstaller: Consumer): SdkPreconfiguredRumBuilder { - instrumentationInstallers.add(instrumentationInstaller) + fun addInstrumentation(instrumentation: AndroidInstrumentation): SdkPreconfiguredRumBuilder { + instrumentations.add(instrumentation) return this } @@ -56,13 +56,21 @@ class SdkPreconfiguredRumBuilder val tracer = sdk.getTracer(OpenTelemetryRum::class.java.simpleName) sessionId.setSessionIdChangeListener(SessionIdChangeTracer(tracer)) - // InstrumentedApplication instrumentedApplication = - // new InstrumentedApplicationImpl(application, sdk, - // applicationStateWatcher); - // for (Consumer installer : instrumentationInstallers) { - // installer.accept(instrumentedApplication); TODO to be replaced by calls to - // AndroidInstrumentation.install - // } - return OpenTelemetryRumImpl(sdk, sessionId) + val openTelemetryRum = OpenTelemetryRumImpl(sdk, sessionId) + + // Install instrumentations + for (instrumentation in getInstrumentations()) { + instrumentation.install(application, openTelemetryRum) + } + + return openTelemetryRum + } + + private fun getInstrumentations(): List { + if (discoverInstrumentations) { + instrumentations.addAll(AndroidInstrumentationRegistry.get().getAll()) + } + + return instrumentations } } diff --git a/android-agent/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java b/android-agent/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java index 0d69d6dff..5b277383b 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java +++ b/android-agent/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java @@ -23,6 +23,7 @@ public class OtelRumConfig { private boolean includeNetworkAttributes = true; private boolean generateSdkInitializationEvents = true; private boolean includeScreenAttributes = true; + private boolean discoverInstrumentations = true; private DiskBufferingConfiguration diskBufferingConfiguration = DiskBufferingConfiguration.builder().build(); private Duration sessionTimeout = Duration.ofMinutes(15); @@ -101,6 +102,24 @@ public DiskBufferingConfiguration getDiskBufferingConfiguration() { return diskBufferingConfiguration; } + /** + * Return {@link Boolean#TRUE} if the RUM initialization should look for instrumentations in the + * classpath and apply them automatically. + */ + public boolean shouldDiscoverInstrumentations() { + return discoverInstrumentations; + } + + /** + * Call this to disable the automatic search for instrumentations in the classpath. + * + * @return this + */ + public OtelRumConfig disableInstrumentationDiscovery() { + discoverInstrumentations = false; + return this; + } + /** * Sets the parameters for caching signals in disk in order to export them later. * From b9a24bf7445d3fdcb847e5192ccffb8b6ca77ab6 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:15:32 +0200 Subject: [PATCH 02/13] Validating installing instrumentations --- .../android/OpenTelemetryRum.java | 2 +- .../android/OpenTelemetryRumBuilder.java | 10 ++-- .../android/OpenTelemetryRumBuilderTest.java | 54 +++++++++++++------ 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java index 89222bc01..8fd0cbafd 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java +++ b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java @@ -43,7 +43,7 @@ static OpenTelemetryRumBuilder builder(Application application) { * SDK as a parameter. */ static OpenTelemetryRumBuilder builder(Application application, OtelRumConfig config) { - return new OpenTelemetryRumBuilder(application, config); + return OpenTelemetryRumBuilder.create(application, config); } /** diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java index 12c2106e0..715d51ca7 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java +++ b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java @@ -89,10 +89,14 @@ private static TextMapPropagator buildDefaultPropagator() { W3CTraceContextPropagator.getInstance(), W3CBaggagePropagator.getInstance()); } - OpenTelemetryRumBuilder(Application application, OtelRumConfig config) { + public static OpenTelemetryRumBuilder create(Application application, OtelRumConfig config) { + return new OpenTelemetryRumBuilder( + application, config, new SessionIdTimeoutHandler(config.getSessionTimeout())); + } + + OpenTelemetryRumBuilder( + Application application, OtelRumConfig config, SessionIdTimeoutHandler timeoutHandler) { this.application = application; - final SessionIdTimeoutHandler timeoutHandler = - new SessionIdTimeoutHandler(config.getSessionTimeout()); this.sessionId = new SessionId(timeoutHandler); this.resource = AndroidResource.createDefault(application); this.config = config; diff --git a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index fb95f78b2..aa1dd7e36 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -13,12 +13,15 @@ import static org.awaitility.Awaitility.await; import static org.mockito.ArgumentMatchers.anyCollection; import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import android.app.Activity; @@ -30,6 +33,8 @@ import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration; import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter; import io.opentelemetry.android.features.diskbuffering.scheduler.ExportScheduleHandler; +import io.opentelemetry.android.instrumentation.AndroidInstrumentation; +import io.opentelemetry.android.instrumentation.AndroidInstrumentationRegistry; import io.opentelemetry.android.internal.initialization.InitializationEvents; import io.opentelemetry.android.internal.services.CacheStorage; import io.opentelemetry.android.internal.services.Preferences; @@ -73,7 +78,6 @@ import java.util.function.Function; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; @@ -187,27 +191,43 @@ public void shouldBuildLogRecordProvider() { assertThat(payload.get(0)).isEqualTo(expected); } - @Ignore("To be updated once AndroidInstrumentation is fully implemented") @Test public void shouldInstallInstrumentation() { - OpenTelemetryRum.builder(application, buildConfig()) - .addInstrumentation( - instrumentedApplication -> { - assertThat(instrumentedApplication.getApplication()) - .isSameAs(application); - // - // instrumentedApplication.registerApplicationStateListener(listener); - // TODO update with AndroidInstrumentation - }) - .build(); + ServiceManager serviceManager = createServiceManager(); + SessionIdTimeoutHandler timeoutHandler = mock(); + AndroidInstrumentation localInstrumentation = mock(); + AndroidInstrumentation classpathInstrumentation = mock(); + AndroidInstrumentationRegistry.get().register(classpathInstrumentation); + + new OpenTelemetryRumBuilder(application, buildConfig(), timeoutHandler) + .addInstrumentation(localInstrumentation) + .build(serviceManager); - verify(application).registerActivityLifecycleCallbacks(activityCallbacksCaptor.capture()); + verify(serviceManager.getAppLifecycleService()).registerListener(timeoutHandler); - activityCallbacksCaptor.getValue().onActivityStarted(activity); - verify(listener).onApplicationForegrounded(); + verify(localInstrumentation).install(eq(application), notNull()); + verify(classpathInstrumentation).install(eq(application), notNull()); + } - activityCallbacksCaptor.getValue().onActivityStopped(activity); - verify(listener).onApplicationBackgrounded(); + @Test + public void shouldInstallInstrumentation_excludingClasspathImplWhenRequestedInConfig() { + ServiceManager serviceManager = createServiceManager(); + SessionIdTimeoutHandler timeoutHandler = mock(); + AndroidInstrumentation localInstrumentation = mock(); + AndroidInstrumentation classpathInstrumentation = mock(); + AndroidInstrumentationRegistry.get().register(classpathInstrumentation); + + new OpenTelemetryRumBuilder( + application, + buildConfig().disableInstrumentationDiscovery(), + timeoutHandler) + .addInstrumentation(localInstrumentation) + .build(serviceManager); + + verify(serviceManager.getAppLifecycleService()).registerListener(timeoutHandler); + + verify(localInstrumentation).install(eq(application), notNull()); + verifyNoInteractions(classpathInstrumentation); } @Test From 642c756e393c5f7274cd478fb597c518cf5a1f2e Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:28:55 +0200 Subject: [PATCH 03/13] Clean up --- .../AndroidInstrumentationRegistry.kt | 14 +++++--- .../android/OpenTelemetryRumBuilderTest.java | 3 +- .../common/ApplicationStateListener.java | 24 ------------- .../common/InstrumentedApplication.java | 34 ------------------- 4 files changed, 12 insertions(+), 63 deletions(-) delete mode 100644 instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ApplicationStateListener.java delete mode 100644 instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/InstrumentedApplication.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt b/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt index 408ea8157..45d66bec0 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt +++ b/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt @@ -34,13 +34,19 @@ interface AndroidInstrumentationRegistry { fun register(instrumentation: AndroidInstrumentation) companion object { - private val instance: AndroidInstrumentationRegistry by lazy { - AndroidInstrumentationRegistryImpl() - } + private var instance: AndroidInstrumentationRegistry? = null @JvmStatic fun get(): AndroidInstrumentationRegistry { - return instance + if (instance == null) { + instance = AndroidInstrumentationRegistryImpl() + } + return instance!! + } + + @JvmStatic + fun resetForTest() { + instance = null } } } diff --git a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index aa1dd7e36..2d975b17f 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -115,8 +115,9 @@ public void setup() { @After public void tearDown() throws Exception { SignalFromDiskExporter.resetForTesting(); - mocks.close(); InitializationEvents.resetForTest(); + AndroidInstrumentationRegistry.resetForTest(); + mocks.close(); } @Test diff --git a/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ApplicationStateListener.java b/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ApplicationStateListener.java deleted file mode 100644 index ce9376557..000000000 --- a/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ApplicationStateListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.android.instrumentation.common; - -/** - * Listener interface that is called whenever the instrumented application is brought to foreground - * from the background, or vice versa. - * - *

This class is internal and is hence not for public use. Its APIs are unstable and can change - * at any time. - */ -public interface ApplicationStateListener { - - /** - * Called whenever the application is brought to the foreground (i.e. first activity starts). - */ - void onApplicationForegrounded(); - - /** Called whenever the application is brought to the background (i.e. last activity stops). */ - void onApplicationBackgrounded(); -} diff --git a/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/InstrumentedApplication.java b/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/InstrumentedApplication.java deleted file mode 100644 index c2ad7a834..000000000 --- a/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/InstrumentedApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.android.instrumentation.common; - -import android.app.Application; -import io.opentelemetry.sdk.OpenTelemetrySdk; - -/** - * Provides access to the {@linkplain OpenTelemetrySdk OpenTelemetry SDK}, the instrumented {@link - * Application}, allows registering {@linkplain ApplicationStateListener listeners}. - * - *

This class is internal and is hence not for public use. Its APIs are unstable and can change - * at any time. - */ -public interface InstrumentedApplication { - - /** Returns the instrumented {@link Application}. */ - Application getApplication(); - - /** Returns the {@link OpenTelemetrySdk} instance. */ - OpenTelemetrySdk getOpenTelemetrySdk(); - - /** - * Registers the passed {@link ApplicationStateListener} - from now on it will be called - * whenever the application is moved from background to foreground, and vice versa. - * - *

Users of this method should take care to avoid passing the same listener instance multiple - * times; duplicates are not trimmed. - */ - void registerApplicationStateListener(ApplicationStateListener listener); -} From a6a34e6843552f6ef7b57d1ad20c9141c35719b9 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:33:46 +0200 Subject: [PATCH 04/13] Improving test name --- .../io/opentelemetry/android/OpenTelemetryRumBuilderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index 2d975b17f..b5f56d680 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -211,7 +211,7 @@ public void shouldInstallInstrumentation() { } @Test - public void shouldInstallInstrumentation_excludingClasspathImplWhenRequestedInConfig() { + public void shouldInstallInstrumentation_excludingClasspathImplsWhenRequestedInConfig() { ServiceManager serviceManager = createServiceManager(); SessionIdTimeoutHandler timeoutHandler = mock(); AndroidInstrumentation localInstrumentation = mock(); From 5c50d8e12a1c640bafd74434c61f5ad586982a63 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:42:33 +0200 Subject: [PATCH 05/13] Removing common module --- android-agent/build.gradle.kts | 2 -- .../android/AndroidResource.java | 2 +- .../android/OpenTelemetryRumBuilder.java | 2 +- .../android/RuntimeDetailsExtractor.java | 6 +++--- .../ScreenAttributesSpanProcessor.java | 2 +- .../android/SessionIdChangeTracer.java | 2 +- .../android/SessionIdSpanAppender.java | 2 +- .../android/config}/RumConstants.java | 2 +- .../scheduler/DefaultExportScheduler.kt | 2 +- .../features/persistence/DiskManager.kt | 2 +- .../internal/services/CacheStorage.java | 2 +- .../network/CurrentNetworkProvider.java | 2 +- .../android/AndroidResourceTest.java | 2 +- .../android/OpenTelemetryRumBuilderTest.java | 4 ++-- .../android/RuntimeDetailsExtractorTest.java | 6 +++--- .../ScreenAttributesSpanProcessorTest.java | 2 +- .../android/SessionIdChangeTracerTest.java | 2 +- .../android/SessionIdSpanAppenderTest.java | 2 +- common/build.gradle.kts | 20 ------------------- instrumentation/activity/build.gradle.kts | 1 - .../activity/ActivityTracer.java | 8 ++++---- .../activity/startup/AppStartupTimer.java | 2 +- .../activity/ActivityCallbacksTest.java | 6 +++--- .../activity/ActivityTracerTest.java | 8 ++++---- .../Pre29ActivityLifecycleCallbacksTest.java | 6 +++--- .../activity/startup/AppStartupTimerTest.java | 2 +- instrumentation/common-api/build.gradle.kts | 1 + .../instrumentation}/common/ActiveSpan.java | 3 ++- instrumentation/fragment/build.gradle.kts | 1 - .../fragment/FragmentTracer.java | 4 ++-- .../RumFragmentLifecycleCallbacks.java | 2 +- .../fragment/FragmentTracerTest.java | 4 ++-- .../RumFragmentLifecycleCallbacksTest.java | 4 ++-- .../slowrendering/build.gradle.kts | 1 - .../slowrendering/SlowRenderListener.java | 2 +- .../SlowRenderingInstrumentation.java | 2 +- instrumentation/startup/build.gradle.kts | 1 - .../startup/SdkInitializationEvents.kt | 2 +- .../startup/SdkInitializationEventsTest.kt | 2 +- settings.gradle.kts | 1 - 40 files changed, 52 insertions(+), 77 deletions(-) rename {common/src/main/java/io/opentelemetry/android/common => android-agent/src/main/java/io/opentelemetry/android/config}/RumConstants.java (98%) delete mode 100644 common/build.gradle.kts rename {common/src/main/java/io/opentelemetry/android => instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation}/common/ActiveSpan.java (93%) diff --git a/android-agent/build.gradle.kts b/android-agent/build.gradle.kts index b46831d87..a4ec4e38d 100644 --- a/android-agent/build.gradle.kts +++ b/android-agent/build.gradle.kts @@ -62,8 +62,6 @@ android { } dependencies { - implementation(project(":common")) - implementation(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.androidx.navigation.fragment) implementation(libs.androidx.lifecycle.process) diff --git a/android-agent/src/main/java/io/opentelemetry/android/AndroidResource.java b/android-agent/src/main/java/io/opentelemetry/android/AndroidResource.java index c4ee93c79..232d1825d 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/AndroidResource.java +++ b/android-agent/src/main/java/io/opentelemetry/android/AndroidResource.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.RUM_SDK_VERSION; +import static io.opentelemetry.android.config.RumConstants.RUM_SDK_VERSION; import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MANUFACTURER; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MODEL_IDENTIFIER; diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java index 715d51ca7..4de8a32ae 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java +++ b/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java @@ -9,8 +9,8 @@ import android.app.Application; import android.util.Log; -import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.android.config.OtelRumConfig; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration; import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter; import io.opentelemetry.android.features.diskbuffering.scheduler.ExportScheduleHandler; diff --git a/android-agent/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java b/android-agent/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java index 307ff4c13..cb47e615a 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java +++ b/android-agent/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java @@ -5,9 +5,9 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; -import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; -import static io.opentelemetry.android.common.RumConstants.STORAGE_SPACE_FREE_KEY; +import static io.opentelemetry.android.config.RumConstants.BATTERY_PERCENT_KEY; +import static io.opentelemetry.android.config.RumConstants.HEAP_FREE_KEY; +import static io.opentelemetry.android.config.RumConstants.STORAGE_SPACE_FREE_KEY; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/android-agent/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java b/android-agent/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java index 03335e03a..6978f3995 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java +++ b/android-agent/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; import io.opentelemetry.android.internal.services.visiblescreen.VisibleScreenService; import io.opentelemetry.context.Context; diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java b/android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java index 67010f268..156b7e319 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java +++ b/android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.api.trace.Tracer; final class SessionIdChangeTracer implements SessionIdChangeListener { diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java b/android-agent/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java index 357227377..aff727cab 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java +++ b/android-agent/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.trace.ReadWriteSpan; import io.opentelemetry.sdk.trace.ReadableSpan; diff --git a/common/src/main/java/io/opentelemetry/android/common/RumConstants.java b/android-agent/src/main/java/io/opentelemetry/android/config/RumConstants.java similarity index 98% rename from common/src/main/java/io/opentelemetry/android/common/RumConstants.java rename to android-agent/src/main/java/io/opentelemetry/android/config/RumConstants.java index 70fa5c078..3b14cc39e 100644 --- a/common/src/main/java/io/opentelemetry/android/common/RumConstants.java +++ b/android-agent/src/main/java/io/opentelemetry/android/config/RumConstants.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common; +package io.opentelemetry.android.config; import static io.opentelemetry.api.common.AttributeKey.doubleKey; import static io.opentelemetry.api.common.AttributeKey.longKey; diff --git a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt b/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt index f4beb661e..4ca030073 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt +++ b/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt @@ -6,7 +6,7 @@ package io.opentelemetry.android.features.diskbuffering.scheduler import android.util.Log -import io.opentelemetry.android.common.RumConstants.OTEL_RUM_LOG_TAG +import io.opentelemetry.android.config.RumConstants.OTEL_RUM_LOG_TAG import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter import io.opentelemetry.android.internal.services.ServiceManager import io.opentelemetry.android.internal.services.periodicwork.PeriodicRunnable diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt b/android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt index f9d89beea..fdc5ecea0 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt +++ b/android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt @@ -6,7 +6,7 @@ package io.opentelemetry.android.internal.features.persistence import android.util.Log -import io.opentelemetry.android.common.RumConstants +import io.opentelemetry.android.config.RumConstants import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration import io.opentelemetry.android.internal.services.CacheStorage import io.opentelemetry.android.internal.services.Preferences diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java b/android-agent/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java index 2f4751411..9d4e4c190 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java +++ b/android-agent/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java @@ -11,7 +11,7 @@ import android.util.Log; import androidx.annotation.RequiresApi; import androidx.annotation.WorkerThread; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; import java.io.File; import java.io.IOException; import java.util.UUID; diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java b/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java index 2da0fcc9a..b0d3e1d7f 100644 --- a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java +++ b/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java @@ -14,7 +14,7 @@ import android.os.Build; import android.util.Log; import androidx.annotation.NonNull; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; 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; diff --git a/android-agent/src/test/java/io/opentelemetry/android/AndroidResourceTest.java b/android-agent/src/test/java/io/opentelemetry/android/AndroidResourceTest.java index 1e1fe6462..7d7710317 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/AndroidResourceTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/AndroidResourceTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.RUM_SDK_VERSION; +import static io.opentelemetry.android.config.RumConstants.RUM_SDK_VERSION; import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MANUFACTURER; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MODEL_IDENTIFIER; diff --git a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index b5f56d680..a994edabd 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -5,8 +5,8 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.SESSION_ID_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SESSION_ID_KEY; import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; diff --git a/android-agent/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java b/android-agent/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java index 17dc5c59c..ef9a47e69 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; -import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; -import static io.opentelemetry.android.common.RumConstants.STORAGE_SPACE_FREE_KEY; +import static io.opentelemetry.android.config.RumConstants.BATTERY_PERCENT_KEY; +import static io.opentelemetry.android.config.RumConstants.HEAP_FREE_KEY; +import static io.opentelemetry.android.config.RumConstants.STORAGE_SPACE_FREE_KEY; import static io.opentelemetry.context.Context.root; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static org.mockito.Mockito.when; diff --git a/android-agent/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java b/android-agent/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java index d73881012..d9ff3d460 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.mockito.Mockito.mock; diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java b/android-agent/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java index a565f96ed..cfc018004 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.PREVIOUS_SESSION_ID_KEY; +import static io.opentelemetry.android.config.RumConstants.PREVIOUS_SESSION_ID_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import io.opentelemetry.api.common.Attributes; diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java b/android-agent/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java index 957feee2f..9dc8bd70d 100644 --- a/android-agent/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java +++ b/android-agent/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.common.RumConstants.SESSION_ID_KEY; +import static io.opentelemetry.android.config.RumConstants.SESSION_ID_KEY; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.verify; diff --git a/common/build.gradle.kts b/common/build.gradle.kts deleted file mode 100644 index 6510c879c..000000000 --- a/common/build.gradle.kts +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id("otel.android-library-conventions") - id("otel.publish-conventions") -} - -description = "OpenTelemetry Android common" - -android { - namespace = "io.opentelemetry.android.common" - - defaultConfig { - consumerProguardFiles("consumer-rules.pro") - } -} - -dependencies { - api(platform(libs.opentelemetry.platform)) - api(libs.opentelemetry.api) - implementation(libs.androidx.core) -} diff --git a/instrumentation/activity/build.gradle.kts b/instrumentation/activity/build.gradle.kts index 19ddee44a..ff9b31988 100644 --- a/instrumentation/activity/build.gradle.kts +++ b/instrumentation/activity/build.gradle.kts @@ -16,7 +16,6 @@ android { dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) - api(project(":common")) api(project(":instrumentation:common-api")) api(project(":android-agent")) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java index 405beb2e2..59aeb04b4 100644 --- a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java +++ b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java @@ -5,15 +5,15 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.common.RumConstants.APP_START_SPAN_NAME; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.config.RumConstants.APP_START_SPAN_NAME; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; import android.app.Activity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import io.opentelemetry.android.common.ActiveSpan; import io.opentelemetry.android.instrumentation.activity.startup.AppStartupTimer; +import io.opentelemetry.android.instrumentation.common.ActiveSpan; import io.opentelemetry.android.internal.services.visiblescreen.VisibleScreenService; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; diff --git a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java index f13147468..5c0fea646 100644 --- a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java +++ b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java @@ -12,7 +12,7 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.android.internal.services.visiblescreen.activities.DefaultingActivityLifecycleCallbacks; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java index 23cb77008..6d97dda4f 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java index 4ed1848bd..4e59c2e17 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java @@ -5,17 +5,17 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.app.Activity; -import io.opentelemetry.android.common.ActiveSpan; import io.opentelemetry.android.instrumentation.activity.startup.AppStartupTimer; +import io.opentelemetry.android.instrumentation.common.ActiveSpan; import io.opentelemetry.android.internal.services.visiblescreen.VisibleScreenService; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java index 7d246a768..489238920 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java index 2c034498a..e1da48a15 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.instrumentation.activity.startup; -import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; diff --git a/instrumentation/common-api/build.gradle.kts b/instrumentation/common-api/build.gradle.kts index 8592bbc1f..3b8592855 100644 --- a/instrumentation/common-api/build.gradle.kts +++ b/instrumentation/common-api/build.gradle.kts @@ -14,6 +14,7 @@ android { } dependencies { + api(project(":android-agent")) api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) implementation(libs.androidx.navigation.fragment) diff --git a/common/src/main/java/io/opentelemetry/android/common/ActiveSpan.java b/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java similarity index 93% rename from common/src/main/java/io/opentelemetry/android/common/ActiveSpan.java rename to instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java index f54ec68bc..6a8b47a35 100644 --- a/common/src/main/java/io/opentelemetry/android/common/ActiveSpan.java +++ b/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java @@ -3,9 +3,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.common; +package io.opentelemetry.android.instrumentation.common; import androidx.annotation.Nullable; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Scope; import java.util.function.Supplier; diff --git a/instrumentation/fragment/build.gradle.kts b/instrumentation/fragment/build.gradle.kts index 8c737246e..9d4482756 100644 --- a/instrumentation/fragment/build.gradle.kts +++ b/instrumentation/fragment/build.gradle.kts @@ -18,7 +18,6 @@ dependencies { api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) api(project(":android-agent")) - api(project(":common")) implementation(libs.androidx.core) api(libs.androidx.navigation.fragment) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java index df11cd0ff..6b4b09aa2 100644 --- a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java +++ b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java @@ -6,8 +6,8 @@ package io.opentelemetry.android.instrumentation.fragment; import androidx.fragment.app.Fragment; -import io.opentelemetry.android.common.ActiveSpan; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.instrumentation.common.ActiveSpan; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; diff --git a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacks.java b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacks.java index 7d4b8e3bd..bc0ce6486 100644 --- a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacks.java +++ b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacks.java @@ -12,7 +12,7 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; -import io.opentelemetry.android.common.ActiveSpan; +import io.opentelemetry.android.instrumentation.common.ActiveSpan; import io.opentelemetry.android.instrumentation.common.ScreenNameExtractor; import io.opentelemetry.api.trace.Tracer; import java.util.HashMap; diff --git a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java index 3dfbde599..74e3d4888 100644 --- a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java +++ b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java @@ -5,14 +5,14 @@ package io.opentelemetry.android.instrumentation.fragment; -import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import androidx.fragment.app.Fragment; -import io.opentelemetry.android.common.ActiveSpan; +import io.opentelemetry.android.instrumentation.common.ActiveSpan; import io.opentelemetry.android.internal.services.visiblescreen.VisibleScreenService; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension; diff --git a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java index ea2bd3605..2b3c4891a 100644 --- a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java +++ b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java @@ -5,8 +5,8 @@ package io.opentelemetry.android.instrumentation.fragment; -import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/instrumentation/slowrendering/build.gradle.kts b/instrumentation/slowrendering/build.gradle.kts index 2c2cf518e..b50bce212 100644 --- a/instrumentation/slowrendering/build.gradle.kts +++ b/instrumentation/slowrendering/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) api(project(":android-agent")) - api(project(":common")) api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) diff --git a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java index 29cadd6f6..c8a7b2c5b 100644 --- a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java +++ b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java @@ -20,7 +20,7 @@ import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.android.internal.services.visiblescreen.activities.DefaultingActivityLifecycleCallbacks; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; diff --git a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java index 55c9f2091..4dca69a02 100644 --- a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java +++ b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java @@ -11,7 +11,7 @@ import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import io.opentelemetry.android.OpenTelemetryRum; -import io.opentelemetry.android.common.RumConstants; +import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import java.time.Duration; diff --git a/instrumentation/startup/build.gradle.kts b/instrumentation/startup/build.gradle.kts index f679f2ac9..ae06c02d1 100644 --- a/instrumentation/startup/build.gradle.kts +++ b/instrumentation/startup/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) api(project(":android-agent")) - api(project(":common")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt b/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt index 67a374659..be3390b50 100644 --- a/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt +++ b/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt @@ -6,8 +6,8 @@ package io.opentelemetry.android.instrumentation.startup import com.google.auto.service.AutoService -import io.opentelemetry.android.common.RumConstants import io.opentelemetry.android.config.OtelRumConfig +import io.opentelemetry.android.config.RumConstants import io.opentelemetry.android.internal.initialization.InitializationEvents import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.common.AttributeKey diff --git a/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt b/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt index 4fb8eeb19..077786345 100644 --- a/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt +++ b/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt @@ -9,7 +9,7 @@ import io.mockk.called import io.mockk.every import io.mockk.mockk import io.mockk.verify -import io.opentelemetry.android.common.RumConstants +import io.opentelemetry.android.config.RumConstants import io.opentelemetry.api.common.AttributeKey.stringKey import io.opentelemetry.api.common.Attributes import io.opentelemetry.sdk.OpenTelemetrySdk diff --git a/settings.gradle.kts b/settings.gradle.kts index 1837c7041..883e6c0ea 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,5 @@ rootProject.name = "opentelemetry-android" -include(":common") include(":android-agent") include(":instrumentation:activity") include(":instrumentation:anr") From da57edfd8c611398cffe8075263249b765351750 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:48:58 +0200 Subject: [PATCH 06/13] Renaming android-agent to core --- {android-agent => core}/build.gradle.kts | 0 .../kotlin/io/opentelemetry/android/AgentInitTest.kt | 0 {android-agent => core}/src/main/AndroidManifest.xml | 0 .../src/main/java/io/opentelemetry/android/AndroidResource.java | 0 .../io/opentelemetry/android/GlobalAttributesSpanAppender.java | 0 .../java/io/opentelemetry/android/NoopOpenTelemetryRum.java | 0 .../main/java/io/opentelemetry/android/OpenTelemetryRum.java | 0 .../java/io/opentelemetry/android/OpenTelemetryRumBuilder.java | 0 .../java/io/opentelemetry/android/OpenTelemetryRumImpl.java | 0 .../java/io/opentelemetry/android/RuntimeDetailsExtractor.java | 0 .../io/opentelemetry/android/ScreenAttributesSpanProcessor.java | 0 .../java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt | 0 .../src/main/java/io/opentelemetry/android/SessionId.java | 0 .../java/io/opentelemetry/android/SessionIdChangeListener.java | 0 .../java/io/opentelemetry/android/SessionIdChangeTracer.java | 0 .../io/opentelemetry/android/SessionIdRatioBasedSampler.java | 0 .../java/io/opentelemetry/android/SessionIdSpanAppender.java | 0 .../java/io/opentelemetry/android/SessionIdTimeoutHandler.java | 0 .../java/io/opentelemetry/android/config/OtelRumConfig.java | 0 .../main/java/io/opentelemetry/android/config/RumConstants.java | 0 .../android/export/AttributeModifyingSpanExporter.java | 0 .../io/opentelemetry/android/export/FilteringSpanExporter.java | 0 .../android/export/FilteringSpanExporterBuilder.java | 0 .../java/io/opentelemetry/android/export/ModifiedSpanData.java | 0 .../java/io/opentelemetry/android/export/SpanDataModifier.java | 0 .../features/diskbuffering/DiskBufferingConfiguration.java | 0 .../android/features/diskbuffering/SignalFromDiskExporter.kt | 0 .../diskbuffering/scheduler/DefaultExportScheduleHandler.kt | 0 .../features/diskbuffering/scheduler/DefaultExportScheduler.kt | 0 .../features/diskbuffering/scheduler/ExportScheduleHandler.kt | 0 .../android/instrumentation/AndroidInstrumentation.kt | 0 .../android/instrumentation/AndroidInstrumentationRegistry.kt | 0 .../instrumentation/AndroidInstrumentationRegistryImpl.kt | 0 .../networkattrs/CurrentNetworkAttributesExtractor.java | 0 .../features/networkattrs/NetworkAttributesSpanAppender.java | 0 .../android/internal/features/persistence/DiskManager.kt | 0 .../features/persistence/SimpleTemporaryFileProvider.kt | 0 .../android/internal/initialization/InitializationEvents.kt | 0 .../internal/processors/GlobalAttributesLogRecordAppender.kt | 0 .../opentelemetry/android/internal/services/CacheStorage.java | 0 .../io/opentelemetry/android/internal/services/Preferences.java | 0 .../opentelemetry/android/internal/services/ServiceManager.kt | 0 .../android/internal/services/ServiceManagerImpl.kt | 0 .../io/opentelemetry/android/internal/services/Startable.java | 0 .../internal/services/applifecycle/AppLifecycleService.kt | 0 .../services/applifecycle/ApplicationStateListener.java | 0 .../internal/services/applifecycle/ApplicationStateWatcher.kt | 0 .../android/internal/services/network/CarrierFinder.java | 0 .../internal/services/network/CurrentNetworkProvider.java | 0 .../internal/services/network/NetworkChangeListener.java | 0 .../android/internal/services/network/data/Carrier.kt | 0 .../android/internal/services/network/data/CurrentNetwork.java | 0 .../android/internal/services/network/data/NetworkState.java | 0 .../internal/services/network/detector/NetworkDetector.java | 0 .../services/network/detector/PostApi28NetworkDetector.java | 0 .../services/network/detector/SimpleNetworkDetector.java | 0 .../android/internal/services/periodicwork/PeriodicRunnable.kt | 0 .../internal/services/periodicwork/PeriodicWorkService.kt | 0 .../internal/services/visiblescreen/VisibleScreenService.kt | 0 .../activities/DefaultingActivityLifecycleCallbacks.java | 0 .../activities/Pre29VisibleScreenLifecycleBinding.java | 0 .../visiblescreen/activities/VisibleScreenLifecycleBinding.java | 0 .../visiblescreen/fragments/RumFragmentActivityRegisterer.java | 0 .../services/visiblescreen/fragments/VisibleFragmentTracker.kt | 0 .../io/opentelemetry/android/internal/tools/time/SystemTime.kt | 0 .../src/main/java/io/opentelemetry/android/package-info.java | 0 .../test/java/io/opentelemetry/android/AndroidResourceTest.java | 0 .../opentelemetry/android/GlobalAttributesSpanAppenderTest.java | 0 .../io/opentelemetry/android/OpenTelemetryRumBuilderTest.java | 0 .../io/opentelemetry/android/RuntimeDetailsExtractorTest.java | 0 .../android/ScreenAttributesSpanProcessorTest.java | 0 .../io/opentelemetry/android/SessionIdChangeTracerTest.java | 0 .../opentelemetry/android/SessionIdRatioBasedSamplerTest.java | 0 .../io/opentelemetry/android/SessionIdSpanAppenderTest.java | 0 .../src/test/java/io/opentelemetry/android/SessionIdTest.java | 0 .../io/opentelemetry/android/SessionIdTimeoutHandlerTest.java | 0 .../android/export/AttributeModifyingSpanExporterTest.java | 0 .../opentelemetry/android/export/FilteringSpanExporterTest.java | 0 .../io/opentelemetry/android/export/ModifiedSpanDataTest.java | 0 .../io/opentelemetry/android/export/SpanDataModifierTest.java | 0 .../java/io/opentelemetry/android/export/TestSpanHelper.java | 0 .../diskbuffering/scheduler/DefaultExportScheduleHandlerTest.kt | 0 .../diskbuffering/scheduler/DefaultExportSchedulerTest.kt | 0 .../diskbuffering/scheduler/SignalFromDiskExporterTest.kt | 0 .../instrumentation/AndroidInstrumentationRegistryImplTest.kt | 0 .../instrumentation/AndroidInstrumentationRegistryTest.kt | 0 .../android/instrumentation/TestAndroidInstrumentation.kt | 0 .../networkattrs/CurrentNetworkAttributesExtractorTest.java | 0 .../networkattrs/NetworkAttributesSpanAppenderTest.java | 0 .../android/internal/features/persistence/DiskManagerTest.kt | 0 .../features/persistence/SimpleTemporaryFileProviderTest.kt | 0 .../android/internal/initialization/InitializationEventsTest.kt | 0 .../android/internal/initialization/TestInitializationEvents.kt | 0 .../processors/GlobalAttributesLogRecordAppenderTest.kt | 0 .../android/internal/services/ServiceManagerImplTest.kt | 0 .../internal/services/applifecycle/AppLifecycleServiceTest.kt | 0 .../services/applifecycle/ApplicationStateWatcherTest.java | 0 .../android/internal/services/network/CarrierFinderTest.java | 0 .../internal/services/network/CurrentNetworkProviderTest.java | 0 .../internal/services/network/detector/NetworkDetectorTest.java | 0 .../services/network/detector/PostApi28NetworkDetectorTest.java | 0 .../services/network/detector/SimpleNetworkDetectorTest.java | 0 .../internal/services/periodicwork/PeriodicRunnableTest.kt | 0 .../internal/services/periodicwork/PeriodicWorkServiceTest.kt | 0 .../services/visiblescreen/VisibleScreenServiceTest.java | 0 .../activities/Pre29VisibleScreenLifecycleBindingTest.java | 0 .../activities/VisibleScreenLifecycleBindingTest.java | 0 .../fragments/RumFragmentActivityRegistererTest.java | 0 .../visiblescreen/fragments/VisibleFragmentTrackerTest.kt | 0 ...opentelemetry.android.instrumentation.AndroidInstrumentation | 0 ...lemetry.android.internal.initialization.InitializationEvents | 0 instrumentation/activity/build.gradle.kts | 2 +- instrumentation/anr/build.gradle.kts | 2 +- instrumentation/common-api/build.gradle.kts | 2 +- instrumentation/crash/build.gradle.kts | 2 +- instrumentation/fragment/build.gradle.kts | 2 +- instrumentation/network/build.gradle.kts | 2 +- instrumentation/slowrendering/build.gradle.kts | 2 +- instrumentation/startup/build.gradle.kts | 2 +- settings.gradle.kts | 2 +- 120 files changed, 9 insertions(+), 9 deletions(-) rename {android-agent => core}/build.gradle.kts (100%) rename {android-agent => core}/src/integrationTest/kotlin/io/opentelemetry/android/AgentInitTest.kt (100%) rename {android-agent => core}/src/main/AndroidManifest.xml (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/AndroidResource.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/GlobalAttributesSpanAppender.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/NoopOpenTelemetryRum.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/OpenTelemetryRumImpl.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SessionId.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SessionIdChangeListener.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SessionIdRatioBasedSampler.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/SessionIdTimeoutHandler.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/config/RumConstants.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/export/AttributeModifyingSpanExporter.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/export/FilteringSpanExporter.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/export/FilteringSpanExporterBuilder.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/export/ModifiedSpanData.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/export/SpanDataModifier.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/features/diskbuffering/DiskBufferingConfiguration.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/features/diskbuffering/SignalFromDiskExporter.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandler.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/ExportScheduleHandler.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImpl.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProvider.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/initialization/InitializationEvents.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppender.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/Preferences.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/Startable.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt (100%) rename {android-agent => core}/src/main/java/io/opentelemetry/android/package-info.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/AndroidResourceTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/GlobalAttributesSpanAppenderTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/SessionIdRatioBasedSamplerTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/SessionIdTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/SessionIdTimeoutHandlerTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/export/AttributeModifyingSpanExporterTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/export/FilteringSpanExporterTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/export/ModifiedSpanDataTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/export/SpanDataModifierTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/export/TestSpanHelper.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandlerTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportSchedulerTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/SignalFromDiskExporterTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImplTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/features/persistence/DiskManagerTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProviderTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/initialization/InitializationEventsTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/initialization/TestInitializationEvents.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppenderTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java (100%) rename {android-agent => core}/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt (100%) rename {android-agent => core}/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation (100%) rename {android-agent => core}/src/test/resources/META-INF/services/io.opentelemetry.android.internal.initialization.InitializationEvents (100%) diff --git a/android-agent/build.gradle.kts b/core/build.gradle.kts similarity index 100% rename from android-agent/build.gradle.kts rename to core/build.gradle.kts diff --git a/android-agent/src/integrationTest/kotlin/io/opentelemetry/android/AgentInitTest.kt b/core/src/integrationTest/kotlin/io/opentelemetry/android/AgentInitTest.kt similarity index 100% rename from android-agent/src/integrationTest/kotlin/io/opentelemetry/android/AgentInitTest.kt rename to core/src/integrationTest/kotlin/io/opentelemetry/android/AgentInitTest.kt diff --git a/android-agent/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml similarity index 100% rename from android-agent/src/main/AndroidManifest.xml rename to core/src/main/AndroidManifest.xml diff --git a/android-agent/src/main/java/io/opentelemetry/android/AndroidResource.java b/core/src/main/java/io/opentelemetry/android/AndroidResource.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/AndroidResource.java rename to core/src/main/java/io/opentelemetry/android/AndroidResource.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/GlobalAttributesSpanAppender.java b/core/src/main/java/io/opentelemetry/android/GlobalAttributesSpanAppender.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/GlobalAttributesSpanAppender.java rename to core/src/main/java/io/opentelemetry/android/GlobalAttributesSpanAppender.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/NoopOpenTelemetryRum.java b/core/src/main/java/io/opentelemetry/android/NoopOpenTelemetryRum.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/NoopOpenTelemetryRum.java rename to core/src/main/java/io/opentelemetry/android/NoopOpenTelemetryRum.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java b/core/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java rename to core/src/main/java/io/opentelemetry/android/OpenTelemetryRum.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java b/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java rename to core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumImpl.java b/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumImpl.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/OpenTelemetryRumImpl.java rename to core/src/main/java/io/opentelemetry/android/OpenTelemetryRumImpl.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java b/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java rename to core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java b/core/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java rename to core/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt b/core/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt rename to core/src/main/java/io/opentelemetry/android/SdkPreconfiguredRumBuilder.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionId.java b/core/src/main/java/io/opentelemetry/android/SessionId.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SessionId.java rename to core/src/main/java/io/opentelemetry/android/SessionId.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeListener.java b/core/src/main/java/io/opentelemetry/android/SessionIdChangeListener.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeListener.java rename to core/src/main/java/io/opentelemetry/android/SessionIdChangeListener.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java b/core/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java rename to core/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdRatioBasedSampler.java b/core/src/main/java/io/opentelemetry/android/SessionIdRatioBasedSampler.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SessionIdRatioBasedSampler.java rename to core/src/main/java/io/opentelemetry/android/SessionIdRatioBasedSampler.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java b/core/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java rename to core/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/SessionIdTimeoutHandler.java b/core/src/main/java/io/opentelemetry/android/SessionIdTimeoutHandler.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/SessionIdTimeoutHandler.java rename to core/src/main/java/io/opentelemetry/android/SessionIdTimeoutHandler.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java b/core/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java rename to core/src/main/java/io/opentelemetry/android/config/OtelRumConfig.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/config/RumConstants.java b/core/src/main/java/io/opentelemetry/android/config/RumConstants.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/config/RumConstants.java rename to core/src/main/java/io/opentelemetry/android/config/RumConstants.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/export/AttributeModifyingSpanExporter.java b/core/src/main/java/io/opentelemetry/android/export/AttributeModifyingSpanExporter.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/export/AttributeModifyingSpanExporter.java rename to core/src/main/java/io/opentelemetry/android/export/AttributeModifyingSpanExporter.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/export/FilteringSpanExporter.java b/core/src/main/java/io/opentelemetry/android/export/FilteringSpanExporter.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/export/FilteringSpanExporter.java rename to core/src/main/java/io/opentelemetry/android/export/FilteringSpanExporter.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/export/FilteringSpanExporterBuilder.java b/core/src/main/java/io/opentelemetry/android/export/FilteringSpanExporterBuilder.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/export/FilteringSpanExporterBuilder.java rename to core/src/main/java/io/opentelemetry/android/export/FilteringSpanExporterBuilder.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/export/ModifiedSpanData.java b/core/src/main/java/io/opentelemetry/android/export/ModifiedSpanData.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/export/ModifiedSpanData.java rename to core/src/main/java/io/opentelemetry/android/export/ModifiedSpanData.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/export/SpanDataModifier.java b/core/src/main/java/io/opentelemetry/android/export/SpanDataModifier.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/export/SpanDataModifier.java rename to core/src/main/java/io/opentelemetry/android/export/SpanDataModifier.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/DiskBufferingConfiguration.java b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/DiskBufferingConfiguration.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/DiskBufferingConfiguration.java rename to core/src/main/java/io/opentelemetry/android/features/diskbuffering/DiskBufferingConfiguration.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/SignalFromDiskExporter.kt b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/SignalFromDiskExporter.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/SignalFromDiskExporter.kt rename to core/src/main/java/io/opentelemetry/android/features/diskbuffering/SignalFromDiskExporter.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandler.kt b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandler.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandler.kt rename to core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandler.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt rename to core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/ExportScheduleHandler.kt b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/ExportScheduleHandler.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/ExportScheduleHandler.kt rename to core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/ExportScheduleHandler.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt b/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt rename to core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentation.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt b/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt rename to core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistry.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImpl.kt b/core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImpl.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImpl.kt rename to core/src/main/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImpl.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java rename to core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractor.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java b/core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java rename to core/src/main/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppender.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt b/core/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt rename to core/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProvider.kt b/core/src/main/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProvider.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProvider.kt rename to core/src/main/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProvider.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/initialization/InitializationEvents.kt b/core/src/main/java/io/opentelemetry/android/internal/initialization/InitializationEvents.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/initialization/InitializationEvents.kt rename to core/src/main/java/io/opentelemetry/android/internal/initialization/InitializationEvents.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppender.kt b/core/src/main/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppender.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppender.kt rename to core/src/main/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppender.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java b/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java rename to core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/Preferences.java b/core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/Preferences.java rename to core/src/main/java/io/opentelemetry/android/internal/services/Preferences.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt b/core/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/ServiceManager.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt b/core/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/ServiceManagerImpl.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/Startable.java b/core/src/main/java/io/opentelemetry/android/internal/services/Startable.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/Startable.java rename to core/src/main/java/io/opentelemetry/android/internal/services/Startable.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt b/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleService.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java b/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java rename to core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateListener.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt b/core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcher.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/CarrierFinder.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/NetworkChangeListener.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt b/core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/network/data/Carrier.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/data/CurrentNetwork.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/data/NetworkState.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetector.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetector.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java rename to core/src/main/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetector.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt b/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnable.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt b/core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkService.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt b/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenService.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.java b/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.java rename to core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/DefaultingActivityLifecycleCallbacks.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.java b/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.java rename to core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBinding.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.java b/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.java rename to core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBinding.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java b/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java rename to core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegisterer.java diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt b/core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt rename to core/src/main/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTracker.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt b/core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt rename to core/src/main/java/io/opentelemetry/android/internal/tools/time/SystemTime.kt diff --git a/android-agent/src/main/java/io/opentelemetry/android/package-info.java b/core/src/main/java/io/opentelemetry/android/package-info.java similarity index 100% rename from android-agent/src/main/java/io/opentelemetry/android/package-info.java rename to core/src/main/java/io/opentelemetry/android/package-info.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/AndroidResourceTest.java b/core/src/test/java/io/opentelemetry/android/AndroidResourceTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/AndroidResourceTest.java rename to core/src/test/java/io/opentelemetry/android/AndroidResourceTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/GlobalAttributesSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/GlobalAttributesSpanAppenderTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/GlobalAttributesSpanAppenderTest.java rename to core/src/test/java/io/opentelemetry/android/GlobalAttributesSpanAppenderTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java rename to core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java b/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java rename to core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java b/core/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java rename to core/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java rename to core/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdRatioBasedSamplerTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdRatioBasedSamplerTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/SessionIdRatioBasedSamplerTest.java rename to core/src/test/java/io/opentelemetry/android/SessionIdRatioBasedSamplerTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java rename to core/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/SessionIdTest.java rename to core/src/test/java/io/opentelemetry/android/SessionIdTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/SessionIdTimeoutHandlerTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdTimeoutHandlerTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/SessionIdTimeoutHandlerTest.java rename to core/src/test/java/io/opentelemetry/android/SessionIdTimeoutHandlerTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/export/AttributeModifyingSpanExporterTest.java b/core/src/test/java/io/opentelemetry/android/export/AttributeModifyingSpanExporterTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/export/AttributeModifyingSpanExporterTest.java rename to core/src/test/java/io/opentelemetry/android/export/AttributeModifyingSpanExporterTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/export/FilteringSpanExporterTest.java b/core/src/test/java/io/opentelemetry/android/export/FilteringSpanExporterTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/export/FilteringSpanExporterTest.java rename to core/src/test/java/io/opentelemetry/android/export/FilteringSpanExporterTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/export/ModifiedSpanDataTest.java b/core/src/test/java/io/opentelemetry/android/export/ModifiedSpanDataTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/export/ModifiedSpanDataTest.java rename to core/src/test/java/io/opentelemetry/android/export/ModifiedSpanDataTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/export/SpanDataModifierTest.java b/core/src/test/java/io/opentelemetry/android/export/SpanDataModifierTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/export/SpanDataModifierTest.java rename to core/src/test/java/io/opentelemetry/android/export/SpanDataModifierTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/export/TestSpanHelper.java b/core/src/test/java/io/opentelemetry/android/export/TestSpanHelper.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/export/TestSpanHelper.java rename to core/src/test/java/io/opentelemetry/android/export/TestSpanHelper.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandlerTest.kt b/core/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandlerTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandlerTest.kt rename to core/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduleHandlerTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportSchedulerTest.kt b/core/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportSchedulerTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportSchedulerTest.kt rename to core/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportSchedulerTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/SignalFromDiskExporterTest.kt b/core/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/SignalFromDiskExporterTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/SignalFromDiskExporterTest.kt rename to core/src/test/java/io/opentelemetry/android/features/diskbuffering/scheduler/SignalFromDiskExporterTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImplTest.kt b/core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImplTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImplTest.kt rename to core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryImplTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryTest.kt b/core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryTest.kt rename to core/src/test/java/io/opentelemetry/android/instrumentation/AndroidInstrumentationRegistryTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt b/core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt rename to core/src/test/java/io/opentelemetry/android/instrumentation/TestAndroidInstrumentation.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java rename to core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/CurrentNetworkAttributesExtractorTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java rename to core/src/test/java/io/opentelemetry/android/internal/features/networkattrs/NetworkAttributesSpanAppenderTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/features/persistence/DiskManagerTest.kt b/core/src/test/java/io/opentelemetry/android/internal/features/persistence/DiskManagerTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/features/persistence/DiskManagerTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/features/persistence/DiskManagerTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProviderTest.kt b/core/src/test/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProviderTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProviderTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/features/persistence/SimpleTemporaryFileProviderTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/initialization/InitializationEventsTest.kt b/core/src/test/java/io/opentelemetry/android/internal/initialization/InitializationEventsTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/initialization/InitializationEventsTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/initialization/InitializationEventsTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/initialization/TestInitializationEvents.kt b/core/src/test/java/io/opentelemetry/android/internal/initialization/TestInitializationEvents.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/initialization/TestInitializationEvents.kt rename to core/src/test/java/io/opentelemetry/android/internal/initialization/TestInitializationEvents.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppenderTest.kt b/core/src/test/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppenderTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppenderTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/processors/GlobalAttributesLogRecordAppenderTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt b/core/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/services/ServiceManagerImplTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt b/core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/AppLifecycleServiceTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/applifecycle/ApplicationStateWatcherTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/network/CarrierFinderTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProviderTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/network/detector/NetworkDetectorTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/network/detector/PostApi28NetworkDetectorTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/network/detector/SimpleNetworkDetectorTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt b/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicRunnableTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt b/core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/services/periodicwork/PeriodicWorkServiceTest.kt diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/VisibleScreenServiceTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/Pre29VisibleScreenLifecycleBindingTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/activities/VisibleScreenLifecycleBindingTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java b/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java rename to core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/RumFragmentActivityRegistererTest.java diff --git a/android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt b/core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt similarity index 100% rename from android-agent/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt rename to core/src/test/java/io/opentelemetry/android/internal/services/visiblescreen/fragments/VisibleFragmentTrackerTest.kt diff --git a/android-agent/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation b/core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation similarity index 100% rename from android-agent/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation rename to core/src/test/resources/META-INF/services/io.opentelemetry.android.instrumentation.AndroidInstrumentation diff --git a/android-agent/src/test/resources/META-INF/services/io.opentelemetry.android.internal.initialization.InitializationEvents b/core/src/test/resources/META-INF/services/io.opentelemetry.android.internal.initialization.InitializationEvents similarity index 100% rename from android-agent/src/test/resources/META-INF/services/io.opentelemetry.android.internal.initialization.InitializationEvents rename to core/src/test/resources/META-INF/services/io.opentelemetry.android.internal.initialization.InitializationEvents diff --git a/instrumentation/activity/build.gradle.kts b/instrumentation/activity/build.gradle.kts index ff9b31988..894287c91 100644 --- a/instrumentation/activity/build.gradle.kts +++ b/instrumentation/activity/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) - api(project(":android-agent")) + api(project(":core")) implementation(libs.opentelemetry.sdk) implementation(libs.androidx.core) implementation(libs.androidx.navigation.fragment) diff --git a/instrumentation/anr/build.gradle.kts b/instrumentation/anr/build.gradle.kts index ce7e66425..e14774d1d 100644 --- a/instrumentation/anr/build.gradle.kts +++ b/instrumentation/anr/build.gradle.kts @@ -20,7 +20,7 @@ android { dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) - api(project(":android-agent")) + 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 3b8592855..6eef21d41 100644 --- a/instrumentation/common-api/build.gradle.kts +++ b/instrumentation/common-api/build.gradle.kts @@ -14,7 +14,7 @@ android { } dependencies { - api(project(":android-agent")) + api(project(":core")) api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) implementation(libs.androidx.navigation.fragment) diff --git a/instrumentation/crash/build.gradle.kts b/instrumentation/crash/build.gradle.kts index b9edf7115..427682984 100644 --- a/instrumentation/crash/build.gradle.kts +++ b/instrumentation/crash/build.gradle.kts @@ -16,7 +16,7 @@ android { dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) - api(project(":android-agent")) + api(project(":core")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv.incubating) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/fragment/build.gradle.kts b/instrumentation/fragment/build.gradle.kts index 9d4482756..45b98b701 100644 --- a/instrumentation/fragment/build.gradle.kts +++ b/instrumentation/fragment/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) api(project(":instrumentation:common-api")) - api(project(":android-agent")) + api(project(":core")) implementation(libs.androidx.core) api(libs.androidx.navigation.fragment) implementation(libs.opentelemetry.sdk) diff --git a/instrumentation/network/build.gradle.kts b/instrumentation/network/build.gradle.kts index 651b4afe2..5635231cd 100644 --- a/instrumentation/network/build.gradle.kts +++ b/instrumentation/network/build.gradle.kts @@ -21,7 +21,7 @@ android { dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) - api(project(":android-agent")) + api(project(":core")) api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv.incubating) diff --git a/instrumentation/slowrendering/build.gradle.kts b/instrumentation/slowrendering/build.gradle.kts index b50bce212..96eaaf9de 100644 --- a/instrumentation/slowrendering/build.gradle.kts +++ b/instrumentation/slowrendering/build.gradle.kts @@ -16,7 +16,7 @@ android { dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) - api(project(":android-agent")) + api(project(":core")) api(project(":instrumentation:common-api")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) diff --git a/instrumentation/startup/build.gradle.kts b/instrumentation/startup/build.gradle.kts index ae06c02d1..fe5e828b8 100644 --- a/instrumentation/startup/build.gradle.kts +++ b/instrumentation/startup/build.gradle.kts @@ -16,7 +16,7 @@ android { dependencies { api(platform(libs.opentelemetry.platform)) api(libs.opentelemetry.api) - api(project(":android-agent")) + api(project(":core")) implementation(libs.androidx.core) implementation(libs.opentelemetry.semconv) implementation(libs.opentelemetry.sdk) diff --git a/settings.gradle.kts b/settings.gradle.kts index 883e6c0ea..c30931688 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ rootProject.name = "opentelemetry-android" -include(":android-agent") +include(":core") include(":instrumentation:activity") include(":instrumentation:anr") include(":instrumentation:common-api") From 92208808339c3851cddcceaa25ed7bcbde3de37e Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:55:07 +0200 Subject: [PATCH 07/13] Making instrumentations into services --- .../activity/ActivityLifecycleInstrumentation.kt | 2 ++ .../android/instrumentation/anr/AnrInstrumentation.java | 2 ++ .../instrumentation/crash/CrashReporterInstrumentation.java | 2 ++ .../fragment/FragmentLifecycleInstrumentation.kt | 2 ++ .../instrumentation/network/NetworkChangeInstrumentation.java | 2 ++ .../slowrendering/SlowRenderingInstrumentation.java | 2 ++ .../android/instrumentation/startup/StartupInstrumentation.kt | 2 ++ 7 files changed, 14 insertions(+) diff --git a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityLifecycleInstrumentation.kt b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityLifecycleInstrumentation.kt index 154927a04..fd1efce35 100644 --- a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityLifecycleInstrumentation.kt +++ b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityLifecycleInstrumentation.kt @@ -7,6 +7,7 @@ package io.opentelemetry.android.instrumentation.activity import android.app.Application import android.os.Build +import com.google.auto.service.AutoService import io.opentelemetry.android.OpenTelemetryRum import io.opentelemetry.android.instrumentation.AndroidInstrumentation import io.opentelemetry.android.instrumentation.activity.startup.AppStartupTimer @@ -16,6 +17,7 @@ import io.opentelemetry.android.internal.services.ServiceManager import io.opentelemetry.android.internal.services.visiblescreen.activities.DefaultingActivityLifecycleCallbacks import io.opentelemetry.api.trace.Tracer +@AutoService(AndroidInstrumentation::class) class ActivityLifecycleInstrumentation : AndroidInstrumentation { private val startupTimer: AppStartupTimer by lazy { AppStartupTimer() } private var screenNameExtractor: ScreenNameExtractor = ScreenNameExtractor.DEFAULT diff --git a/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrInstrumentation.java b/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrInstrumentation.java index f9be192dc..0188f06b8 100644 --- a/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrInstrumentation.java +++ b/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrInstrumentation.java @@ -8,6 +8,7 @@ import android.app.Application; import android.os.Looper; import androidx.annotation.NonNull; +import com.google.auto.service.AutoService; import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.internal.services.ServiceManager; @@ -18,6 +19,7 @@ import java.util.concurrent.ScheduledExecutorService; /** Entry point for {@link AnrDetector}. */ +@AutoService(AndroidInstrumentation.class) public final class AnrInstrumentation implements AndroidInstrumentation { final List> additionalExtractors = 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 286244c61..36713627a 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,6 +7,7 @@ import android.app.Application; import androidx.annotation.NonNull; +import com.google.auto.service.AutoService; import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.RuntimeDetailsExtractor; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; @@ -16,6 +17,7 @@ import java.util.List; /** Entrypoint for installing the crash reporting instrumentation. */ +@AutoService(AndroidInstrumentation.class) public final class CrashReporterInstrumentation implements AndroidInstrumentation { private final List> additionalExtractors = new ArrayList<>(); diff --git a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentLifecycleInstrumentation.kt b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentLifecycleInstrumentation.kt index 2eeb0ad75..d5676c984 100644 --- a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentLifecycleInstrumentation.kt +++ b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentLifecycleInstrumentation.kt @@ -8,6 +8,7 @@ package io.opentelemetry.android.instrumentation.fragment import android.app.Application import android.app.Application.ActivityLifecycleCallbacks import android.os.Build +import com.google.auto.service.AutoService import io.opentelemetry.android.OpenTelemetryRum import io.opentelemetry.android.instrumentation.AndroidInstrumentation import io.opentelemetry.android.instrumentation.common.Constants.INSTRUMENTATION_SCOPE @@ -16,6 +17,7 @@ import io.opentelemetry.android.internal.services.ServiceManager import io.opentelemetry.android.internal.services.visiblescreen.fragments.RumFragmentActivityRegisterer import io.opentelemetry.api.trace.Tracer +@AutoService(AndroidInstrumentation::class) class FragmentLifecycleInstrumentation : AndroidInstrumentation { private var screenNameExtractor = ScreenNameExtractor.DEFAULT private var tracerCustomizer: (Tracer) -> Tracer = { it } 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 e2364b042..c5bee1951 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,6 +7,7 @@ import android.app.Application; import androidx.annotation.NonNull; +import com.google.auto.service.AutoService; import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import io.opentelemetry.android.internal.services.ServiceManager; @@ -17,6 +18,7 @@ import java.util.List; /** Generates telemetry for when the network status changes. */ +@AutoService(AndroidInstrumentation.class) public final class NetworkChangeInstrumentation implements AndroidInstrumentation { final List> additionalExtractors = new ArrayList<>(); diff --git a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java index 4dca69a02..16916cc07 100644 --- a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java +++ b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java @@ -10,12 +10,14 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; +import com.google.auto.service.AutoService; import io.opentelemetry.android.OpenTelemetryRum; import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import java.time.Duration; /** Entrypoint for installing the slow rendering detection instrumentation. */ +@AutoService(AndroidInstrumentation.class) public final class SlowRenderingInstrumentation implements AndroidInstrumentation { Duration slowRenderingDetectionPollInterval = Duration.ofSeconds(1); diff --git a/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/StartupInstrumentation.kt b/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/StartupInstrumentation.kt index fab5df2d6..d2ac31876 100644 --- a/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/StartupInstrumentation.kt +++ b/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/StartupInstrumentation.kt @@ -6,10 +6,12 @@ package io.opentelemetry.android.instrumentation.startup import android.app.Application +import com.google.auto.service.AutoService import io.opentelemetry.android.OpenTelemetryRum import io.opentelemetry.android.instrumentation.AndroidInstrumentation import io.opentelemetry.android.internal.initialization.InitializationEvents +@AutoService(AndroidInstrumentation::class) class StartupInstrumentation : AndroidInstrumentation { override fun install( application: Application, From 9a5f03dde5cb2de79904102e665cc0c1c0fbc0ac Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:07:09 +0200 Subject: [PATCH 08/13] Created android-agent module --- android-agent/build.gradle.kts | 25 +++++++++++++++++++++++++ core/build.gradle.kts | 2 +- settings.gradle.kts | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 android-agent/build.gradle.kts diff --git a/android-agent/build.gradle.kts b/android-agent/build.gradle.kts new file mode 100644 index 000000000..57c442790 --- /dev/null +++ b/android-agent/build.gradle.kts @@ -0,0 +1,25 @@ +plugins { + id("otel.android-library-conventions") + id("otel.publish-conventions") +} + +android { + namespace = "io.opentelemetry.android.agent" +} + +dependencies { + api(project(":core")) + + // Default instrumentations: + api(project(":instrumentation:activity")) + api(project(":instrumentation:fragment")) + api(project(":instrumentation:crash")) + api(project(":instrumentation:startup")) + api(project(":instrumentation:slowrendering")) + api(project(":instrumentation:anr")) + api(project(":instrumentation:network")) +} + +extra["pomName"] = "OpenTelemetry Android Agent" +description = + "A library that contains all the commonly needed instrumentation for Android apps in a convenient way for minimum configuration." diff --git a/core/build.gradle.kts b/core/build.gradle.kts index a4ec4e38d..394a52280 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } android { - namespace = "io.opentelemetry.android" + namespace = "io.opentelemetry.android.core" buildToolsVersion = "34.0.0" diff --git a/settings.gradle.kts b/settings.gradle.kts index c30931688..0ed23cc0d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,7 @@ rootProject.name = "opentelemetry-android" include(":core") +include(":android-agent") include(":instrumentation:activity") include(":instrumentation:anr") include(":instrumentation:common-api") From dced3ce6ec349e365ad560939dfe7fc35782e9e3 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:29:33 +0200 Subject: [PATCH 09/13] Adding OtelRumConfig extensions --- android-agent/build.gradle.kts | 1 + .../android/agent/OtelRumConfigExtensions.kt | 80 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt diff --git a/android-agent/build.gradle.kts b/android-agent/build.gradle.kts index 57c442790..bd22531ae 100644 --- a/android-agent/build.gradle.kts +++ b/android-agent/build.gradle.kts @@ -9,6 +9,7 @@ android { dependencies { api(project(":core")) + implementation(libs.opentelemetry.instrumentation.api) // Default instrumentations: api(project(":instrumentation:activity")) 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 new file mode 100644 index 000000000..9bf17d895 --- /dev/null +++ b/android-agent/src/main/kotlin/io/opentelemetry/android/agent/OtelRumConfigExtensions.kt @@ -0,0 +1,80 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.android.agent + +import io.opentelemetry.android.config.OtelRumConfig +import io.opentelemetry.android.instrumentation.AndroidInstrumentationRegistry +import io.opentelemetry.android.instrumentation.activity.ActivityLifecycleInstrumentation +import io.opentelemetry.android.instrumentation.anr.AnrInstrumentation +import io.opentelemetry.android.instrumentation.common.ScreenNameExtractor +import io.opentelemetry.android.instrumentation.crash.CrashDetails +import io.opentelemetry.android.instrumentation.crash.CrashReporterInstrumentation +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 + +/** + * Convenience functions to allow configuring the default instrumentations through the [OtelRumConfig] object, for example: + * + * ``` + * OtelRumConfig() + * .setSessionTimeout(Duration.ofSeconds(10)) // Real OtelRumConfig function + * .setSlowRenderingDetectionPollInterval(Duration.ofSeconds(5)) // Extension function + * .disableScreenAttributes() // Real OtelRumConfig function + * ``` + */ + +fun OtelRumConfig.setActivityTracerCustomizer(customizer: (Tracer) -> Tracer): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(ActivityLifecycleInstrumentation::class.java) + ?.setTracerCustomizer(customizer) + return this +} + +fun OtelRumConfig.setActivityNameExtractor(screenNameExtractor: ScreenNameExtractor): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(ActivityLifecycleInstrumentation::class.java) + ?.setScreenNameExtractor(screenNameExtractor) + return this +} + +fun OtelRumConfig.setFragmentTracerCustomizer(customizer: (Tracer) -> Tracer): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(FragmentLifecycleInstrumentation::class.java) + ?.setTracerCustomizer(customizer) + return this +} + +fun OtelRumConfig.setFragmentNameExtractor(screenNameExtractor: ScreenNameExtractor): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(FragmentLifecycleInstrumentation::class.java) + ?.setScreenNameExtractor(screenNameExtractor) + return this +} + +fun OtelRumConfig.addAnrAttributesExtractor(extractor: AttributesExtractor, Void>): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(AnrInstrumentation::class.java) + ?.addAttributesExtractor(extractor) + return this +} + +fun OtelRumConfig.addCrashAttributesExtractor(extractor: AttributesExtractor): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(CrashReporterInstrumentation::class.java) + ?.addAttributesExtractor(extractor) + return this +} + +fun OtelRumConfig.addNetworkChangeAttributesExtractor(extractor: AttributesExtractor): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(NetworkChangeInstrumentation::class.java) + ?.addAttributesExtractor(extractor) + return this +} + +fun OtelRumConfig.setSlowRenderingDetectionPollInterval(interval: Duration): OtelRumConfig { + AndroidInstrumentationRegistry.get().get(SlowRenderingInstrumentation::class.java) + ?.setSlowRenderingDetectionPollInterval(interval) + return this +} From 2ac7205b33ee8f69bd368fad8d9f09c0f4e5c95a Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:31:37 +0200 Subject: [PATCH 10/13] Updating agent description --- android-agent/build.gradle.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android-agent/build.gradle.kts b/android-agent/build.gradle.kts index bd22531ae..a162286fe 100644 --- a/android-agent/build.gradle.kts +++ b/android-agent/build.gradle.kts @@ -23,4 +23,5 @@ dependencies { extra["pomName"] = "OpenTelemetry Android Agent" description = - "A library that contains all the commonly needed instrumentation for Android apps in a convenient way for minimum configuration." + "A library that contains all the commonly needed instrumentation for Android apps in a " + + "convenient way with minimum configuration needed." From 6604d1d7d329ab2136f442c501245c106fb3e035 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:34:21 +0200 Subject: [PATCH 11/13] Reverting core namespace change --- core/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 394a52280..a4ec4e38d 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } android { - namespace = "io.opentelemetry.android.core" + namespace = "io.opentelemetry.android" buildToolsVersion = "34.0.0" From 3ca8d44ebd478d45661e263a25e5f03634e42e61 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:40:56 +0200 Subject: [PATCH 12/13] Moving RumConstants to common package --- .../main/java/io/opentelemetry/android/AndroidResource.java | 2 +- .../io/opentelemetry/android/OpenTelemetryRumBuilder.java | 2 +- .../io/opentelemetry/android/RuntimeDetailsExtractor.java | 6 +++--- .../android/ScreenAttributesSpanProcessor.java | 2 +- .../io/opentelemetry/android/SessionIdChangeTracer.java | 2 +- .../io/opentelemetry/android/SessionIdSpanAppender.java | 2 +- .../android/{config => common}/RumConstants.java | 2 +- .../diskbuffering/scheduler/DefaultExportScheduler.kt | 2 +- .../android/internal/features/persistence/DiskManager.kt | 2 +- .../android/internal/services/CacheStorage.java | 2 +- .../internal/services/network/CurrentNetworkProvider.java | 2 +- .../java/io/opentelemetry/android/AndroidResourceTest.java | 2 +- .../opentelemetry/android/OpenTelemetryRumBuilderTest.java | 4 ++-- .../opentelemetry/android/RuntimeDetailsExtractorTest.java | 6 +++--- .../android/ScreenAttributesSpanProcessorTest.java | 2 +- .../io/opentelemetry/android/SessionIdChangeTracerTest.java | 2 +- .../io/opentelemetry/android/SessionIdSpanAppenderTest.java | 2 +- .../io/opentelemetry/android/demo/OtelDemoApplication.kt | 2 ++ .../android/instrumentation/activity/ActivityTracer.java | 6 +++--- .../instrumentation/activity/startup/AppStartupTimer.java | 2 +- .../instrumentation/activity/ActivityCallbacksTest.java | 6 +++--- .../instrumentation/activity/ActivityTracerTest.java | 6 +++--- .../activity/Pre29ActivityLifecycleCallbacksTest.java | 6 +++--- .../activity/startup/AppStartupTimerTest.java | 2 +- .../android/instrumentation/common/ActiveSpan.java | 2 +- .../android/instrumentation/fragment/FragmentTracer.java | 2 +- .../instrumentation/fragment/FragmentTracerTest.java | 2 +- .../fragment/RumFragmentLifecycleCallbacksTest.java | 4 ++-- .../instrumentation/slowrendering/SlowRenderListener.java | 2 +- .../slowrendering/SlowRenderingInstrumentation.java | 2 +- .../instrumentation/startup/SdkInitializationEvents.kt | 2 +- .../instrumentation/startup/SdkInitializationEventsTest.kt | 2 +- 32 files changed, 47 insertions(+), 45 deletions(-) rename core/src/main/java/io/opentelemetry/android/{config => common}/RumConstants.java (98%) diff --git a/core/src/main/java/io/opentelemetry/android/AndroidResource.java b/core/src/main/java/io/opentelemetry/android/AndroidResource.java index 232d1825d..c4ee93c79 100644 --- a/core/src/main/java/io/opentelemetry/android/AndroidResource.java +++ b/core/src/main/java/io/opentelemetry/android/AndroidResource.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.RUM_SDK_VERSION; +import static io.opentelemetry.android.common.RumConstants.RUM_SDK_VERSION; import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MANUFACTURER; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MODEL_IDENTIFIER; diff --git a/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java b/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java index 4de8a32ae..715d51ca7 100644 --- a/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java +++ b/core/src/main/java/io/opentelemetry/android/OpenTelemetryRumBuilder.java @@ -9,8 +9,8 @@ import android.app.Application; import android.util.Log; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.android.config.OtelRumConfig; -import io.opentelemetry.android.config.RumConstants; import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration; import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter; import io.opentelemetry.android.features.diskbuffering.scheduler.ExportScheduleHandler; diff --git a/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java b/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java index cb47e615a..307ff4c13 100644 --- a/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java +++ b/core/src/main/java/io/opentelemetry/android/RuntimeDetailsExtractor.java @@ -5,9 +5,9 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.BATTERY_PERCENT_KEY; -import static io.opentelemetry.android.config.RumConstants.HEAP_FREE_KEY; -import static io.opentelemetry.android.config.RumConstants.STORAGE_SPACE_FREE_KEY; +import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; +import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; +import static io.opentelemetry.android.common.RumConstants.STORAGE_SPACE_FREE_KEY; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/core/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java b/core/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java index 6978f3995..03335e03a 100644 --- a/core/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java +++ b/core/src/main/java/io/opentelemetry/android/ScreenAttributesSpanProcessor.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; import io.opentelemetry.android.internal.services.visiblescreen.VisibleScreenService; import io.opentelemetry.context.Context; diff --git a/core/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java b/core/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java index 156b7e319..67010f268 100644 --- a/core/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java +++ b/core/src/main/java/io/opentelemetry/android/SessionIdChangeTracer.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.api.trace.Tracer; final class SessionIdChangeTracer implements SessionIdChangeListener { diff --git a/core/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java b/core/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java index aff727cab..357227377 100644 --- a/core/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java +++ b/core/src/main/java/io/opentelemetry/android/SessionIdSpanAppender.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.context.Context; import io.opentelemetry.sdk.trace.ReadWriteSpan; import io.opentelemetry.sdk.trace.ReadableSpan; diff --git a/core/src/main/java/io/opentelemetry/android/config/RumConstants.java b/core/src/main/java/io/opentelemetry/android/common/RumConstants.java similarity index 98% rename from core/src/main/java/io/opentelemetry/android/config/RumConstants.java rename to core/src/main/java/io/opentelemetry/android/common/RumConstants.java index 3b14cc39e..70fa5c078 100644 --- a/core/src/main/java/io/opentelemetry/android/config/RumConstants.java +++ b/core/src/main/java/io/opentelemetry/android/common/RumConstants.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package io.opentelemetry.android.config; +package io.opentelemetry.android.common; import static io.opentelemetry.api.common.AttributeKey.doubleKey; import static io.opentelemetry.api.common.AttributeKey.longKey; diff --git a/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt index 4ca030073..f4beb661e 100644 --- a/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt +++ b/core/src/main/java/io/opentelemetry/android/features/diskbuffering/scheduler/DefaultExportScheduler.kt @@ -6,7 +6,7 @@ package io.opentelemetry.android.features.diskbuffering.scheduler import android.util.Log -import io.opentelemetry.android.config.RumConstants.OTEL_RUM_LOG_TAG +import io.opentelemetry.android.common.RumConstants.OTEL_RUM_LOG_TAG import io.opentelemetry.android.features.diskbuffering.SignalFromDiskExporter import io.opentelemetry.android.internal.services.ServiceManager import io.opentelemetry.android.internal.services.periodicwork.PeriodicRunnable diff --git a/core/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt b/core/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt index fdc5ecea0..f9d89beea 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt +++ b/core/src/main/java/io/opentelemetry/android/internal/features/persistence/DiskManager.kt @@ -6,7 +6,7 @@ package io.opentelemetry.android.internal.features.persistence import android.util.Log -import io.opentelemetry.android.config.RumConstants +import io.opentelemetry.android.common.RumConstants import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration import io.opentelemetry.android.internal.services.CacheStorage import io.opentelemetry.android.internal.services.Preferences diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java b/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java index 9d4e4c190..2f4751411 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java +++ b/core/src/main/java/io/opentelemetry/android/internal/services/CacheStorage.java @@ -11,7 +11,7 @@ import android.util.Log; import androidx.annotation.RequiresApi; import androidx.annotation.WorkerThread; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import java.io.File; import java.io.IOException; import java.util.UUID; diff --git a/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java b/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java index b0d3e1d7f..2da0fcc9a 100644 --- a/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java +++ b/core/src/main/java/io/opentelemetry/android/internal/services/network/CurrentNetworkProvider.java @@ -14,7 +14,7 @@ import android.os.Build; import android.util.Log; import androidx.annotation.NonNull; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; 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; diff --git a/core/src/test/java/io/opentelemetry/android/AndroidResourceTest.java b/core/src/test/java/io/opentelemetry/android/AndroidResourceTest.java index 7d7710317..1e1fe6462 100644 --- a/core/src/test/java/io/opentelemetry/android/AndroidResourceTest.java +++ b/core/src/test/java/io/opentelemetry/android/AndroidResourceTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.RUM_SDK_VERSION; +import static io.opentelemetry.android.common.RumConstants.RUM_SDK_VERSION; import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_NAME; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MANUFACTURER; import static io.opentelemetry.semconv.incubating.DeviceIncubatingAttributes.DEVICE_MODEL_IDENTIFIER; diff --git a/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java index a994edabd..b5f56d680 100644 --- a/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java +++ b/core/src/test/java/io/opentelemetry/android/OpenTelemetryRumBuilderTest.java @@ -5,8 +5,8 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.SESSION_ID_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SESSION_ID_KEY; import static io.opentelemetry.api.common.AttributeKey.stringKey; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; diff --git a/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java b/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java index ef9a47e69..17dc5c59c 100644 --- a/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java +++ b/core/src/test/java/io/opentelemetry/android/RuntimeDetailsExtractorTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.BATTERY_PERCENT_KEY; -import static io.opentelemetry.android.config.RumConstants.HEAP_FREE_KEY; -import static io.opentelemetry.android.config.RumConstants.STORAGE_SPACE_FREE_KEY; +import static io.opentelemetry.android.common.RumConstants.BATTERY_PERCENT_KEY; +import static io.opentelemetry.android.common.RumConstants.HEAP_FREE_KEY; +import static io.opentelemetry.android.common.RumConstants.STORAGE_SPACE_FREE_KEY; import static io.opentelemetry.context.Context.root; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; import static org.mockito.Mockito.when; diff --git a/core/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java b/core/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java index d9ff3d460..d73881012 100644 --- a/core/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java +++ b/core/src/test/java/io/opentelemetry/android/ScreenAttributesSpanProcessorTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.mockito.Mockito.mock; diff --git a/core/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java index cfc018004..a565f96ed 100644 --- a/core/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java +++ b/core/src/test/java/io/opentelemetry/android/SessionIdChangeTracerTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.PREVIOUS_SESSION_ID_KEY; +import static io.opentelemetry.android.common.RumConstants.PREVIOUS_SESSION_ID_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import io.opentelemetry.api.common.Attributes; diff --git a/core/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java b/core/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java index 9dc8bd70d..957feee2f 100644 --- a/core/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java +++ b/core/src/test/java/io/opentelemetry/android/SessionIdSpanAppenderTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android; -import static io.opentelemetry.android.config.RumConstants.SESSION_ID_KEY; +import static io.opentelemetry.android.common.RumConstants.SESSION_ID_KEY; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.verify; diff --git a/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt b/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt index 71dd1a0d5..fa0726f60 100644 --- a/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt +++ b/demo-app/src/main/java/io/opentelemetry/android/demo/OtelDemoApplication.kt @@ -10,6 +10,7 @@ import android.app.Application import android.util.Log import io.opentelemetry.android.OpenTelemetryRum import io.opentelemetry.android.OpenTelemetryRumBuilder +import io.opentelemetry.android.agent.setSlowRenderingDetectionPollInterval import io.opentelemetry.android.config.OtelRumConfig import io.opentelemetry.android.features.diskbuffering.DiskBufferingConfiguration import io.opentelemetry.api.common.AttributeKey.stringKey @@ -19,6 +20,7 @@ import io.opentelemetry.api.trace.Tracer import io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporter import io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter import io.opentelemetry.sdk.logs.internal.SdkEventLoggerProvider +import java.time.Duration import kotlin.math.log const val TAG = "otel.demo" diff --git a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java index 59aeb04b4..4c9dd69f1 100644 --- a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java +++ b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/ActivityTracer.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.config.RumConstants.APP_START_SPAN_NAME; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.common.RumConstants.APP_START_SPAN_NAME; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; import android.app.Activity; import androidx.annotation.NonNull; diff --git a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java index 5c0fea646..f13147468 100644 --- a/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java +++ b/instrumentation/activity/src/main/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimer.java @@ -12,7 +12,7 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.android.internal.services.visiblescreen.activities.DefaultingActivityLifecycleCallbacks; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java index 6d97dda4f..23cb77008 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityCallbacksTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java index 4e59c2e17..d6f770f76 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/ActivityTracerTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java index 489238920..7d246a768 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/Pre29ActivityLifecycleCallbacksTest.java @@ -5,9 +5,9 @@ package io.opentelemetry.android.instrumentation.activity; -import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java index e1da48a15..2c034498a 100644 --- a/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java +++ b/instrumentation/activity/src/test/java/io/opentelemetry/android/instrumentation/activity/startup/AppStartupTimerTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.instrumentation.activity.startup; -import static io.opentelemetry.android.config.RumConstants.START_TYPE_KEY; +import static io.opentelemetry.android.common.RumConstants.START_TYPE_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; diff --git a/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java b/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java index 6a8b47a35..49d700cfb 100644 --- a/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java +++ b/instrumentation/common-api/src/main/java/io/opentelemetry/android/instrumentation/common/ActiveSpan.java @@ -6,7 +6,7 @@ package io.opentelemetry.android.instrumentation.common; import androidx.annotation.Nullable; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Scope; import java.util.function.Supplier; diff --git a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java index 6b4b09aa2..cd3e8efa3 100644 --- a/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java +++ b/instrumentation/fragment/src/main/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracer.java @@ -6,7 +6,7 @@ package io.opentelemetry.android.instrumentation.fragment; import androidx.fragment.app.Fragment; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.android.instrumentation.common.ActiveSpan; import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.Span; diff --git a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java index 74e3d4888..b9b1999e1 100644 --- a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java +++ b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/FragmentTracerTest.java @@ -5,7 +5,7 @@ package io.opentelemetry.android.instrumentation.fragment; -import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; diff --git a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java index 2b3c4891a..ea2bd3605 100644 --- a/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java +++ b/instrumentation/fragment/src/test/java/io/opentelemetry/android/instrumentation/fragment/RumFragmentLifecycleCallbacksTest.java @@ -5,8 +5,8 @@ package io.opentelemetry.android.instrumentation.fragment; -import static io.opentelemetry.android.config.RumConstants.LAST_SCREEN_NAME_KEY; -import static io.opentelemetry.android.config.RumConstants.SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.LAST_SCREEN_NAME_KEY; +import static io.opentelemetry.android.common.RumConstants.SCREEN_NAME_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java index c8a7b2c5b..29cadd6f6 100644 --- a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java +++ b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java @@ -20,7 +20,7 @@ import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.android.internal.services.visiblescreen.activities.DefaultingActivityLifecycleCallbacks; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; diff --git a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java index 16916cc07..fd997bc85 100644 --- a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java +++ b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderingInstrumentation.java @@ -12,7 +12,7 @@ import androidx.annotation.RequiresApi; import com.google.auto.service.AutoService; import io.opentelemetry.android.OpenTelemetryRum; -import io.opentelemetry.android.config.RumConstants; +import io.opentelemetry.android.common.RumConstants; import io.opentelemetry.android.instrumentation.AndroidInstrumentation; import java.time.Duration; diff --git a/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt b/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt index be3390b50..67a374659 100644 --- a/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt +++ b/instrumentation/startup/src/main/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEvents.kt @@ -6,8 +6,8 @@ package io.opentelemetry.android.instrumentation.startup import com.google.auto.service.AutoService +import io.opentelemetry.android.common.RumConstants import io.opentelemetry.android.config.OtelRumConfig -import io.opentelemetry.android.config.RumConstants import io.opentelemetry.android.internal.initialization.InitializationEvents import io.opentelemetry.api.OpenTelemetry import io.opentelemetry.api.common.AttributeKey diff --git a/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt b/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt index 077786345..4fb8eeb19 100644 --- a/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt +++ b/instrumentation/startup/src/test/java/io/opentelemetry/android/instrumentation/startup/SdkInitializationEventsTest.kt @@ -9,7 +9,7 @@ import io.mockk.called import io.mockk.every import io.mockk.mockk import io.mockk.verify -import io.opentelemetry.android.config.RumConstants +import io.opentelemetry.android.common.RumConstants import io.opentelemetry.api.common.AttributeKey.stringKey import io.opentelemetry.api.common.Attributes import io.opentelemetry.sdk.OpenTelemetrySdk From 5e85a1d27496eee7960cf689e53773afb63474b8 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:22:26 +0200 Subject: [PATCH 13/13] Adding auto service annotations as implementation to avoid R8 complains --- .../src/main/kotlin/otel.android-library-conventions.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts index d1d2a91a0..afcdf8bc4 100644 --- a/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts @@ -45,7 +45,7 @@ tasks.withType { val libs = extensions.getByType().named("libs") dependencies { implementation(libs.findLibrary("findbugs-jsr305").get()) - compileOnly(libs.findLibrary("auto-service-annotations").get()) + implementation(libs.findLibrary("auto-service-annotations").get()) kapt(libs.findLibrary("auto-service-processor").get()) testImplementation(libs.findLibrary("assertj-core").get()) testImplementation(libs.findBundle("mocking").get())