Skip to content

Make index tasks cacheable and improve input fingerprinting#11896

Open
bric3 wants to merge 2 commits into
masterfrom
bdu/improve-index-task-cacheability
Open

Make index tasks cacheable and improve input fingerprinting#11896
bric3 wants to merge 2 commits into
masterfrom
bdu/improve-index-task-cacheability

Conversation

@bric3

@bric3 bric3 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

This PR makes the instrumentation index and agentJarIndex build tasks cacheable. Additionally, it improves how Gradle fingerprints task inputs for consistency and better cache normalization.

Motivation

Enabling task caching improves build performance by reusing outputs from previous executions. Adjusting input fingerprint normalization ensures accurate task caching behavior under different build environments.

Note

JavaExec is disabled for caching by default because Gradle needs task-specific input/output information. These index generators are deterministic for the same inputs, so declaring the missing metadata and enabling TaskOutputs.cacheIf lets Gradle restore their generated index files from the build cache instead of rerunning them.

Additional Notes

  • The instrumentation index task no longer declares redundant input for the class path, as it is already specified in the JavaExec specification.
  • The agentJarIndex task now uses PathSensitivity.RELATIVE for the expanded file tree.
    for input fingerprinting, focusing on relevant files below specific directories and improving CI build behavior.

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: [PROJ-IDENT]

bric3 added 2 commits July 9, 2026 12:56
Also, it improves the way gradle fingerprints the input

The class path is already declared as an input if the JavaExec spec, and
doesn't need an additinal declaration.

The included dir is `dd-java-agent/build/generated/included`
we don't really care about `included/` or where it is, but the task
cares about what's below, like `inst/foo/Bar.classdata`. So the idea is
to tell gradle to apply that normalization for fingerprinting.

https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/PathSensitivity.html#RELATIVE

Additional note, that in CI the build dir of projects is relocated under

```
..../workspace/dd-java-agent/build
```
The class path is already declared as an input if the JavaExec spec, and
doesn't need an additinal declaration.
@bric3 bric3 requested review from a team as code owners July 9, 2026 11:02
@bric3 bric3 requested review from ValentinZakharov and removed request for a team July 9, 2026 11:02
@bric3 bric3 added tag: no release notes Changes to exclude from release notes comp: tooling Build & Tooling labels Jul 9, 2026
@bric3 bric3 requested a review from mhlidd July 9, 2026 11:02
@datadog-prod-us1-3

This comment has been minimized.

@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: f46f26b0f9

ℹ️ 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 dd-java-agent/instrumentation/build.gradle
@dd-octo-sts

dd-octo-sts Bot commented Jul 9, 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.97 s [-0.4%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 12.94 s 13.01 s [-1.3%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 16.70 s 16.78 s [-1.6%; +0.6%] (no difference)
startup:petclinic:iast:Agent 16.86 s 16.98 s [-1.6%; +0.2%] (no difference)
startup:petclinic:profiling:Agent 16.59 s 16.49 s [-0.3%; +1.5%] (no difference)
startup:petclinic:sca:Agent 16.84 s 16.70 s [-0.0%; +1.7%] (no difference)
startup:petclinic:tracing:Agent 16.06 s 16.16 s [-1.6%; +0.3%] (no difference)

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

@bric3 bric3 changed the title Make build tasks cacheable and improve input fingerprinting Make index tasks cacheable and improve input fingerprinting Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: no release notes Changes to exclude from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant