[Feat] [SDK-399] Add java agent for network telemetry events#374
[Feat] [SDK-399] Add java agent for network telemetry events#374buongarzoni wants to merge 10 commits into
Conversation
|
@claude review |
There was a problem hiding this comment.
An organization admin can view or raise the cap at claude.ai/admin-settings/claude-code. The cap resets at the start of the next billing period.
Once the cap resets or is raised, comment @claude review on this pull request to trigger a review.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad0b2acf09
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| @Advice.OnMethodExit(onThrowable = Throwable.class) | ||
| public static void onExit( | ||
| @Advice.Argument(0) HttpUriRequest request, | ||
| @Advice.Return HttpResponse response, |
There was a problem hiding this comment.
Broaden Apache HC4 advice return binding
The advice binds @Advice.Return to HttpResponse, but the matcher also targets execute overloads that use a ResponseHandler and return generic T (erased to Object). In that case ByteBuddy cannot legally bind the return value to HttpResponse, so transformation can fail for CloseableHttpClient and telemetry for Apache HC4 calls will be missing at runtime. Restrict the matcher to response-returning overloads or change the advice signature to handle all matched return types safely.
Useful? React with 👍 / 👎.
| @Advice.OnMethodExit(onThrowable = Throwable.class) | ||
| public static void onExit( | ||
| @Advice.Argument(0) ClassicHttpRequest request, | ||
| @Advice.Return ClassicHttpResponse response, |
There was a problem hiding this comment.
Broaden Apache HC5 advice return binding
This advice has the same return-type mismatch as HC4: @Advice.Return ClassicHttpResponse is applied to methods selected only by name/first argument, which includes execute(..., HttpClientResponseHandler) overloads returning generic T (erased to Object). That mismatch can cause ByteBuddy to reject the advice application, leaving Apache HC5 requests uninstrumented in production code paths that rely on response handlers.
Useful? React with 👍 / 👎.
| .type(ElementMatchers.isSubTypeOf(HttpClient.class)) | ||
| .transform((b, typeDescription, classLoader, module, protectionDomain) -> | ||
| b.visit(Advice.to(SendAdvice.class) | ||
| .on(ElementMatchers.named("send"))) |
There was a problem hiding this comment.
Instrument Java HttpClient async path
The transformer only matches methods named send, so HttpClient.sendAsync(...) calls are never observed. Any 4xx/5xx or transport failures from async requests therefore produce no telemetry event, which creates a large blind spot because async is a common java.net.http.HttpClient usage pattern.
Useful? React with 👍 / 👎.
…r<Long> in AgentTelemetryStore
Description of the change
Add Java agent for automatic network telemetry capture
Auto-instruments all major HTTP clients via -javaagent: using ByteBuddy, capturing 4xx/5xx responses as Rollbar telemetry events with zero code changes required from the user.
Caution
This module targets JVM-based applications only. Android is not supported — ART does not implement the java.lang.instrument API required by Java agents. Android users should use the existing rollbar-android module instead.
What's included:
Usage:
Type of change
Related issues
Checklists
Development
Code review