Skip to content

RUM-15278: Add Datadog Test Observability for tests run on MacOS runners#3295

Merged
aleksandr-gringauz merged 2 commits into
developfrom
aleksandr-gringauz/RUM-15278/macos-runners-test-observability
Apr 1, 2026
Merged

RUM-15278: Add Datadog Test Observability for tests run on MacOS runners#3295
aleksandr-gringauz merged 2 commits into
developfrom
aleksandr-gringauz/RUM-15278/macos-runners-test-observability

Conversation

@aleksandr-gringauz

@aleksandr-gringauz aleksandr-gringauz commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Making the results of the tests that are run on MacOS AMI runners available in Datadog CI Visibility.

How it works

We are using 2 things here:

  1. Manual upload of test results in JUnit format using datadog-ci tool.
  2. We add Java tracer to the invocation of Gradle.

How results look like

For example here are the results for test-pyramid:legacy-integration-instrumented-latest-api job in this PR. You can see 3 entries there:

  1. The one for datadog-ci upload with test results.
  2. 2 entries for gradle tasks execution (:buildSrc is separate). They might be useful to look at the duration of gradle tasks.

Here is a list of test results for test-pyramid:legacy-integration-instrumented-latest-api.

Why do we need datadog-ci

Another option is using Java Agent like described here. But it doesn't work for Android tests, because the tracer isn't able to instrument the tests run on Android emulator using AndroidJnitRunner.

@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-15278/macos-runners-test-observability branch 5 times, most recently from 9a9332e to 2ec1d52 Compare March 25, 2026 15:51
Comment thread ci/pipelines/default-pipeline.yml Outdated
- $ANDROID_HOME/platform-tools/adb emu kill
- if [[ "$exit_code" -ne 0 ]]; then exit 1; fi
- exit 0
upload-junit-results:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we cannot use Datadog Agent for instrumented runs? The runner there is still JUnit-compatible and produces results in the JUnit format. Does it mean that Datadog Agent fails to instrumented test run?

@aleksandr-gringauz aleksandr-gringauz Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried doing it using the Agent, yes, but it didn't work. IIUC it doesn't work because the test runs on Android device, not on the JVM and the tracer can't properly hook to the test.

The best way I know is to upload test results using datadog-ci. It looks like this. Not so bad.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6d5c6d5 - here is one of my previous commits in this PR with the approach using tracer. (docs)

@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-15278/macos-runners-test-observability branch from 2574321 to 19badf5 Compare March 31, 2026 15:55
@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-15278/macos-runners-test-observability branch from 19badf5 to 8107c2f Compare March 31, 2026 15:59
@datadog-datadog-prod-us1-2

This comment has been minimized.

@codecov-commenter

codecov-commenter commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.58%. Comparing base (41ae98f) to head (966021a).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3295      +/-   ##
===========================================
+ Coverage    71.49%   71.58%   +0.09%     
===========================================
  Files          946      946              
  Lines        34895    34895              
  Branches      5906     5906              
===========================================
+ Hits         24947    24979      +32     
+ Misses        8283     8263      -20     
+ Partials      1665     1653      -12     

see 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


source-secrets-macos:
- vault login -method=aws -no-print
- export DD_ANDROID_SECRETS_PATH_PREFIX="kv/aws/arn:aws:iam::486234852809:role/ci-dd-sdk-android/"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on MacOS runners we have to get secrets from a different path

- GRADLE_OPTS="-Xmx3072m" ./gradlew :reliability:core-it:connectedDebugAndroidTest --stacktrace --no-daemon $( (( $ANDROID_API <= 23 )) && echo "-Puse-api21-java-backport -Puse-desugaring" ) || exit_code=$?
- GRADLE_OPTS="-Xmx3072m -javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG" DD_TAGS="test.configuration.android_api:$ANDROID_API" ./gradlew :reliability:core-it:connectedDebugAndroidTest --stacktrace --no-daemon $( (( $ANDROID_API <= 23 )) && echo "-Puse-api21-java-backport -Puse-desugaring" ) || exit_code=$?
- $ANDROID_HOME/platform-tools/adb emu kill
- datadog-ci junit upload --service dd-sdk-android --tags test.configuration.android_api:$ANDROID_API --xpath-tag test.suite=/testcase/@classname reliability/core-it/build/outputs/androidTest-results/connected/debug/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--tags test.configuration.android_api:$ANDROID_API is used to be able to distinguish between the same tests but run on different android versions.

- GRADLE_OPTS="-Xmx3072m" ./gradlew :reliability:core-it:connectedDebugAndroidTest --stacktrace --no-daemon $( (( $ANDROID_API <= 23 )) && echo "-Puse-api21-java-backport -Puse-desugaring" ) || exit_code=$?
- GRADLE_OPTS="-Xmx3072m -javaagent:$DD_TRACER_FOLDER/dd-java-agent.jar=$DD_COMMON_AGENT_CONFIG" DD_TAGS="test.configuration.android_api:$ANDROID_API" ./gradlew :reliability:core-it:connectedDebugAndroidTest --stacktrace --no-daemon $( (( $ANDROID_API <= 23 )) && echo "-Puse-api21-java-backport -Puse-desugaring" ) || exit_code=$?
- $ANDROID_HOME/platform-tools/adb emu kill
- datadog-ci junit upload --service dd-sdk-android --tags test.configuration.android_api:$ANDROID_API --xpath-tag test.suite=/testcase/@classname reliability/core-it/build/outputs/androidTest-results/connected/debug/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--xpath-tag test.suite=/testcase/@classname is needed, because otherwise all tests end up belonging to the same test suite (for example FeatureSdkCoreTest).

see docs

@aleksandr-gringauz
aleksandr-gringauz marked this pull request as ready for review March 31, 2026 18:33
@aleksandr-gringauz
aleksandr-gringauz requested review from a team as code owners March 31, 2026 18:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8107c2f031

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ci/pipelines/default-pipeline.yml
@aleksandr-gringauz
aleksandr-gringauz merged commit 1a18b04 into develop Apr 1, 2026
26 checks passed
@aleksandr-gringauz
aleksandr-gringauz deleted the aleksandr-gringauz/RUM-15278/macos-runners-test-observability branch April 1, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants