open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Replace collision-only VirtualField wrappers with named fields
@trask is already working on this.
Since Sep 17, 2026.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.