open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Replace collision-only VirtualField wrappers with named fields

Open
#20,179 0 comments 0 reactions 1 assignee View on GitHub

@trask is already working on this.

Since Sep 17, 2026.

enhancement needs triage
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Is your feature request related to a problem? Please describe.

Before #19980, a virtual field was identified only by its carrier and value types. Instrumentations that needed distinct fields for the same type pair sometimes had to introduce a holder class only to make the mapping unique. These synthetic wrappers add allocation and indirection, and they hide the value the field actually stores.

Describe the solution you'd like

After #19980 lands, audit existing instrumentation and replace holder classes used only to distinguish a virtual field with named fields such as VirtualField.find("configured-target", Carrier.class, Value.class). Store the underlying value directly and remove the wrapper.

Keep wrappers that carry real state, including multiple values, mutable or synchronized lifecycle state, and null-versus-absent semantics. Update focused tests where the stored representation changes.

Describe alternatives you've considered

Keep dedicated holder types. This preserves unique mappings but leaves unnecessary types and allocations in instrumentation code.

Additional context

#19980 adds named virtual fields.

The ConfiguredTarget holder in #20073 is not a collision-only wrapper. It distinguishes an absent target from an explicitly captured null target, so it should remain unless a replacement preserves that behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.