diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d56a43f..e129b758 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.25.0](https://github.com/rudderlabs/rudder-sdk-android/compare/v1.24.0...v1.25.0) (2024-08-27) + + +### Features + +* add option to configure `dataPlaneUrl` as the metrics url ([#471](https://github.com/rudderlabs/rudder-sdk-android/issues/471)) ([f0d3ef1](https://github.com/rudderlabs/rudder-sdk-android/commit/f0d3ef130fa75dff0a1162792f04279ba78055b1)) + ## [1.24.0](https://github.com/rudderlabs/rudder-sdk-android/compare/v1.23.3...v1.24.0) (2024-07-31) diff --git a/core/build.gradle b/core/build.gradle index cac6e77d..c6bc79ba 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -44,10 +44,8 @@ dependencies { implementation 'androidx.annotation:annotation:1.6.0' - implementation 'com.rudderstack.android.sdk:rudderreporter:[0.4.0, 0.6.0)' -// implementation(project(path: ':rudderreporter')) -// implementation(project(path: ':gsonrudderadapter')) - implementation 'com.rudderstack.kotlin.sdk:gsonrudderadapter:[0.2.0, 0.3.0)' + implementation 'com.rudderstack.android.sdk:rudderreporter:0.6.0' + implementation 'com.rudderstack.kotlin.sdk:gsonrudderadapter:0.2.0' // required for new life cycle methods compileOnly 'androidx.lifecycle:lifecycle-process:2.6.1' @@ -89,4 +87,4 @@ tasks.withType(JavaExec) { //apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" apply from: rootProject.file('gradle/mvn-publish.gradle') -apply from: rootProject.file('gradle/codecov.gradle') \ No newline at end of file +apply from: rootProject.file('gradle/codecov.gradle') diff --git a/core/src/main/java/com/rudderstack/android/sdk/core/EventRepository.java b/core/src/main/java/com/rudderstack/android/sdk/core/EventRepository.java index a3a4102f..5ad5b7ca 100644 --- a/core/src/main/java/com/rudderstack/android/sdk/core/EventRepository.java +++ b/core/src/main/java/com/rudderstack/android/sdk/core/EventRepository.java @@ -161,7 +161,7 @@ private void initiateRudderReporterFromPrefetchedConfig() { if (serverConfig != null && serverConfig.source != null && serverConfig.source.sourceConfiguration != null) { RudderLogger.logDebug("EventRepository: constructor: Prefetched source serverConfig is available"); - enableStatsCollection(application, writeKey, serverConfig.source.sourceConfiguration.getStatsCollection()); + enableStatsCollection(application, writeKey, serverConfig.source.sourceConfiguration.getStatsCollection(), dataResidencyManager.getDataPlaneUrl()); } else { RudderLogger.logDebug("EventRepository: constructor: Prefetched source serverConfig is not available"); } @@ -271,8 +271,6 @@ private void initiateSDK(@Nullable RudderConsentFilter consentFilter) { if (serverConfig != null) { isSDKEnabled = serverConfig.source.isSourceEnabled; if (isSDKEnabled) { - if (serverConfig.source.sourceConfiguration != null) - enableStatsCollection(application, writeKey, serverConfig.source.sourceConfiguration.getStatsCollection()); dataResidencyManager.setDataResidencyUrls(serverConfig); dataPlaneUrl = dataResidencyManager.getDataPlaneUrl(); if (dataPlaneUrl == null) { @@ -281,6 +279,8 @@ private void initiateSDK(@Nullable RudderConsentFilter consentFilter) { Collections.singletonMap(LABEL_TYPE, LABEL_TYPE_DATA_PLANE_URL_INVALID)); return; } + if (serverConfig.source.sourceConfiguration != null) + enableStatsCollection(application, writeKey, serverConfig.source.sourceConfiguration.getStatsCollection(), dataPlaneUrl); if (consentFilter != null) this.consentFilterHandler = new ConsentFilterHandler(serverConfig.source, consentFilter); cloudModeManager.startCloudModeProcessor(); diff --git a/core/src/main/java/com/rudderstack/android/sdk/core/ReportManager.java b/core/src/main/java/com/rudderstack/android/sdk/core/ReportManager.java index c3b6cc2d..bd198bec 100644 --- a/core/src/main/java/com/rudderstack/android/sdk/core/ReportManager.java +++ b/core/src/main/java/com/rudderstack/android/sdk/core/ReportManager.java @@ -100,8 +100,6 @@ private ReportManager() { private static final String FLUSH_WORKER_INIT_COUNTER_TAG = "flush_worker_init"; private static final String ENCRYPTED_DB_COUNTER_TAG = "db_encrypt"; - private static final String METRICS_URL_DEV = "https://sdk-metrics.dev-rudder.rudderlabs.com/"; - private static final String METRICS_URL_PROD = "https://sdk-metrics.rudderstack.com/"; private static Metrics metrics = null; private static ErrorClient errorStatsClient = null; @@ -161,7 +159,7 @@ private static void incrementCounter(LongCounter counter, int value) { @SuppressWarnings("ConstantConditions") static void enableStatsCollection(Application application, String writeKey, - @NonNull SourceConfiguration.StatsCollection statsCollection) { + @NonNull SourceConfiguration.StatsCollection statsCollection, String dataPlaneUrl) { if (!isStatsReporterAvailable()) { if (!(statsCollection.getMetrics().isEnabled() || statsCollection.getErrors().isEnabled())) { RudderLogger.logDebug("EventRepository: Stats collection is not enabled"); @@ -169,7 +167,7 @@ static void enableStatsCollection(Application application, String writeKey, } RudderLogger.logDebug("EventRepository: Creating Stats Reporter"); initiateRudderReporter(application, writeKey, statsCollection.getMetrics().isEnabled(), - statsCollection.getErrors().isEnabled()); + statsCollection.getErrors().isEnabled(), dataPlaneUrl); RudderLogger.logDebug("EventRepository: Metrics collection is not initialized"); return; } @@ -211,10 +209,10 @@ private static void checkAndUpdateErrorsCollection(boolean isErrorsEnabled) { } private static void initiateRudderReporter(Context context, @Nullable String writeKey, - boolean isMetricsEnabled, boolean isErrorsEnabled) { + boolean isMetricsEnabled, boolean isErrorsEnabled, String dataPlaneUrl) { RudderLogger.logDebug("EventRepository: Creating RudderReporter isMetricsEnabled: " + isMetricsEnabled + " isErrorsEnabled: " + isErrorsEnabled); if (rudderReporter == null) { - rudderReporter = new DefaultRudderReporter(context, METRICS_URL_PROD, + rudderReporter = new DefaultRudderReporter(context, dataPlaneUrl, getStatsConfig(writeKey), new GsonAdapter(), isMetricsEnabled, isErrorsEnabled); rudderReporter.getSyncer().startScheduledSyncs(METRICS_UPLOAD_INTERVAL, true, METRICS_FLUSH_COUNT); diff --git a/gradle.properties b/gradle.properties index a5267507..5c4f968c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ android.enableJetifier=true android.enableR8.fullMode=true kotlin.code.style=official GROUP=com.rudderstack.android.sdk -VERSION_CODE=31 -VERSION_NAME=1.24.0 +VERSION_CODE=32 +VERSION_NAME=1.25.0 POM_NAME=Rudderstack SDK for android POM_DESCRIPTION=Rudderstack SDK for android POM_ARTIFACT_ID=core diff --git a/package.json b/package.json index f37af98d..5b0439b6 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.24.0", + "version": "1.25.0", "dependencies": { "properties-reader": "^2.2.0" }