Skip to content

Generate virtual-field helpers on first class transformation - #20964

Draft
trask with Copilot wants to merge 5 commits into
mainfrom
copilot/lazy-helper-generation-optimization
Draft

trask with Copilot wants to merge 5 commits into
mainfrom
copilot/lazy-helper-generation-optimization

Conversation

Copilot AI commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Generate virtual-field helpers when an instrumentation module first transforms a matching class, rather than eagerly during agent startup. Libraries that never load avoid this work; libraries loaded later pay the one-time cost then.

In the Spring/JDK 25 bare-metal benchmark, median startup fell from about 4.96 s to 4.32 s in the first run and an independent confirmation, about 640 ms or 13% overall. HTTP readiness also improved by about 650 ms. These results are specific to this workload and configuration.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-26 04:50 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize lazy virtual-field helper generation Generate virtual-field helpers on first class transformation Oct 26, 2026
Copilot AI requested a review from trask October 26, 2026 00:24
@trask
trask requested a balanced review from Copilot October 26, 2026 00:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Concurrent class-loading and bootstrap-injection behavior needs human validation beyond the publication-focused unit tests.

1 open issue
What changed in this PR

Defers virtual-field helper generation until an instrumentation module first transforms a matching class, avoiding generation for unused libraries.

Changes:

  • Lazily generates and atomically publishes a reusable helper bundle.
  • Preserves accessor-before-implementation injection order.
  • Adds laziness and concurrency tests with a dedicated unit-test runtime configuration.
File Description
javaagent-tooling/​src/​unitTests/​java/​io/​opentelemetry/​javaagent/​tooling/​field/​FieldBackedImplementationInstallerTest.java Adds deferred-generation and concurrent-publication tests.
javaagent-tooling/​src/​main/​java/​io/​opentelemetry/​javaagent/​tooling/​field/​FieldBackedImplementationInstaller.java Moves helper generation into transformation-time initialization.
javaagent-tooling/​build.gradle.kts Registers the unit-test suite and excludes conflicting runtime dependencies.

Review effort: Balanced

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 26, 2026 00:45
@trask
trask requested a balanced review from Copilot October 26, 2026 00:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Moving bootstrap helper generation into concurrent class transformation changes class-loading behavior and warrants final human review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 26, 2026 01:32
@trask
trask requested a balanced review from Copilot October 26, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Moving shared helper generation into concurrent class-loading callbacks warrants human review of bootstrap initialization, despite no identified blocking defects.

No open issues 🎉

Review effort: Balanced

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 26, 2026 02:59
@trask
trask requested a balanced review from Copilot October 26, 2026 02:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Moving shared helper initialization into live class transformations warrants human review of class-loading and concurrency behavior, although no concrete defect was identified.

No open issues 🎉

Review effort: Balanced

@trask
trask marked this pull request as ready for review October 26, 2026 03:05
@trask
trask requested a review from a team as a code owner October 26, 2026 03:05
@trask
trask marked this pull request as draft October 26, 2026 04:50

This branch has not been deployed

No deployments
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