Skip to content

Java agent cleanup#1073

Merged
grcevski merged 5 commits intoopen-telemetry:mainfrom
grcevski:java_agent_cleanup
Jan 12, 2026
Merged

Java agent cleanup#1073
grcevski merged 5 commits intoopen-telemetry:mainfrom
grcevski:java_agent_cleanup

Conversation

@grcevski
Copy link
Copy Markdown
Contributor

@grcevski grcevski commented Jan 9, 2026

This PR makes small improvements to the OBI java agent:

  • I added a check to prevent the agent to be loaded (manually by using -javaagent:...) on non Linux systems. Since the ioctl API is Linux only, this will cause unexpected behaviour.
  • I learned that you can pass data from a ByteBuddy method enter to exit with the @Advice.Enter annotation, so I changed to using that approach instead of the thread locals I was using.
  • The thread pool instrumentations I added (the ForkJoin specifically) are used in the concurrent LRU implementation we are using (Caffeine), so I made sure we are not instrumenting those thread pools.

Checklist

@grcevski grcevski requested a review from a team as a code owner January 9, 2026 22:04
@Advice.Argument(1) final ByteBuffer dst,
@Advice.Return SSLEngineResult result) {
if (src == null || dst == null) {
SSLStorage.unencrypted.remove();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I caught two missing cleanup on return cases.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.27%. Comparing base (1024512) to head (ad3d043).
⚠️ Report is 1 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (1024512) and HEAD (ad3d043). Click for more details.

HEAD has 10 uploads less than BASE
Flag BASE (1024512) HEAD (ad3d043)
integration-test-vm-${ARCH}-${KERNEL_VERSION} 10 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1073      +/-   ##
==========================================
- Coverage   56.97%   47.27%   -9.70%     
==========================================
  Files         260      261       +1     
  Lines       22786    27455    +4669     
==========================================
- Hits        12982    12980       -2     
- Misses       8938    13608    +4670     
- Partials      866      867       +1     
Flag Coverage Δ
integration-test 22.81% <ø> (-0.01%) ⬇️
integration-test-arm 0.00% <ø> (?)
integration-test-vm-${ARCH}-${KERNEL_VERSION} ?
k8s-integration-test 2.64% <ø> (ø)
oats-test 0.00% <ø> (ø)
unittests 48.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@skl skl left a comment

Choose a reason for hiding this comment

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

lgtm

@grcevski grcevski merged commit b8f5e94 into open-telemetry:main Jan 12, 2026
47 checks passed
@grcevski grcevski deleted the java_agent_cleanup branch January 12, 2026 17:31
@MrAlias MrAlias added this to the v0.5.0 milestone Feb 10, 2026
@MrAlias MrAlias mentioned this pull request Feb 10, 2026
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