{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/comments/203839378","pull_request_review_id":138811635,"id":203839378,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzgzOTM3OA==","diff_hunk":"@@ -144,12 +133,17 @@ public static void stopSpan(\n       }\n \n       final Span span = scope.span();\n-\n       if (throwable != null) {\n         Tags.ERROR.set(span, true);\n         span.log(Collections.singletonMap(ERROR_OBJECT, throwable));\n-      } else if (responseCode > 0) {\n-        Tags.HTTP_STATUS.set(span, responseCode);\n+      } else {\n+        try {\n+          // response code field is sometimes not populated until the getResponseCode method is explicitly called.\n+          // Calling getResponseCode() here will not trigger additional instrumentation because we have not reset the depth map.\n+          Tags.HTTP_STATUS.set(span, thiz.getResponseCode());","path":"dd-java-agent/instrumentation/http-url-connection/src/main/java/datadog/trace/instrumentation/http_url_connection/HttpUrlConnectionInstrumentation.java","position":149,"original_position":156,"commit_id":"f43c4d61d2ad7c10a7cd9f9184599bee6a9d0f10","original_commit_id":"c7c41c5f718616e48b96f9e78390745a117b9134","user":{"login":"realark","id":31153155,"node_id":"MDQ6VXNlcjMxMTUzMTU1","avatar_url":"https://avatars1.githubusercontent.com/u/31153155?v=4","gravatar_id":"","url":"https://api.github.com/users/realark","html_url":"https://github.com/realark","followers_url":"https://api.github.com/users/realark/followers","following_url":"https://api.github.com/users/realark/following{/other_user}","gists_url":"https://api.github.com/users/realark/gists{/gist_id}","starred_url":"https://api.github.com/users/realark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realark/subscriptions","organizations_url":"https://api.github.com/users/realark/orgs","repos_url":"https://api.github.com/users/realark/repos","events_url":"https://api.github.com/users/realark/events{/privacy}","received_events_url":"https://api.github.com/users/realark/received_events","type":"User","site_admin":false},"body":"getResponseCode() causes the response to be parsed, caching the result in the responseCode field. Is the concern the additional work done to parse and cache the response code, or is there something else to consider?","created_at":"2018-07-19T19:08:00Z","updated_at":"2018-07-19T19:08:00Z","html_url":"https://github.com/DataDog/dd-trace-java/pull/386#discussion_r203839378","pull_request_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/comments/203839378"},"html":{"href":"https://github.com/DataDog/dd-trace-java/pull/386#discussion_r203839378"},"pull_request":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386"}},"in_reply_to_id":203577708},"pull_request":{"url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386","id":202398531,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMzk4NTMx","html_url":"https://github.com/DataDog/dd-trace-java/pull/386","diff_url":"https://github.com/DataDog/dd-trace-java/pull/386.diff","patch_url":"https://github.com/DataDog/dd-trace-java/pull/386.patch","issue_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/386","number":386,"state":"open","locked":false,"title":"httpurlconnection create one span per io","user":{"login":"realark","id":31153155,"node_id":"MDQ6VXNlcjMxMTUzMTU1","avatar_url":"https://avatars1.githubusercontent.com/u/31153155?v=4","gravatar_id":"","url":"https://api.github.com/users/realark","html_url":"https://github.com/realark","followers_url":"https://api.github.com/users/realark/followers","following_url":"https://api.github.com/users/realark/following{/other_user}","gists_url":"https://api.github.com/users/realark/gists{/gist_id}","starred_url":"https://api.github.com/users/realark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realark/subscriptions","organizations_url":"https://api.github.com/users/realark/orgs","repos_url":"https://api.github.com/users/realark/repos","events_url":"https://api.github.com/users/realark/events{/privacy}","received_events_url":"https://api.github.com/users/realark/received_events","type":"User","site_admin":false},"body":"* Use the same operationName for all httpurlconnection calls\r\n* use the `connected` flag to determine if io has occurred\r\n  * Even with keep-alive a new instance of HttpURLConnection is required to make additional requests\r\n  * These instances initialize with connected=false\r\n  * When the underlying connection cache hits, the connection flag is set to true \r\n  * Therefore, if connected=false, we know for sure that no io has occurred for a specific instance\r\n* Add a test for spring rest template\r\n* Skipped instrumentation for a wrapper class which does not update its connected field\r\n\r\nThe way we're using `connected` is an implementation detail of HttpURLConnection. There's no way to cleanly do this at the api level (that I know of). Not great, but it works for all builtin implementations of HttpURLConnection.\r\n\r\nNote that this will also not capture additional reads of the stream after the response stream is returned.\r\n\r\n@gary-huang @tylerbenson Let me know what you think. Any concerns or anything you can think of to break this?","created_at":"2018-07-18T22:33:13Z","updated_at":"2018-07-19T19:08:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e59ea35b3ef79959581d8cb33637b1754dd3e3b","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tylerbenson","id":734411,"node_id":"MDQ6VXNlcjczNDQxMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/734411?v=4","gravatar_id":"","url":"https://api.github.com/users/tylerbenson","html_url":"https://github.com/tylerbenson","followers_url":"https://api.github.com/users/tylerbenson/followers","following_url":"https://api.github.com/users/tylerbenson/following{/other_user}","gists_url":"https://api.github.com/users/tylerbenson/gists{/gist_id}","starred_url":"https://api.github.com/users/tylerbenson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylerbenson/subscriptions","organizations_url":"https://api.github.com/users/tylerbenson/orgs","repos_url":"https://api.github.com/users/tylerbenson/repos","events_url":"https://api.github.com/users/tylerbenson/events{/privacy}","received_events_url":"https://api.github.com/users/tylerbenson/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/DataDog/dd-trace-java/milestones/23","html_url":"https://github.com/DataDog/dd-trace-java/milestone/23","labels_url":"https://api.github.com/repos/DataDog/dd-trace-java/milestones/23/labels","id":3509502,"node_id":"MDk6TWlsZXN0b25lMzUwOTUwMg==","number":23,"title":"0.12.0","description":null,"creator":{"login":"mar-kolya","id":1003102,"node_id":"MDQ6VXNlcjEwMDMxMDI=","avatar_url":"https://avatars0.githubusercontent.com/u/1003102?v=4","gravatar_id":"","url":"https://api.github.com/users/mar-kolya","html_url":"https://github.com/mar-kolya","followers_url":"https://api.github.com/users/mar-kolya/followers","following_url":"https://api.github.com/users/mar-kolya/following{/other_user}","gists_url":"https://api.github.com/users/mar-kolya/gists{/gist_id}","starred_url":"https://api.github.com/users/mar-kolya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mar-kolya/subscriptions","organizations_url":"https://api.github.com/users/mar-kolya/orgs","repos_url":"https://api.github.com/users/mar-kolya/repos","events_url":"https://api.github.com/users/mar-kolya/events{/privacy}","received_events_url":"https://api.github.com/users/mar-kolya/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":0,"state":"open","created_at":"2018-07-19T16:33:08Z","updated_at":"2018-07-19T16:33:47Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386/commits","review_comments_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386/comments","review_comment_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/386/comments","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-java/statuses/f43c4d61d2ad7c10a7cd9f9184599bee6a9d0f10","head":{"label":"DataDog:ark/httpurlconnection","ref":"ark/httpurlconnection","sha":"f43c4d61d2ad7c10a7cd9f9184599bee6a9d0f10","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":89221572,"node_id":"MDEwOlJlcG9zaXRvcnk4OTIyMTU3Mg==","name":"dd-trace-java","full_name":"DataDog/dd-trace-java","owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/dd-trace-java","description":"Datadog APM client for Java","fork":false,"url":"https://api.github.com/repos/DataDog/dd-trace-java","forks_url":"https://api.github.com/repos/DataDog/dd-trace-java/forks","keys_url":"https://api.github.com/repos/DataDog/dd-trace-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-trace-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-trace-java/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-trace-java/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-trace-java/events","assignees_url":"https://api.github.com/repos/DataDog/dd-trace-java/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-trace-java/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-trace-java/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-java/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-trace-java/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-trace-java/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-trace-java/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-trace-java/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-trace-java/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-trace-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-trace-java/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-trace-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-trace-java/merges","archive_url":"https://api.github.com/repos/DataDog/dd-trace-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-trace-java/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-trace-java/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-trace-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-trace-java/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-trace-java/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/dd-trace-java/deployments","created_at":"2017-04-24T09:24:40Z","updated_at":"2018-07-19T16:40:03Z","pushed_at":"2018-07-19T17:48:29Z","git_url":"git://github.com/DataDog/dd-trace-java.git","ssh_url":"git@github.com:DataDog/dd-trace-java.git","clone_url":"https://github.com/DataDog/dd-trace-java.git","svn_url":"https://github.com/DataDog/dd-trace-java","homepage":"https://docs.datadoghq.com/tracing/languages/java","size":77765,"stargazers_count":46,"watchers_count":46,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11,"open_issues":13,"watchers":46,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"37a54b57769cea4b4702b883d0c717eb36100f9f","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":89221572,"node_id":"MDEwOlJlcG9zaXRvcnk4OTIyMTU3Mg==","name":"dd-trace-java","full_name":"DataDog/dd-trace-java","owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/dd-trace-java","description":"Datadog APM client for Java","fork":false,"url":"https://api.github.com/repos/DataDog/dd-trace-java","forks_url":"https://api.github.com/repos/DataDog/dd-trace-java/forks","keys_url":"https://api.github.com/repos/DataDog/dd-trace-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-trace-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-trace-java/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-trace-java/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-trace-java/events","assignees_url":"https://api.github.com/repos/DataDog/dd-trace-java/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-trace-java/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-trace-java/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-java/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-trace-java/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-trace-java/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-trace-java/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-trace-java/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-trace-java/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-trace-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-trace-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-trace-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-trace-java/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-trace-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-trace-java/merges","archive_url":"https://api.github.com/repos/DataDog/dd-trace-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-trace-java/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-trace-java/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-trace-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-trace-java/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-trace-java/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/dd-trace-java/deployments","created_at":"2017-04-24T09:24:40Z","updated_at":"2018-07-19T16:40:03Z","pushed_at":"2018-07-19T17:48:29Z","git_url":"git://github.com/DataDog/dd-trace-java.git","ssh_url":"git@github.com:DataDog/dd-trace-java.git","clone_url":"https://github.com/DataDog/dd-trace-java.git","svn_url":"https://github.com/DataDog/dd-trace-java","homepage":"https://docs.datadoghq.com/tracing/languages/java","size":77765,"stargazers_count":46,"watchers_count":46,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11,"open_issues":13,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386"},"html":{"href":"https://github.com/DataDog/dd-trace-java/pull/386"},"issue":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/issues/386"},"comments":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/issues/386/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/386/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/statuses/f43c4d61d2ad7c10a7cd9f9184599bee6a9d0f10"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"realark"}}