Skip to content

Commit e098807

Browse files
authored
Merge pull request #2500 from DataDog/nogorodnikov/merge-release-2.18.0-into-master
Merge `release/2.18.0` branch into `master` branch
2 parents ae517d1 + a68cfbb commit e098807

File tree

127 files changed

+4212
-826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+4212
-826
lines changed

.github/workflows/codeql-analysis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ jobs:
2626

2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030

3131
- name: Setup Java 17
32-
uses: actions/setup-java@v4
32+
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
3333
with:
3434
distribution: 'zulu'
3535
java-version: 17
3636

3737
# Initializes the CodeQL tools for scanning.
3838
- name: Initialize CodeQL
39-
uses: github/codeql-action/init@v3
39+
uses: github/codeql-action/init@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
4040
with:
4141
languages: ${{ matrix.language }}
4242
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -47,7 +47,7 @@ jobs:
4747

4848

4949
- name: Setup Gradle
50-
uses: gradle/actions/setup-gradle@v3
50+
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3.5.0
5151
with:
5252
gradle-version: 8.1.1
5353

@@ -57,6 +57,6 @@ jobs:
5757

5858
# Perform the analysis
5959
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@v3
60+
uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
6161
with:
6262
category: "/language:${{matrix.language}}"

.gitlab-ci.yml

+21
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,27 @@ test-pyramid:single-fit-trace:
318318
reports:
319319
junit: "**/build/test-results/testReleaseUnitTest/*.xml"
320320

321+
test-pyramid:single-fit-okhttp:
322+
tags: [ "arch:amd64" ]
323+
image: $CI_IMAGE_DOCKER
324+
stage: test-pyramid
325+
timeout: 1h
326+
cache:
327+
key: $CI_COMMIT_REF_SLUG
328+
paths:
329+
- cache/caches/
330+
- cache/notifications/
331+
policy: pull
332+
script:
333+
- rm -rf ~/.gradle/daemon/
334+
- export DD_AGENT_HOST="$BUILDENV_HOST_IP"
335+
- GRADLE_OPTS="-Xmx3072m" DD_TAGS="test.configuration.variant:release" ./gradlew :reliability:single-fit:okhttp:testReleaseUnitTest --stacktrace --no-daemon --build-cache --gradle-user-home cache/ -Dorg.gradle.jvmargs=-javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG
336+
artifacts:
337+
when: always
338+
expire_in: 1 week
339+
reports:
340+
junit: "**/build/test-results/testReleaseUnitTest/*.xml"
341+
321342
# RUN INSTRUMENTED TESTS ON MIN API (21), LATEST API (34) and MEDIAN API (28)
322343

323344
test-pyramid:legacy-integration-instrumented-min-api:

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
# 2.18.0 / 2025-02-03
2+
3+
* [FEATURE] Allow disabling 404 span redaction. See [#2496](https://github.com/DataDog/dd-sdk-android/pull/2496)
4+
* [IMPROVEMENT] Improve telemetry on invalid view duration. See [#2466](https://github.com/DataDog/dd-sdk-android/pull/2466)
5+
* [IMPROVEMENT] Improve the view duration accuracy. See [#2467](https://github.com/DataDog/dd-sdk-android/pull/2467)
6+
* [IMPROVEMENT] Fix internal telemetry on invalid loading time usage. See [#2468](https://github.com/DataDog/dd-sdk-android/pull/2468)
7+
* [IMPROVEMENT] Add `Slider` semantics node mapper. See [#2459](https://github.com/DataDog/dd-sdk-android/pull/2459)
8+
* [IMPROVEMENT] Fix ProGuard rules for Compose `Checkbox`. See [#2470](https://github.com/DataDog/dd-sdk-android/pull/2470)
9+
* [IMPROVEMENT] Remove non-critical Compose reflection error from telemetry. See [#2476](https://github.com/DataDog/dd-sdk-android/pull/2476)
10+
* [IMPROVEMENT] Add Semantics mapper for `Switch`. See [#2471](https://github.com/DataDog/dd-sdk-android/pull/2471)
11+
* [IMPROVEMENT] Apply contrasting color to `Semantics` component. See [#2477](https://github.com/DataDog/dd-sdk-android/pull/2477)
12+
* [IMPROVEMENT] Fix center crop image is not cropped in wireframe. See [#2479](https://github.com/DataDog/dd-sdk-android/pull/2479)
13+
* [IMPROVEMENT] Add `RadioButton` color. See [#2478](https://github.com/DataDog/dd-sdk-android/pull/2478)
14+
* [IMPROVEMENT] Update enums to match RUM event schema. See [#2482](https://github.com/DataDog/dd-sdk-android/pull/2482)
15+
* [IMPROVEMENT] Fix `_dd.rule_psr` attribute calculation for RUM. See [#2485](https://github.com/DataDog/dd-sdk-android/pull/2485)
16+
* [IMPROVEMENT] Implement Head-based sampling for network instrumentation. See [#2483](https://github.com/DataDog/dd-sdk-android/pull/2483)
17+
* [IMPROVEMENT] Add OpenTracing API as exported dependency to OkHttp instrumentation. See [#2488](https://github.com/DataDog/dd-sdk-android/pull/2488)
18+
* [IMPROVEMENT] Improve `updateFeatureContext` performances. See [#2489](https://github.com/DataDog/dd-sdk-android/pull/2489)
19+
* [IMPROVEMENT] Adjust telemetry metrics sampling rates. See [#2490](https://github.com/DataDog/dd-sdk-android/pull/2490)
20+
* [MAINTENANCE] Bump develop version to 2.18.0 snapshot. See [#2465](https://github.com/DataDog/dd-sdk-android/pull/2465)
21+
* [MAINTENANCE] Update dependencies, adjusting detekt rules, fix tests. See [#2463](https://github.com/DataDog/dd-sdk-android/pull/2463)
22+
* [MAINTENANCE] Merge release/2.17.0 into develop. See [#2473](https://github.com/DataDog/dd-sdk-android/pull/2473)
23+
* [MAINTENANCE] Update AGP to version 8.7.3. See [#2484](https://github.com/DataDog/dd-sdk-android/pull/2484)
24+
* [MAINTENANCE] Include Java API surface file in the API changes check. See [#2493](https://github.com/DataDog/dd-sdk-android/pull/2493)
25+
* [MAINTENANCE] Update RUM Schema. See [#2492](https://github.com/DataDog/dd-sdk-android/pull/2492)
26+
* [MAINTENANCE] Pin github actions to exact commit hash. See [#2494](https://github.com/DataDog/dd-sdk-android/pull/2494)
27+
* [DOCS] Fix KDoc for `RumMonitor#stopSession`. See [#2480](https://github.com/DataDog/dd-sdk-android/pull/2480)
28+
129
# 2.17.0 / 2025-01-02
230

331
* [FEATURE] Implement the basic logic for `time-to-network-settle` view metric. See [#2397](https://github.com/DataDog/dd-sdk-android/pull/2392)

LICENSE-3rdparty.csv

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import,androidx.multidex,Apache-2.0,Copyright 2018 The Android Open Source Proje
3232
import,androidx.navigation,Apache-2.0,Copyright 2018 The Android Open Source Project
3333
import,androidx.print,Apache-2.0,Copyright 2018 The Android Open Source Project
3434
import,androidx.recyclerview,Apache-2.0,Copyright 2018 The Android Open Source Project
35+
import,androidx.resourceinspection,Apache-2.0,Copyright 2018 The Android Open Source Project
3536
import,androidx.room,Apache-2.0,Copyright 2018 The Android Open Source Project
3637
import,androidx.savedstate,Apache-2.0,Copyright 2018 The Android Open Source Project
3738
import,androidx.slidingpanelayout,Apache-2.0,Copyright 2018 The Android Open Source Project
@@ -158,4 +159,5 @@ build,org.ec4j.core,Apache-2.0,"Copyright (c) 2017 Angelo Zerr and other contrib
158159
build,org.freemarker,Apache-2.0,"Copyright 2015-2018 The Apache Software Foundation"
159160
build,org.jetbrains.dokka,Apache-2.0,"Copyright 2014-2019 JetBrains s.r.o. and Dokka project contributors."
160161
build,org.jetbrains.intellij.deps,LGPL-2.1-only,"Copyright (c) 2001-2002, Eric D. Friedman, Jason Baldridge, Copyright (c) 1999 CERN - European Organization for Nuclear Research"
162+
build,org.ow2.asm,BSD-3-Clause,"Copyright (c) 2000-2011 INRIA, France Telecom"
161163
build,org.slf4j,MIT,"Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland)"

buildSrc/src/main/kotlin/com/datadog/gradle/config/AndroidConfig.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object AndroidConfig {
2020
const val MIN_SDK_FOR_WEAR = 23
2121
const val BUILD_TOOLS_VERSION = "35.0.0"
2222

23-
val VERSION = Version(2, 17, 0, Version.Type.Release)
23+
val VERSION = Version(2, 18, 0, Version.Type.Release)
2424
}
2525

2626
// TODO RUM-628 Switch to Java 17 bytecode

buildSrc/src/main/kotlin/com/datadog/gradle/config/JavadocConfig.kt

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ package com.datadog.gradle.config
88

99
import org.gradle.api.Project
1010
import org.jetbrains.dokka.gradle.DokkaTask
11+
import java.nio.file.Paths
1112

1213
fun Project.javadocConfig() {
1314
tasks.withType(DokkaTask::class.java).configureEach {
14-
val toOutputDirectory = file("${buildDir.canonicalPath}/reports/javadoc")
15+
val toOutputDirectory = layout.buildDirectory
16+
.dir(Paths.get("reports", "javadoc").toString())
1517
outputDirectory.set(toOutputDirectory)
1618
doFirst {
17-
if (!toOutputDirectory.exists()) {
18-
toOutputDirectory.mkdirs()
19+
toOutputDirectory.get().asFile.let {
20+
if (!it.exists()) {
21+
it.mkdirs()
22+
}
1923
}
2024
}
2125
}

buildSrc/src/main/kotlin/com/datadog/gradle/plugin/apisurface/ApiSurfacePlugin.kt

+10-4
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,30 @@ import org.gradle.api.Plugin
1111
import org.gradle.api.Project
1212
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1313
import java.io.File
14+
import java.nio.file.Paths
1415

1516
class ApiSurfacePlugin : Plugin<Project> {
1617

1718
override fun apply(target: Project) {
1819
val srcDir = File(File(target.projectDir, "src"), "main")
19-
val genDir = File(File(target.buildDir, "generated"), "json2kotlin")
20+
val genDir = target.layout.buildDirectory
21+
.dir(Paths.get("generated", "json2kotlin").toString())
22+
.get()
23+
.asFile
2024
val apiDir = File(target.projectDir, "api")
21-
val surfaceFile = File(apiDir, FILE_NAME)
25+
val kotlinSurfaceFile = File(apiDir, FILE_NAME)
26+
val javaSurfaceFile = File(apiDir, "${target.name}.api")
2227

2328
target.tasks
2429
.register(TASK_GEN_KOTLIN_API_SURFACE, GenerateApiSurfaceTask::class.java) {
2530
this.srcDirPath = srcDir.absolutePath
2631
this.genDirPath = genDir.absolutePath
27-
this.surfaceFile = surfaceFile
32+
this.surfaceFile = kotlinSurfaceFile
2833
}
2934
target.tasks
3035
.register(TASK_CHECK_API_SURFACE, CheckApiSurfaceTask::class.java) {
31-
this.surfaceFile = surfaceFile
36+
this.kotlinSurfaceFile = kotlinSurfaceFile
37+
this.javaSurfaceFile = javaSurfaceFile
3238
dependsOn(TASK_GEN_KOTLIN_API_SURFACE)
3339
}
3440

buildSrc/src/main/kotlin/com/datadog/gradle/plugin/apisurface/CheckApiSurfaceTask.kt

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ package com.datadog.gradle.plugin.apisurface
99
import com.datadog.gradle.utils.execShell
1010
import org.gradle.api.DefaultTask
1111
import org.gradle.api.tasks.InputFile
12+
import org.gradle.api.tasks.InputFiles
1213
import org.gradle.api.tasks.TaskAction
1314
import java.io.File
1415

1516
open class CheckApiSurfaceTask : DefaultTask() {
1617

1718
@InputFile
18-
lateinit var surfaceFile: File
19+
lateinit var kotlinSurfaceFile: File
20+
21+
@InputFiles
22+
lateinit var javaSurfaceFile: File
1923

2024
init {
2125
group = "datadog"
@@ -26,6 +30,13 @@ open class CheckApiSurfaceTask : DefaultTask() {
2630

2731
@TaskAction
2832
fun applyTask() {
33+
verifySurfaceFile(kotlinSurfaceFile)
34+
if (javaSurfaceFile.exists()) {
35+
verifySurfaceFile(javaSurfaceFile)
36+
}
37+
}
38+
39+
private fun verifySurfaceFile(surfaceFile: File) {
2940
val lines = project.execShell(
3041
"git",
3142
"diff",
@@ -50,7 +61,7 @@ open class CheckApiSurfaceTask : DefaultTask() {
5061
}
5162

5263
@InputFile
53-
fun getInputFile() = surfaceFile
64+
fun getInputFile() = kotlinSurfaceFile
5465

5566
// endregion
5667
}

buildSrc/src/main/kotlin/com/datadog/gradle/plugin/jsonschema/GenerateJsonSchemaTask.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import org.gradle.api.tasks.PathSensitive
1717
import org.gradle.api.tasks.PathSensitivity
1818
import org.gradle.api.tasks.TaskAction
1919
import java.io.File
20+
import java.nio.file.Paths
2021

2122
// TODO test all from https://github.com/json-schema-org/JSON-Schema-Test-Suite/tree/master/tests/draft2019-09
2223

@@ -123,8 +124,10 @@ open class GenerateJsonSchemaTask : DefaultTask() {
123124
}
124125

125126
private fun getOutputDir(): File {
126-
val genDir = File(project.buildDir, "generated")
127-
val json2kotlinDir = File(genDir, "json2kotlin")
127+
val json2kotlinDir = project.layout.buildDirectory
128+
.dir(Paths.get("generated", "json2kotlin").toString())
129+
.get()
130+
.asFile
128131
val mainDir = File(json2kotlinDir, "main")
129132
val file = File(mainDir, "kotlin")
130133
if (!file.exists()) file.mkdirs()

dd-sdk-android-core/api/apiSurface

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ enum com.datadog.android.api.context.DeviceType
6565
- TABLET
6666
- TV
6767
- DESKTOP
68+
- GAMING_CONSOLE
69+
- BOT
6870
- OTHER
6971
data class com.datadog.android.api.context.NetworkInfo
7072
constructor(Connectivity = Connectivity.NETWORK_NOT_CONNECTED, kotlin.String? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.Long? = null, kotlin.String? = null)

dd-sdk-android-core/api/dd-sdk-android-core.api

+2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ public final class com/datadog/android/api/context/DeviceInfo {
195195
}
196196

197197
public final class com/datadog/android/api/context/DeviceType : java/lang/Enum {
198+
public static final field BOT Lcom/datadog/android/api/context/DeviceType;
198199
public static final field DESKTOP Lcom/datadog/android/api/context/DeviceType;
200+
public static final field GAMING_CONSOLE Lcom/datadog/android/api/context/DeviceType;
199201
public static final field MOBILE Lcom/datadog/android/api/context/DeviceType;
200202
public static final field OTHER Lcom/datadog/android/api/context/DeviceType;
201203
public static final field TABLET Lcom/datadog/android/api/context/DeviceType;

dd-sdk-android-core/src/main/kotlin/com/datadog/android/api/context/DeviceType.kt

+2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ enum class DeviceType {
1414
TABLET,
1515
TV,
1616
DESKTOP,
17+
GAMING_CONSOLE,
18+
BOT,
1719
OTHER
1820
}

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/DatadogContextProvider.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ internal class DatadogContextProvider(val coreFeature: CoreFeature) : ContextPro
7676
}
7777

7878
override fun getFeatureContext(feature: String): Map<String, Any?> {
79-
return coreFeature.featuresContext[feature]?.toMap() ?: emptyMap()
79+
return coreFeature.featuresContext[feature] ?: emptyMap()
8080
}
8181
}

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/DatadogCore.kt

+9-7
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,19 @@ internal class DatadogCore(
193193
updateCallback: (context: MutableMap<String, Any?>) -> Unit
194194
) {
195195
val feature = features[featureName] ?: return
196-
contextProvider?.let {
196+
contextProvider?.let { currentContext ->
197197
synchronized(feature) {
198-
val featureContext = it.getFeatureContext(featureName)
199-
val mutableContext = featureContext.toMutableMap()
198+
// Use HashMap instead of .toMutableMap() for faster init
199+
@Suppress("UnsafeThirdPartyFunctionCall") // NPE cannot happen here
200+
val mutableContext = HashMap(currentContext.getFeatureContext(featureName))
200201
updateCallback(mutableContext)
201-
it.setFeatureContext(featureName, mutableContext)
202+
currentContext.setFeatureContext(featureName, mutableContext)
202203
// notify all the other features
203-
features.filter { it.key != featureName }
204-
.forEach { (_, feature) ->
205-
feature.notifyContextUpdated(featureName, mutableContext.toMap())
204+
features.forEach { (key, feature) ->
205+
if (key != featureName) {
206+
feature.notifyContextUpdated(featureName, mutableContext)
206207
}
208+
}
207209
}
208210
}
209211
}

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/metrics/BatchMetricsDispatcher.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import com.datadog.android.core.internal.persistence.file.advanced.FeatureFileOr
1515
import com.datadog.android.core.internal.persistence.file.existsSafe
1616
import com.datadog.android.core.internal.persistence.file.lengthSafe
1717
import com.datadog.android.core.internal.time.TimeProvider
18-
import com.datadog.android.core.metrics.MethodCallSamplingRate
1918
import com.datadog.android.privacy.TrackingConsent
2019
import java.io.File
2120
import java.util.Locale
@@ -43,7 +42,7 @@ internal class BatchMetricsDispatcher(
4342
internalLogger.logMetric(
4443
messageBuilder = { BATCH_DELETED_MESSAGE },
4544
additionalProperties = it,
46-
samplingRate = MethodCallSamplingRate.LOW.rate
45+
samplingRate = 1.5f
4746
)
4847
}
4948
}
@@ -56,7 +55,7 @@ internal class BatchMetricsDispatcher(
5655
internalLogger.logMetric(
5756
messageBuilder = { BATCH_CLOSED_MESSAGE },
5857
additionalProperties = it,
59-
samplingRate = MethodCallSamplingRate.LOW.rate
58+
samplingRate = 1.5f
6059
)
6160
}
6261
}

0 commit comments

Comments
 (0)