Skip to content

Add Android/Robolectric visibility to Test Optimization spans - #11852

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
masterfrom
daniel.mohedano/android-robolectric
Jul 13, 2026
Merged

Add Android/Robolectric visibility to Test Optimization spans#11852
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
masterfrom
daniel.mohedano/android-robolectric

Conversation

@daniel-mohedano

@daniel-mohedanodaniel-mohedano commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

  • Implements additional visibility to test spans for test emulated with the Android SDK through Robolectric. These tests are already traced OOTB as JUnit4 tests.
    • New per-test span tags:
      • test.android.api_level
      • test.android.release
      • test.android.codename
      • test.android.robolectric.version
    • New is_android_emulated boolean field on the test_event_finished telemetry metric.
  • Adds a new GradleDaemonSmokeTest test to validate the new instrumentation and tagging. It covers both @RunWith(RobolectricTestRunner.class) and @RunWith(AndroidJUnit4.class).

Motivation

With Android tests already being supported OOTB, these changes provide better visibility for customers using the Robolectric framework.

Additional Notes

test-environment-trigger: skip

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)
    • Get more information in this doc

Jira ticket: SDTEST-3887 [SDTEST-3888] [SDTEST-3889]

@daniel-mohedanodaniel-mohedano added type: feature Enhancements and improvements comp: ci visibility Continuous Integration Visibility labels Jul 3, 2026
@daniel-mohedanodaniel-mohedano changed the title Report additional information for Android tests with RobolectricAdd Android/Robolectric visibility to Test Optimization spansJul 3, 2026
@datadog-datadog-us1-prod

This comment has been minimized.

@dd-octo-sts

dd-octo-stsBot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

SuiteStatus
Startup🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
ScenarioCandidatemasterΔ (95% CI of mean)
startup:insecure-bank:iast:Agent14.02 s13.97 s[-0.4%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent12.91 s13.04 s[-1.6%; -0.4%] (maybe better)
startup:petclinic:appsec:Agent16.96 s16.67 s[+0.6%; +2.8%] (maybe worse)
startup:petclinic:iast:Agent16.82 s16.99 s[-1.9%; -0.1%] (maybe better)
startup:petclinic:profiling:Agent16.49 s16.92 s[-3.6%; -1.4%] (significantly better)
startup:petclinic:sca:Agent16.93 s16.77 s[+0.0%; +1.9%] (maybe worse)
startup:petclinic:tracing:Agent16.02 s16.27 s[-2.6%; -0.5%] (maybe better)

Commit:75e82e07 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@daniel-mohedano
daniel-mohedanoforce-pushed the daniel.mohedano/android-robolectric branch from 4d4dc9e to 1b228eeCompareJuly 8, 2026 09:00
@daniel-mohedano
daniel-mohedano marked this pull request as ready for review July 13, 2026 08:56
@daniel-mohedano
daniel-mohedano requested review from a team as code ownersJuly 13, 2026 08:56
@daniel-mohedano
daniel-mohedano requested review from jordan-wong, mcculls and sarahchen6 and removed request for a teamJuly 13, 2026 08:56

@datadog-datadog-us1-proddatadog-datadog-us1-prodBot 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.

Datadog Autotest: PASS

More details

PR adds Android/Robolectric test visibility by instrumenting TestEnvironment.setUpApplicationState() to capture SDK metadata (API level, release, codename, Robolectric version) and emit a new IsAndroidEmulated boolean metric. All defensive null checks are in place, parameter ordering to the TEST_EVENT_FINISHED metric matches the enum exactly, and the Robolectric JAR version extraction regex is correctly implemented. Test validation includes both @RunWith(RobolectricTestRunner.class) and @RunWith(AndroidJUnit4.class) runners with expected API 34 artifacts.

Was this helpful? React 👍 or 👎

📊 Validated against 7 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 30cee80 · What is Autotest? · Any feedback? Reach out in #autotest

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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:30cee80829

ℹ️ 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 threaddd-java-agent/instrumentation/robolectric/robolectric-4.11/build.gradle Outdated
Comment threaddd-java-agent/instrumentation/robolectric/robolectric-4.11/build.gradle Outdated
@daniel-mohedano
daniel-mohedanoforce-pushed the daniel.mohedano/android-robolectric branch from 30cee80 to 729666dCompareJuly 13, 2026 10:27
@daniel-mohedano

Copy link
Copy Markdown
ContributorAuthor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351Bot commented Jul 13, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-13 14:03:25 UTC ℹ️ Start processing command /merge


2026-07-13 14:03:30 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-07-13 15:12:48 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854dBot merged commit 0d23385 into masterJul 13, 2026
779 of 781 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854dBot deleted the daniel.mohedano/android-robolectric branch July 13, 2026 15:12
@github-actionsgithub-actionsBot added this to the 1.65.0 milestone Jul 13, 2026
jordan-wong added a commit that referenced this pull request Jul 14, 2026
Automated integration-authoring pass on rxjava-3.0, produced against the
draft skill in #11927 (which was in-tree on the target checkout at
generation time — using the skill-loading precedence fix from the
2026-07-13 HTTP cycle correction). Reference for #11927 reviewers to
see concrete output the current skill draft produces.
Not intended to be merged as-is.
Base: master @ 05671ce (rebased from original bd134f3; the original
branch inherited a stash-merge revert of #11852 during eval branch setup
that dropped DD_TRACE_ROBOLECTRIC_ENABLED from metadata plus 172 unrelated
files. This rebased version cherry-picks ONLY the rxjava-3.0 module output
onto current master, preserving all unrelated upstream changes.)
Cost: \$43.23, wall time ~3.5h, reviewer approved with 0 todos remaining.
Diff scope: dd-java-agent/instrumentation/rxjava/rxjava-3.0/ only.
Metadata: no change (all rxjava3 entries already present on master).
jordan-wong added a commit that referenced this pull request Jul 14, 2026
…skill
Automated integration-authoring pass on reactor-core-3.1, produced against
the draft skill in #11927. Reference for #11927 reviewers to see concrete
output the current skill draft produces.
Not intended to be merged as-is.
Base: master @ 05671ce (rebased from original 2e1d2b9; the original
branch inherited a stash-merge revert of #11852 during eval branch setup
that dropped DD_TRACE_ROBOLECTRIC_ENABLED from metadata plus 172 unrelated
files. This rebased version cherry-picks ONLY the reactor-core-3.1 module
output onto current master, preserving all unrelated upstream changes.)
Cost: \$13, reviewer approved with 0 todos remaining.
Diff scope: dd-java-agent/instrumentation/reactor-core-3.1/ only.
Metadata: no change (all reactor entries already present on master).
Note: the toolkit reorganized the package layout from
'datadog.trace.instrumentation.reactor.core' (master) to
'datadog.trace.instrumentation.reactorcore' (eval). This is a
regen-preservation Rule #2 concern; documented for reviewer consideration.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: ci visibilityContinuous Integration Visibilitytype: featureEnhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@daniel-mohedano@ypopovych