Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NR-70183 httpurlconnection fix #1102

Merged
merged 12 commits into from
Dec 19, 2022
Merged

Conversation

jasonjkeller
Copy link
Contributor

@jasonjkeller jasonjkeller commented Dec 9, 2022

Refactoring of httpurlconnection instrumentation due to several bugs discovered.

Behavior expected when HttpURLConnection APIs are called in different combos and orders after the refactoring.

  • If only connect is called, then NO request is made over the wire and NO external call is reported. The instrumentation starts a TimerTask if connect is called first, waits for a set period of time (currently configured to be 1 minute) to determine if any further HttpURLConnection APIs are called before deciding how to proceed. If no other API is called, then the segment is just ignored and no external is reported. If any other method is called an external call will be recorded.
  • Calling any of getOutputStream, getInputStream, getResponseCode, or getHeaderFields all result in an external call being recorded.

Fixes: #1091

It should also address these related issues:
https://issues.newrelic.com/browse/NEWRELIC-3496
https://issues.newrelic.com/browse/NR-70183

The externals.py AIT failures will pass when this PR is merged: https://github.com/newrelic/java-agent-integration-tests/pull/138

@jasonjkeller jasonjkeller merged commit d2a0878 into main Dec 19, 2022
@jasonjkeller jasonjkeller deleted the NR-70183-httpurlconnection-fix branch December 19, 2022 22:51
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.

External HTTP requests missing /External/{host}/all rollup metric
2 participants