Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Otel feature branch #2077

Merged
merged 88 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
49c223c
RUM-3246 Extract the dd-trace-core module from the java agent
mariusc83 Feb 19, 2024
31c4fee
Fix Lint issues
mariusc83 Feb 21, 2024
ee358a0
Rename datadog.trace to com.datadog.trace package in dd-trace-core
mariusc83 Feb 29, 2024
eddf6d8
Switch to com.legacy.trace package into the dd-sdk-android-trace module
mariusc83 Feb 29, 2024
4b35b3c
RUM-3247 Port the Otel Java implementation and provide OtelTracerProv…
mariusc83 Mar 1, 2024
169dfbb
Remove spotbugs depdendency
mariusc83 Mar 4, 2024
fd1ee87
Switch from slf4j logger to our internal implementation
mariusc83 Mar 4, 2024
195783b
Update ProGuard configuration
0xnm Mar 5, 2024
87e17bd
RUM-3394 Provide the OtelDataWriter to be used in the OtelTracer
mariusc83 Mar 5, 2024
f18d527
RUM-3415 Sample app - add AsyncTask Otel trace use case
mariusc83 Mar 6, 2024
e4674c8
RUM-3294 Bundle dd-trace-core into dd-sdk-android-trace
mariusc83 Mar 11, 2024
5506818
Merge pull request #1907 from DataDog/mconstantin/rum-3294/bundle-dd-…
mariusc83 Mar 13, 2024
dcd9317
RUM-3516 Provide the correct sampling priority for our Span events ba…
mariusc83 Mar 13, 2024
50e49ba
Merge pull request #1913 from DataDog/mconstantin/rum-3516/correctly-…
mariusc83 Mar 21, 2024
d889a92
RUM-3268 Provide the Java CoreTracer unit tests
mariusc83 Mar 18, 2024
bac5936
Fix unit tests on CI
mariusc83 Mar 25, 2024
c224901
Merge pull request #1924 from DataDog/mconstantin/rum-3268/port-all-c…
mariusc83 Mar 27, 2024
86b40e3
Merge branch 'develop' into mconstantin/merge-develop-brance-into-otel
mariusc83 Mar 27, 2024
364a08b
Appying Ktlint format changes
mariusc83 Mar 27, 2024
3cfe958
Merge pull request #1948 from DataDog/mconstantin/merge-develop-branc…
mariusc83 Mar 28, 2024
694c121
Introduce the DatadogCoreTracerLogger
mariusc83 Mar 29, 2024
41370c3
Delegate all the logs to new DatadogCoreTracerLogger in the CoreTracer
mariusc83 Mar 29, 2024
0e43b0d
Merge pull request #1953 from DataDog/mconstantin/rum-3405/provide-co…
mariusc83 Apr 3, 2024
141ad20
RUM-3249 Provide the bundleWithRum capability for OtelTracer
mariusc83 Apr 2, 2024
3e814ca
Merge pull request #1960 from DataDog/mconstantin/rum-3249/provide-bu…
mariusc83 Apr 8, 2024
2240ae8
RUM-3836 Provide the DatadogContextStorage for Opentelemetry
mariusc83 Apr 4, 2024
70acea8
Add the bundled Otel contexts use case in Sample app
mariusc83 Apr 5, 2024
4633820
Merge pull request #1970 from DataDog/mconstantin/rum-3836/provide-ot…
mariusc83 Apr 9, 2024
9dae312
RUM-3250 Provide Otel bundle with logs feature
mariusc83 Apr 9, 2024
399b663
Merge pull request #1979 from DataDog/mconstantin/rum-3250/provide-ot…
mariusc83 Apr 10, 2024
60e8c78
Split trace end to end test by API
mariusc83 Apr 10, 2024
f2f8837
RUM-4030 Setup the trace end tests environment for Otel API
mariusc83 Apr 11, 2024
37e2e35
Merge pull request #1983 from DataDog/mconstantin/setup-end-to-end-te…
mariusc83 Apr 15, 2024
1582ada
Merge branch 'develop' into nogorodnikov/merge-develop-into-otel-supp…
0xnm Apr 17, 2024
f28a8cf
RUM-4116 Add the SpanLink support for Otel API implementation
mariusc83 Apr 17, 2024
c88c271
Merge pull request #1993 from DataDog/mconstantin/rum-4116/add-spanli…
mariusc83 Apr 18, 2024
94c4b4d
Add the Otel API feature integration tests
mariusc83 Apr 17, 2024
0a423fe
Add Otel SpanLink use case into the sample app
mariusc83 Apr 17, 2024
3bd8514
Merge pull request #1995 from DataDog/mconstantin/rum-3389/add-trace-…
mariusc83 Apr 19, 2024
4dc4063
Remove some unused IAST/CI Visibility classes
0xnm Apr 18, 2024
9a7e978
Merge pull request #2000 from DataDog/nogorodnikov/otel-remove-unused…
0xnm Apr 19, 2024
478ba84
RUM-4134 Remove moshi dependency from trace module
mariusc83 Apr 19, 2024
4397e6d
Merge pull request #2003 from DataDog/mconstantin/rum-4134/remove-mos…
mariusc83 Apr 23, 2024
f50ccd4
RUM-4055 Report Opentelemetry data in the configuration Telemetry
mariusc83 Apr 23, 2024
a0e5b5f
Send the Otel API version through Trace feature context
mariusc83 Apr 24, 2024
ee9af33
Merge pull request #2006 from DataDog/mconstantin/rum-4055/add-otel-c…
mariusc83 Apr 29, 2024
8112181
RUM-4371 Extract OpenTelemetr into the dd-sdk-android-trace-otel module
mariusc83 May 3, 2024
b49d5b0
Suppress NewApi rule for Java core trace package
mariusc83 May 3, 2024
7557adb
Merge pull request #2021 from DataDog/mconstantin/rum-4125/disable-co…
mariusc83 May 21, 2024
cd6e3f3
RUM-4372 Setup the CI and gradle tests for the new dd-sdk-android-tra…
mariusc83 May 16, 2024
3b58e41
Merge pull request #2035 from DataDog/mconstantin/rum-4372/setup-ci-f…
mariusc83 May 21, 2024
5712350
RUM-4501 Enable desugaring for sample and single-fit apps
mariusc83 May 16, 2024
6ea893f
Merge pull request #2036 from DataDog/mconstantin/rum-4501/enable-des…
mariusc83 May 21, 2024
497e58f
Merge branch 'feature/otel-support' into nogorodnikov/merge-develop-i…
0xnm May 21, 2024
8162d06
Merge branch 'develop' into nogorodnikov/merge-develop-into-otel-supp…
0xnm May 21, 2024
4f942d6
Fix some detekt issues
mariusc83 May 21, 2024
ad06c50
Merge pull request #2043 from DataDog/mconstantin/fix-detekt-issues
mariusc83 May 21, 2024
8c0daac
Merge pull request #1998 from DataDog/nogorodnikov/merge-develop-into…
0xnm May 21, 2024
f83811b
Add trace injector and propagators back inside the CoreTracer
mariusc83 May 22, 2024
bc8a1f8
Replace java.util with android.util Base64 functionality
mariusc83 May 22, 2024
26123ef
Remove the API 26 ThreadLocal call
mariusc83 May 22, 2024
3e81f87
Remove java.util.Map incompatible APIs
mariusc83 May 22, 2024
292ee30
Remove java.util.Stream package usage
mariusc83 May 22, 2024
da0a254
Final cleanup and enable back the `NewApi` lint rule
mariusc83 May 22, 2024
c81732c
Merge pull request #2051 from DataDog/mconstantin/rum-4260/make-core-…
mariusc83 May 27, 2024
7ca025e
Merge branch 'develop' into nogorodnikov/merge-develop-into-otel
0xnm May 29, 2024
1dd0f18
Merge pull request #2058 from DataDog/nogorodnikov/merge-develop-into…
0xnm May 29, 2024
868fd0a
Remove the dd-sketches dependency and related logic
mariusc83 May 29, 2024
39c7c04
Merge pull request #2062 from DataDog/mconstantin/remove-ddsketches-d…
mariusc83 May 29, 2024
a33e37c
Fix the jctools proguard rules
mariusc83 May 29, 2024
bf0475c
Merge pull request #2063 from DataDog/mconstantin/fix-jctools-proguar…
mariusc83 May 30, 2024
6ef07c9
RUM-4507 Add OpenTelemetry use case into the Wear sample app
mariusc83 May 30, 2024
5e72fef
Merge pull request #2068 from DataDog/mconstantin/rum-4507/add-otel-m…
mariusc83 May 30, 2024
5951ec7
RUM-4508 Add OpenTelemetry use case into the vendor-lib sample
mariusc83 May 31, 2024
ee23810
Merge pull request #2069 from DataDog/mconstantin/rum-4508/add-otel-m…
mariusc83 May 31, 2024
90e7b17
RUM-3438 Introduce the dd-sdk-android-okhttp-otel module
mariusc83 Jun 5, 2024
6873d3f
Provide the `addParentSpan` extension for the OkHttp Request.Builder
mariusc83 Jun 5, 2024
78a4d1b
Add the Otel parent span for OkHttp request use case in sample app
mariusc83 Jun 5, 2024
d096d57
Update integrations/dd-sdk-android-okhttp-otel/README.md
mariusc83 Jun 6, 2024
b0c0c48
Update integrations/dd-sdk-android-okhttp-otel/README.md
mariusc83 Jun 6, 2024
dc9c63f
Update integrations/dd-sdk-android-okhttp/src/main/kotlin/com/datadog…
mariusc83 Jun 6, 2024
eb5ffe8
Apply review changes
mariusc83 Jun 6, 2024
8805d24
Merge pull request #2073 from DataDog/mconstantin/rum-3438/support-pa…
mariusc83 Jun 7, 2024
3912a85
Merge branch 'develop' into mconstantin/merge-develop-in-otel
mariusc83 Jun 11, 2024
af015aa
Merge pull request #2076 from DataDog/mconstantin/merge-develop-in-otel
mariusc83 Jun 11, 2024
656c92d
Remove OkHttp dependency from trace module
mariusc83 Jun 12, 2024
0405275
Cleanup trace module build.gradle file
mariusc83 Jun 12, 2024
3d1a62e
Cleanup the gitlab-ci.yml
mariusc83 Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 32 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,22 @@ publish:release-okhttp:
- export OSSRH_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_password --with-decryption --query "Parameter.Value" --out text)
- ./gradlew :integrations:dd-sdk-android-okhttp:publishToSonatype --stacktrace --no-daemon

publish:release-okhttp-otel:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.gpg_private_key --with-decryption --query "Parameter.Value" --out text)
- export GPG_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
- export OSSRH_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_username --with-decryption --query "Parameter.Value" --out text)
- export OSSRH_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_password --with-decryption --query "Parameter.Value" --out text)
- ./gradlew :integrations:dd-sdk-android-okhttp-otel:publishToSonatype --stacktrace --no-daemon

publish:release-trace:
tags: [ "arch:amd64" ]
only:
Expand All @@ -548,6 +564,22 @@ publish:release-trace:
- export OSSRH_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_password --with-decryption --query "Parameter.Value" --out text)
- ./gradlew :features:dd-sdk-android-trace:publishToSonatype --stacktrace --no-daemon

publish:release-trace-otel:
tags: [ "arch:amd64" ]
only:
- tags
- develop
image: $CI_IMAGE_DOCKER
stage: publish
timeout: 30m
script:
- aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.gradle-properties --with-decryption --query "Parameter.Value" --out text >> ./gradle.properties
- export GPG_PRIVATE_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.gpg_private_key --with-decryption --query "Parameter.Value" --out text)
- export GPG_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.gpg_passphrase --with-decryption --query "Parameter.Value" --out text)
- export OSSRH_USERNAME=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_username --with-decryption --query "Parameter.Value" --out text)
- export OSSRH_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name ci.dd-sdk-android.signing.ossrh_password --with-decryption --query "Parameter.Value" --out text)
- ./gradlew :features:dd-sdk-android-trace-otel:publishToSonatype --stacktrace --no-daemon

publish:release-webview:
tags: [ "arch:amd64" ]
only:
Expand Down
6 changes: 6 additions & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ import,androidx.vectordrawable,Apache-2.0,Copyright 2018 The Android Open Source
import,androidx.versionedparcelable,Apache-2.0,Copyright 2018 The Android Open Source Project
import,androidx.viewpager,Apache-2.0,Copyright 2018 The Android Open Source Project
import,androidx.work,Apache-2.0,Copyright 2018 The Android Open Source Project
import,com.android.tools,Apache-2.0,Copyright 2018 The Android Open Source Project
import,com.github.bumptech.glide,"Simplified BSD License/The Apache Software License, Version 2.0","Copyright 2014 Google, Inc. All rights reserved, Copyright (c) 2013. Bump Technologies Inc. All Rights Reserved."
import,com.facebook.fresco,MIT,"Copyright (c) Facebook, Inc. and its affiliates"
import,com.github.spotbugs,"GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1","Copyright (C) 1991, 1999 Free Software Foundation, Inc."
import,com.google.android.material,Apache-2.0,Copyright 2018 The Android Open Source Project
import,com.google.code.gson,Apache-2.0,Copyright 2008 Google Inc
import,com.google.guava,Apache-2.0,Copyright 2009 The Guava Authors
Expand All @@ -56,6 +58,7 @@ import,com.squareup.sqldelight,Apache-2.0,"Copyright 2016 Square, Inc"
import,com.fasterxml.jackson,Apache-2.0,"Copyright 2020 Datadog, Inc."
import,com.datadoghq,Apache-2.0,"Copyright 2017 Datadog, Inc"
import,io.coil-kt,Apache-2.0,Copyright 2021 Coil Contributors
import,io.opentelemetry,Apache-2.0,Copyright 2019 The OpenTelemetry Authors
import,io.opentracing,Apache-2.0,Copyright 2016-2017 The OpenTracing Authors
import,io.opentracing.contrib,Apache-2.0,Copyright 2016-2017 The OpenTracing Authors
import,io.reactivex.rxjava3,Apache-2.0,"Copyright (c) 2016-present, RxJava Contributors"
Expand Down Expand Up @@ -90,6 +93,7 @@ import(test),com.github.xgouchet.Elmyr,MIT,Copyright 2017-2019 Xavier F. Gouchet
import(test),com.google.android.apps.common.testing.accessibility.framework,Apache-2.0,Copyright 2018 The Android Open Source Project
import(test),com.google.code.findbugs,Apache-2.0,"Copyright (C) 2006, University of Maryland"
import(test),com.parse.bolts,"BSD License","Copyright (c) Facebook, Inc. and its affiliates."
import(test),com.google.re2j,"Go License","Copyright (c) 2009 The Go Authors. All rights reserved."
import(test),greatest,ICT,"Copyright (c) 2011-2018 Scott Vokes <[email protected]>"
import(test),javax.inject,Apache-2.0,Copyright (C) 2009 The JSR-330 Expert Group
import(test),junit,EPL-1.0,Copyright © 2002-2019 JUnit
Expand All @@ -101,6 +105,7 @@ import(test),org.assertj,Apache-2.0,Copyright 2012-2019 the original author or a
import(test),org.ccil.cowan.tagsoup,Apache-2.0,Copyright 2002-2008 by John Cowan
import(test),org.hamcrest,BSD-3-Clause,Copyright (c) 2000-2015 www.hamcrest.org
import(test),org.jacoco,EPL-2.0,"Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors"
import(test),org.jctools,"Apache-2.0","Copyright 2023 Datadog, Inc."
import(test),org.junit,EPL-2.0,Copyright 2015-2019 the original author or authors
import(test),org.junit.jupiter,EPL-2.0,Copyright 2015-2019 the original author or authors
import(test),org.junit.platform,EPL-2.0,Copyright 2015-2019 the original author or authors
Expand All @@ -111,6 +116,7 @@ import(test),org.objenesis,Apache-2.0,"Copyright (c) 2003-2013, Objenesis Team a
import(test),org.opentest4j,Apache-2.0,Copyright 2015-2018 the original author or authors
import(test),org.robolectric,Apache-2.0,Copyright 2015-2018 the original author or authors
import(test),org.sonatype.oss,Apache-2.0,"Copyright (c) 2008-present Sonatype, Inc."
import(test),uk.org.webcompere,MIT,Copyright (c) 2020 Ashley Frieze (c) 2017 Stefan Birkner
build,androidx.compose.compiler,Apache-2.0,Copyright 2019 The Android Open Source Project
build,ch.qos.logback,EPL-1.0,"Copyright (C) 1999-2015, QOS.ch"
build,com.android.tools.build,Apache-2.0,Copyright (C) 2013 The Android Open Source Project
Expand Down
14 changes: 11 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,19 @@ registerSubModuleAggregationTask("assembleLibrariesDebug", "assembleDebug")
registerSubModuleAggregationTask("assembleLibrariesRelease", "assembleRelease")

registerSubModuleAggregationTask("unitTestRelease", "testReleaseUnitTest")
registerSubModuleAggregationTask("unitTestReleaseFeatures", "testReleaseUnitTest", ":features:")
registerSubModuleAggregationTask(
"unitTestReleaseFeatures",
"testReleaseUnitTest",
":features:"
)
registerSubModuleAggregationTask("unitTestReleaseIntegrations", "testReleaseUnitTest", ":integrations:")

registerSubModuleAggregationTask("unitTestDebug", "testDebugUnitTest")
registerSubModuleAggregationTask("unitTestDebugFeatures", "testDebugUnitTest", ":features:")
registerSubModuleAggregationTask(
"unitTestDebugFeatures",
"testDebugUnitTest",
":features:"
)
registerSubModuleAggregationTask("unitTestDebugIntegrations", "testDebugUnitTest", ":integrations:")

tasks.register("assembleSampleRelease") {
Expand Down Expand Up @@ -141,7 +149,7 @@ tasks.register("buildNdkIntegrationTestsArtifacts") {
dependsOn(":instrumented:integration:assembleDebug")
}

nightlyTestsCoverageConfig(threshold = 0.85f)
nightlyTestsCoverageConfig(threshold = 0.81f)

tasks.register("printSdkDebugRuntimeClasspath") {
val fileTreeClassPathCollector = UnionFileTree(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ fun Project.registerSubModuleAggregationTask(
subModuleTaskName: String,
subModulePathPrefix: String = ":",
subModuleNamePrefix: String = "dd-sdk-android-",
exceptions: Set<String> = emptySet(),
additionalConfiguration: Task.() -> Unit = {}
) {
tasks.register(taskName) {
project.subprojects.forEach { subProject ->
println("SubProject ${subProject.name} / ${subProject.path}")
if (subProject.name.startsWith(subModuleNamePrefix) &&
if (!exceptions.contains(subProject.name) &&
subProject.name.startsWith(subModuleNamePrefix) &&
subProject.path.startsWith(subModulePathPrefix)
) {
dependsOn("${subProject.path}:$subModuleTaskName")
Expand Down
20 changes: 19 additions & 1 deletion detekt_custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ datadog:
- "java.lang.System.arraycopy(kotlin.Any, kotlin.Int, kotlin.Any, kotlin.Int, kotlin.Int):java.lang.IndexOutOfBoundsException,java.lang.ArrayStoreException,java.lang.NullPointerException"
- "java.lang.System.loadLibrary(kotlin.String?):java.lang.SecurityException,java.lang.UnsatisfiedLinkError,java.lang.NullPointerException"
- "java.lang.reflect.Field.get(kotlin.Any):java.lang.IllegalAccessException,java.lang.IllegalArgumentException,java.lang.NullPointerException,java.lang.ExceptionInInitializerError"
- "java.math.BigInteger.constructor(kotlin.String?, kotlin.Int):java.lang.NumberFormatException,java.lang.ArithmeticException"
- "java.net.URL.constructor(kotlin.String?):java.net.MalformedURLException"
- "java.security.MessageDigest.getInstance(kotlin.String?):java.security.NoSuchAlgorithmException"
- "java.text.SimpleDateFormat.constructor(kotlin.String, java.util.Locale):java.lang.NullPointerException"
Expand All @@ -258,7 +259,6 @@ datadog:
- "kotlin.String.takeLast(kotlin.Int):kotlin.IllegalArgumentException"
- "kotlin.String.toLong():java.lang.NumberFormatException"
- "kotlin.String.format(kotlin.Array):java.util.IllegalFormatException"
- "kotlin.String.takeLast(kotlin.Int):java.lang.IllegalArgumentException"
- "kotlin.ByteArray.copyOf(kotlin.Int):java.lang.NegativeArraySizeException"
- "kotlin.ByteArray.copyOfRange(kotlin.Int, kotlin.Int):java.lang.IndexOutOfBoundsException,java.lang.IllegalArgumentException"
- "kotlin.ByteArray.get(kotlin.Int):java.lang.IndexOutOfBoundsException"
Expand Down Expand Up @@ -296,6 +296,7 @@ datadog:
- "okhttp3.Request.Builder.post(okhttp3.RequestBody):java.lang.NullPointerException,java.lang.IllegalArgumentException"
- "okhttp3.Request.Builder.method(kotlin.String, okhttp3.RequestBody?):java.lang.NullPointerException,java.lang.IllegalArgumentException"
- "okhttp3.Request.Builder.tag(java.lang.Class, io.opentracing.Span?):java.lang.NullPointerException"
- "okhttp3.Request.Builder.tag(java.lang.Class, com.datadog.android.okhttp.TraceContext?):java.lang.ClassCastException"
- "okhttp3.Request.Builder.url(kotlin.String):java.lang.NullPointerException,java.lang.IllegalArgumentException"
- "okhttp3.Interceptor.Chain.proceed(okhttp3.Request):java.io.IOException"
- "okhttp3.RequestBody.writeTo(okio.BufferedSink):java.io.IOException"
Expand Down Expand Up @@ -894,6 +895,7 @@ datadog:
- "kotlin.collections.MutableList.isNullOrEmpty()"
- "kotlin.collections.MutableList.iterator()"
- "kotlin.collections.MutableList.joinToString(kotlin.CharSequence, kotlin.CharSequence, kotlin.CharSequence, kotlin.Int, kotlin.CharSequence, kotlin.Function1?)"
- "kotlin.collections.MutableList.map(kotlin.Function1)"
- "kotlin.collections.MutableList.remove(java.io.File)"
- "kotlin.collections.MutableList.remove(java.lang.ref.WeakReference)"
- "kotlin.collections.MutableList.removeAll(kotlin.Function1)"
Expand Down Expand Up @@ -1043,6 +1045,7 @@ datadog:
- "kotlin.math.max(kotlin.Long, kotlin.Long)"
- "kotlin.math.min(kotlin.Double, kotlin.Double)"
- "kotlin.math.sqrt(kotlin.Double)"
- "kotlin.String.trim(kotlin.Function1)"
# endregion
# region Kotlin Tuples
- "kotlin.Pair.constructor(com.datadog.android.sessionreplay.internal.utils.SessionReplayRumContext, com.google.gson.JsonArray)"
Expand Down Expand Up @@ -1093,6 +1096,7 @@ datadog:
- "kotlin.String.substringAfter(kotlin.Char, kotlin.String)"
- "kotlin.String.substringAfterLast(kotlin.Char, kotlin.String)"
- "kotlin.String.substringBefore(kotlin.Char, kotlin.String)"
- "kotlin.String.takeLeastSignificant64Bits()"
- "kotlin.String.toByteArray(java.nio.charset.Charset) "
- "kotlin.String.toByteArray(java.nio.charset.Charset)"
- "kotlin.String.toDoubleOrNull()"
Expand Down Expand Up @@ -1226,6 +1230,20 @@ datadog:
- "io.opentracing.util.GlobalTracer.get()"
- "io.opentracing.util.GlobalTracer.isRegistered()"
# endregion
# region Opentelemetry
- "io.opentelemetry.api.trace.Span.getInvalid()"
- "io.opentelemetry.api.trace.TracerBuilder.build()"
- "io.opentelemetry.api.trace.SpanBuilder.setAttribute(kotlin.String?, kotlin.String?)"
- "io.opentelemetry.api.trace.TracerBuilder.setInstrumentationVersion(kotlin.String?)"
- "io.opentelemetry.api.trace.TracerProvider.noop()"
- "io.opentelemetry.context.Context.get(io.opentelemetry.context.ContextKey?)"
- "io.opentelemetry.context.Context.makeCurrent()"
- "io.opentelemetry.context.Context.root()"
- "io.opentelemetry.context.ContextStorage.addWrapper(java.util.function.Function?)"
- "io.opentelemetry.context.ContextStorage.attach(io.opentelemetry.context.Context?)"
- "io.opentelemetry.context.ContextStorage.current()"
- "io.opentelemetry.context.Scope.close()"
# endregion
# region RxJava
- "io.reactivex.rxjava3.core.Completable.doOnError(io.reactivex.rxjava3.functions.Consumer?)"
- "io.reactivex.rxjava3.core.Flowable.doOnError(io.reactivex.rxjava3.functions.Consumer?)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ internal class TelemetryEventHandler(
}

val rumContext = datadogContext.rumContext()

val traceContext = sdkCore.getFeatureContext(Feature.TRACING_FEATURE_NAME)
val tracerApi = resolveTracerApi(traceContext)
val openTelemetryApiVersion = resolveOpenTelemetryApiVersion(tracerApi, traceContext)
val useTracing = (traceFeature != null && tracerApi != null)
return TelemetryConfigurationEvent(
dd = TelemetryConfigurationEvent.Dd(),
date = timestamp,
Expand Down Expand Up @@ -300,7 +303,9 @@ internal class TelemetryEventHandler(
batchSize = coreConfiguration.batchSize,
batchUploadFrequency = coreConfiguration.batchUploadFrequency,
mobileVitalsUpdatePeriod = rumConfig?.vitalsMonitorUpdateFrequency?.periodInMs,
useTracing = traceFeature != null && isGlobalTracerRegistered(),
useTracing = useTracing,
tracerApi = tracerApi?.name,
tracerApiVersion = openTelemetryApiVersion,
trackNetworkRequests = trackNetworkRequests,
sessionReplaySampleRate = sessionReplaySampleRate,
defaultPrivacyLevel = sessionReplayPrivacy,
Expand Down Expand Up @@ -339,13 +344,38 @@ internal class TelemetryEventHandler(
}
}

private fun isOpenTelemetryRegistered(traceContext: Map<String, Any?>): Boolean {
return traceContext[IS_OPENTELEMETRY_ENABLED_CONTEXT_KEY] as? Boolean ?: false
}

private fun resolveTracerApi(traceContext: Map<String, Any?>): TracerApi? {
return when {
isOpenTelemetryRegistered(traceContext) -> TracerApi.OpenTelemetry
isGlobalTracerRegistered() -> TracerApi.OpenTracing
else -> null
}
}

private fun resolveOpenTelemetryApiVersion(tracerApi: TracerApi?, traceContext: Map<String, Any?>): String? {
return if (tracerApi == TracerApi.OpenTelemetry) {
traceContext[OPENTELEMETRY_API_VERSION_CONTEXT_KEY] as? String
} else {
null
}
}

private fun DatadogContext.rumContext(): RumContext {
val rumContext = featuresContext[Feature.RUM_FEATURE_NAME].orEmpty()
return RumContext.fromFeatureContext(rumContext)
}

// endregion

internal enum class TracerApi {
OpenTelemetry,
OpenTracing
}

companion object {
const val MAX_EVENTS_PER_SESSION = 100
const val DEFAULT_CONFIGURATION_SAMPLE_RATE = 20f
Expand All @@ -354,6 +384,8 @@ internal class TelemetryEventHandler(
const val MAX_EVENT_NUMBER_REACHED_MESSAGE =
"Max number of telemetry events per session reached, rejecting."
const val TELEMETRY_SERVICE_NAME = "dd-sdk-android"
internal const val IS_OPENTELEMETRY_ENABLED_CONTEXT_KEY = "is_opentelemetry_enabled"
internal const val OPENTELEMETRY_API_VERSION_CONTEXT_KEY = "opentelemetry_api_version"
internal const val SESSION_REPLAY_SAMPLE_RATE_KEY = "session_replay_sample_rate"
internal const val SESSION_REPLAY_PRIVACY_KEY = "session_replay_privacy"
internal const val SESSION_REPLAY_MANUAL_RECORDING_KEY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,26 @@ internal class TelemetryConfigurationEventAssert(actual: TelemetryConfigurationE
return this
}

fun hasTracerApi(tracerApi: String?): TelemetryConfigurationEventAssert {
assertThat(actual.telemetry.configuration.tracerApi)
.overridingErrorMessage(
"Expected event data to have telemetry.configuration.tracerApi $tracerApi " +
"but was ${actual.telemetry.configuration.tracerApi}"
)
.isEqualTo(tracerApi)
return this
}

fun hasTracerApiVersion(tracerApiVersion: String?): TelemetryConfigurationEventAssert {
assertThat(actual.telemetry.configuration.tracerApiVersion)
.overridingErrorMessage(
"Expected event data to have telemetry.configuration.tracerApiVersion $tracerApiVersion " +
"but was ${actual.telemetry.configuration.tracerApiVersion}"
)
.isEqualTo(tracerApiVersion)
return this
}

fun hasBatchSize(expected: Long?): TelemetryConfigurationEventAssert {
assertThat(actual.telemetry.configuration.batchSize)
.overridingErrorMessage(
Expand Down
Loading