diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73608ca48..4eb49735a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -210,12 +210,6 @@ jobs: echo "lane=production" >> $GITHUB_OUTPUT fi - - name: Ensure internal track has version for promotion - if: "!contains(github.ref_name, '-internal') && needs.check-versioncode-google-play.outputs.exists != 'true'" - run: | - echo "::error::Cannot promote: versionCode ${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }} not found on Google Play internal track. Run internal build first." >&2 - exit 1 - - name: Promote on Google Play if: "steps.fastlane_lane.outputs.lane != '' && needs.check-versioncode-google-play.outputs.exists == 'true'" env: diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e5702f712..ed916dd7e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +import com.datadog.gradle.plugin.InstrumentationMode import com.geeksville.mesh.buildlogic.GitVersionValueSource import java.io.FileInputStream import java.util.Properties @@ -256,3 +257,7 @@ dokka { maxHeapSize = "6g" } } + +datadog { + composeInstrumentation = InstrumentationMode.AUTO +} diff --git a/core/analytics/src/google/kotlin/org/meshtastic/core/analytics/platform/GooglePlatformAnalytics.kt b/core/analytics/src/google/kotlin/org/meshtastic/core/analytics/platform/GooglePlatformAnalytics.kt index 107595bf4..abe12c2fc 100644 --- a/core/analytics/src/google/kotlin/org/meshtastic/core/analytics/platform/GooglePlatformAnalytics.kt +++ b/core/analytics/src/google/kotlin/org/meshtastic/core/analytics/platform/GooglePlatformAnalytics.kt @@ -21,7 +21,7 @@ import android.app.Application import android.content.Context import android.os.Bundle import android.provider.Settings -import android.util.Log.WARN +import android.util.Log.DEBUG import androidx.compose.runtime.Composable import androidx.lifecycle.ProcessLifecycleOwner import androidx.lifecycle.lifecycleScope @@ -76,11 +76,13 @@ constructor( analyticsPrefs: AnalyticsPrefs, ) : PlatformAnalytics { - private val sampleRate = 10f // For Datadog remote sample rate + private val sampleRate = + 100f.takeIf { BuildConfig.DEBUG } ?: 10f // For Datadog remote sample rate private val isInTestLab: Boolean get() { - val testLabSetting = Settings.System.getString(context.contentResolver, "firebase.test.lab") + val testLabSetting = + Settings.System.getString(context.contentResolver, "firebase.test.lab") return "true" == testLabSetting } @@ -92,20 +94,16 @@ constructor( init { initDatadog(context as Application, analyticsPrefs) initCrashlytics(context, analyticsPrefs) - Timber.plant(Timber.DebugTree()) // Always plant DebugTree - if (isPlatformServicesAvailable) { - val datadogLogger = - Logger.Builder() - .setService(SERVICE_NAME) - .setNetworkInfoEnabled(true) - .setRemoteSampleRate(sampleRate) - .setBundleWithTraceEnabled(true) - .setBundleWithRumEnabled(true) - .build() - Timber.plant(DatadogTree(datadogLogger)) - Timber.plant(CrashlyticsTree()) - } + val datadogLogger = + Logger.Builder() + .setService(SERVICE_NAME) + .setNetworkInfoEnabled(true) + .setRemoteSampleRate(sampleRate) + .setBundleWithTraceEnabled(true) + .setBundleWithRumEnabled(true) + .build() + Timber.plant(DatadogTree(datadogLogger), CrashlyticsTree()) // Initial consent state updateAnalyticsConsent(analyticsPrefs.analyticsAllowed) @@ -130,7 +128,7 @@ constructor( // Initialize with PENDING, consent will be updated via updateAnalyticsConsent Datadog.initialize(application, configuration, TrackingConsent.PENDING) Datadog.setUserInfo(analyticsPrefs.installId) - Datadog.setVerbosity(WARN) + Datadog.setVerbosity(DEBUG) val rumConfiguration = RumConfiguration.Builder(BuildConfig.datadogApplicationId) @@ -189,7 +187,8 @@ constructor( override fun setDeviceAttributes(firmwareVersion: String, model: String) { if (!Datadog.isInitialized() || !GlobalRumMonitor.isRegistered()) return - GlobalRumMonitor.get().addAttribute("firmware_version", firmwareVersion.extractSemanticVersion()) + GlobalRumMonitor.get() + .addAttribute("firmware_version", firmwareVersion.extractSemanticVersion()) GlobalRumMonitor.get().addAttribute("device_hardware", model) } @@ -244,7 +243,8 @@ constructor( private fun String.extractSemanticVersion(): String { val regex = "^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?".toRegex() val matchResult = regex.find(this) - return matchResult?.groupValues?.drop(1)?.filter { it.isNotEmpty() }?.joinToString(".") ?: this + return matchResult?.groupValues?.drop(1)?.filter { it.isNotEmpty() }?.joinToString(".") + ?: this } override fun track(event: String, vararg properties: DataPair) { @@ -253,10 +253,16 @@ constructor( when (it.value) { is Double -> bundle.putDouble(it.name, it.value) is Int -> - bundle.putLong(it.name, it.value.toLong()) // Firebase expects Long for integer values in bundles + bundle.putLong( + it.name, + it.value.toLong() + ) // Firebase expects Long for integer values in bundles is Long -> bundle.putLong(it.name, it.value) is Float -> bundle.putDouble(it.name, it.value.toDouble()) - is String -> bundle.putString(it.name, it.value as String?) // Explicitly handle String + is String -> bundle.putString( + it.name, + it.value as String? + ) // Explicitly handle String else -> bundle.putString(it.name, it.value.toString()) // Fallback for other types } Timber.tag(TAG).d("Analytics: track $event (${it.name} : ${it.value})")