Skip to content

Add AGP usage visibility for Gradle projects#11869

Open
daniel-mohedano wants to merge 1 commit into
daniel.mohedano/android-robolectricfrom
daniel.mohedano/agp-visibility
Open

Add AGP usage visibility for Gradle projects#11869
daniel-mohedano wants to merge 1 commit into
daniel.mohedano/android-robolectricfrom
daniel.mohedano/agp-visibility

Conversation

@daniel-mohedano

@daniel-mohedano daniel-mohedano commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

  • Implements additional visibility for session and module spans in Gradle projects making use of the Android Gradle Plugin. Our Gradle instrumentation will consider "Android Projects" those containing the com.android.base plugin in their used plugins.
    • New test.is_android tag is added to module spans and propagated to session spans with an OR operation.
    • New is_android boolean field on the event_finished telemetry metric.

Motivation

Together with #11852, the changes aim to provide better visibility for Android users using Test Optimization. In this case, it provides visibility on the overall Android user base, even if they don't use Robolectric emulation for unit tests.

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

@daniel-mohedano daniel-mohedano added type: feature Enhancements and improvements comp: ci visibility Continuous Integration Visibility labels Jul 6, 2026
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - sbt-scalatest

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 55.39 55.43 $\color{green}{\blacktriangledown}$ -0.04 54.33 $\color{red}{\blacktriangle}$ +1.06 68/228
agentEvpProxy 54.81 n/a n/a n/a n/a -

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@datadog-datadog-us1-prod

This comment has been minimized.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - pass4s

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 6.19 9.35 $\color{green}{\blacktriangledown}$ -3.16 10.33 $\color{green}{\blacktriangledown}$ -4.14 35/112
agentless 7.73 10.33 $\color{green}{\blacktriangledown}$ -2.60 10.13 $\color{green}{\blacktriangledown}$ -2.40 35/112
agentlessCodeCoverage 17.56 16.69 $\color{red}{\blacktriangle}$ +0.87 17.38 $\color{red}{\blacktriangle}$ +0.18 34/110

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - nebula-release-plugin

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 37.51 37.15 $\color{red}{\blacktriangle}$ +0.36 36.42 $\color{red}{\blacktriangle}$ +1.09 34/111
agentless 37.41 36.42 $\color{red}{\blacktriangle}$ +0.99 36.42 $\color{red}{\blacktriangle}$ +0.99 34/111
agentlessCodeCoverage 45.03 44.48 $\color{red}{\blacktriangle}$ +0.55 44.48 $\color{red}{\blacktriangle}$ +0.55 34/111
agentlessLineCoverage 74.77 74.82 $\color{green}{\blacktriangledown}$ -0.05 74.82 $\color{green}{\blacktriangledown}$ -0.05 33/110

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - reactive-streams-jvm

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 22.70 22.09 $\color{red}{\blacktriangle}$ +0.61 21.65 $\color{red}{\blacktriangle}$ +1.05 35/118
agentless 20.04 18.82 $\color{red}{\blacktriangle}$ +1.22 18.82 $\color{red}{\blacktriangle}$ +1.22 34/116
agentlessCodeCoverage 20.45 20.39 $\color{red}{\blacktriangle}$ +0.06 19.99 $\color{red}{\blacktriangle}$ +0.46 34/115
agentlessLineCoverage 31.83 30.42 $\color{red}{\blacktriangle}$ +1.41 29.82 $\color{red}{\blacktriangle}$ +2.01 33/114

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - netflix-zuul

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 86.78 87.80 $\color{green}{\blacktriangledown}$ -1.02 87.80 $\color{green}{\blacktriangledown}$ -1.02 35/117
agentless 81.84 81.05 $\color{red}{\blacktriangle}$ +0.79 81.05 $\color{red}{\blacktriangle}$ +0.79 35/116
agentlessCodeCoverage 96.87 97.04 $\color{green}{\blacktriangledown}$ -0.17 95.12 $\color{red}{\blacktriangle}$ +1.75 35/114
agentlessLineCoverage 112.96 111.62 $\color{red}{\blacktriangle}$ +1.34 111.62 $\color{red}{\blacktriangle}$ +1.34 34/114

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@daniel-mohedano daniel-mohedano force-pushed the daniel.mohedano/agp-visibility branch from bec0bb1 to 2d4c049 Compare July 6, 2026 14:10
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - sonar-kotlin

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 12.95 12.87 $\color{red}{\blacktriangle}$ +0.08 13.13 $\color{green}{\blacktriangledown}$ -0.18 32/112
agentless 12.88 12.37 $\color{red}{\blacktriangle}$ +0.51 12.12 $\color{red}{\blacktriangle}$ +0.76 32/111
agentlessCodeCoverage 15.43 15.11 $\color{red}{\blacktriangle}$ +0.32 15.11 $\color{red}{\blacktriangle}$ +0.32 32/111
agentlessLineCoverage 20.58 18.82 $\color{red}{\blacktriangle}$ +1.76 18.82 $\color{red}{\blacktriangle}$ +1.76 31/111

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - jolokia

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 94.05 95.12 $\color{green}{\blacktriangledown}$ -1.07 93.23 $\color{red}{\blacktriangle}$ +0.82 38/121
agentless 88.29 89.58 $\color{green}{\blacktriangledown}$ -1.29 89.58 $\color{green}{\blacktriangledown}$ -1.29 35/117
agentlessCodeCoverage 99.24 99.00 $\color{red}{\blacktriangle}$ +0.24 99.00 $\color{red}{\blacktriangle}$ +0.24 37/116
agentlessLineCoverage 98.54 99.00 $\color{green}{\blacktriangledown}$ -0.46 99.00 $\color{green}{\blacktriangledown}$ -0.46 34/114

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@dd-octo-sts

dd-octo-sts Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
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
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.00 s 13.94 s [-0.4%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 12.90 s 13.00 s [-1.4%; -0.0%] (maybe better)
startup:petclinic:appsec:Agent 16.99 s 16.96 s [-1.0%; +1.3%] (no difference)
startup:petclinic:iast:Agent 16.96 s 17.02 s [-1.1%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 16.51 s 16.91 s [-3.7%; -1.1%] (significantly better)
startup:petclinic:sca:Agent 17.00 s 16.59 s [+1.6%; +3.2%] (significantly worse)
startup:petclinic:tracing:Agent 16.12 s 16.14 s [-1.0%; +0.7%] (no difference)

Commit: 16927719 · 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.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - okhttp

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 18.87 19.20 $\color{green}{\blacktriangledown}$ -0.33 19.20 $\color{green}{\blacktriangledown}$ -0.33 38/124
agentless 18.53 19.20 $\color{green}{\blacktriangledown}$ -0.67 19.20 $\color{green}{\blacktriangledown}$ -0.67 36/121
agentlessCodeCoverage 21.45 22.54 $\color{green}{\blacktriangledown}$ -1.09 22.09 $\color{green}{\blacktriangledown}$ -0.64 36/119
agentlessLineCoverage 44.10 44.48 $\color{green}{\blacktriangledown}$ -0.38 44.48 $\color{green}{\blacktriangledown}$ -0.38 35/124

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - spring_boot

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 16.15 16.36 $\color{green}{\blacktriangledown}$ -0.21 16.04 $\color{red}{\blacktriangle}$ +0.11 34/110
agentless 9.67 9.73 $\color{green}{\blacktriangledown}$ -0.06 9.73 $\color{green}{\blacktriangledown}$ -0.06 34/111
agentlessCodeCoverage 13.07 13.67 $\color{green}{\blacktriangledown}$ -0.60 13.13 $\color{green}{\blacktriangledown}$ -0.06 34/109
agentlessLineCoverage 32.71 32.95 $\color{green}{\blacktriangledown}$ -0.24 32.30 $\color{red}{\blacktriangle}$ +0.41 34/110

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - sonar-java

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent -7.53 13.40 $\color{green}{\blacktriangledown}$ -20.93 15.72 $\color{green}{\blacktriangledown}$ -23.25 32/116
agentless -10.44 12.62 $\color{green}{\blacktriangledown}$ -23.06 17.38 $\color{green}{\blacktriangledown}$ -27.82 32/115
agentlessCodeCoverage 61.69 79.45 $\color{green}{\blacktriangledown}$ -17.76 86.07 $\color{green}{\blacktriangledown}$ -24.38 32/115
agentlessLineCoverage 98.96 130.99 $\color{green}{\blacktriangledown}$ -32.03 139.09 $\color{green}{\blacktriangledown}$ -40.13 31/114

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Environment - heliboard

Job Status: 🟢 success

Scenario This PR (%) 7d median Δ 7d 30d median Δ 30d runs (7d/30d)
agent 11.67 9.54 $\color{red}{\blacktriangle}$ +2.13 9.54 $\color{red}{\blacktriangle}$ +2.13 31/31

Baseline: median of @test.tracer_overhead on main (gitlab) over the last 7/30 days, per OSS project & scenario. Δ = this PR − baseline median; red ▲ = more overhead, green ▽ = less overhead than baseline.

@daniel-mohedano

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 6b9bc56129

ℹ️ 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".

@daniel-mohedano daniel-mohedano force-pushed the daniel.mohedano/android-robolectric branch from 30cee80 to 729666d Compare July 13, 2026 10:27
Detect Android Gradle Plugin projects at the build-system level and surface
an is_android signal independent of the test runner:
- test.is_android span tag on the build-system module, rolled up to the
  session via the tag propagator
- IsAndroid dimension on the EVENT_FINISHED telemetry metric
- detection via com.android.base and com.android.kotlin.multiplatform.library
  (the KMP library plugin, AGP 8.8+, does not apply com.android.base)

Exercised by the Robolectric Gradle smoke test through a com.android.base
stand-in plugin.
@daniel-mohedano daniel-mohedano force-pushed the daniel.mohedano/agp-visibility branch from 6b9bc56 to 1692771 Compare July 13, 2026 10:52
@daniel-mohedano daniel-mohedano marked this pull request as ready for review July 13, 2026 11:01
@daniel-mohedano daniel-mohedano requested review from a team as code owners July 13, 2026 11:01
@daniel-mohedano daniel-mohedano requested review from mhlidd and removed request for a team July 13, 2026 11:01

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

Datadog Autotest: PASS

More details

The tag-read-after-span-finish pattern in AbstractTestModule.end() is safe: DDSpan.getTag() delegates to DDSpanContext.unsafeTags which is not cleared during finish, so span.getTag(TEST_IS_ANDROID) at line 122 reliably returns the Boolean.TRUE set during onTestModuleStart(). The Boolean::logicalOr merge spec, IsAndroid enum structure, and EVENT_FINISHED metric index expansion (1920→3840 entries, zero collisions) were all validated by synthetic execution against the production code logic.

Was this helpful? React 👍 or 👎

📊 Validated against 8 scenarios · Open Bits AI session

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: ci visibility Continuous Integration Visibility type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants