{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/comments/204797656","pull_request_review_id":139941636,"id":204797656,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDc5NzY1Ng==","diff_hunk":"@@ -48,34 +49,47 @@ public ExtractedContext extract(final TextMap carrier) {\n \n     Map<String, String> baggage = Collections.emptyMap();\n     Map<String, String> tags = Collections.emptyMap();\n-    Long traceId = 0L;\n-    Long spanId = 0L;\n+    String traceId = \"0\";\n+    String spanId = \"0\";\n     int samplingPriority = PrioritySampling.UNSET;\n \n     for (final Map.Entry<String, String> entry : carrier) {\n       final String key = entry.getKey().toLowerCase();\n-      if (key.equalsIgnoreCase(TRACE_ID_KEY)) {\n-        traceId = Long.parseLong(entry.getValue());\n-      } else if (key.equalsIgnoreCase(SPAN_ID_KEY)) {\n-        spanId = Long.parseLong(entry.getValue());\n+      final String val = entry.getValue();\n+\n+      boolean valueIsNumber = false;\n+      if (TRACE_ID_KEY.equalsIgnoreCase(key) || SPAN_ID_KEY.equalsIgnoreCase(key)) {\n+        try {\n+          BigInteger validate = new BigInteger(val);\n+          valueIsNumber = true;\n+        } catch (NumberFormatException nfe) {\n+          throw new IllegalArgumentException(\n+              \"Expecting a number for trace ID or span ID, but got: \" + val);\n+        }\n+      }\n+\n+      if (TRACE_ID_KEY.equalsIgnoreCase(key) && valueIsNumber) {\n+        traceId = val;","path":"dd-trace-ot/src/main/java/datadog/opentracing/propagation/HTTPCodec.java","position":38,"original_position":38,"commit_id":"a8a7435b483cc992838d57e05e02f79766dcc4b5","original_commit_id":"a8a7435b483cc992838d57e05e02f79766dcc4b5","user":{"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},"body":"I think design wise it might be better to put above parsing logic into a helper function and all it here like `traceId = parse64BitId(val)` - and `parse64BitId` would do the parsing and error handling and return `\"0\"` if needed.\r\nThis change would simplify this function and also reduce number of times strings are compared.","created_at":"2018-07-24T15:15:31Z","updated_at":"2018-07-24T15:15:31Z","html_url":"https://github.com/DataDog/dd-trace-java/pull/392#discussion_r204797656","pull_request_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/comments/204797656"},"html":{"href":"https://github.com/DataDog/dd-trace-java/pull/392#discussion_r204797656"},"pull_request":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392","id":202636081,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyNjM2MDgx","html_url":"https://github.com/DataDog/dd-trace-java/pull/392","diff_url":"https://github.com/DataDog/dd-trace-java/pull/392.diff","patch_url":"https://github.com/DataDog/dd-trace-java/pull/392.patch","issue_url":"https://api.github.com/repos/DataDog/dd-trace-java/issues/392","number":392,"state":"open","locked":false,"title":"Change the internal storage and handling of trace ID, span ID, and pa…","user":{"login":"gary-huang","id":15223396,"node_id":"MDQ6VXNlcjE1MjIzMzk2","avatar_url":"https://avatars0.githubusercontent.com/u/15223396?v=4","gravatar_id":"","url":"https://api.github.com/users/gary-huang","html_url":"https://github.com/gary-huang","followers_url":"https://api.github.com/users/gary-huang/followers","following_url":"https://api.github.com/users/gary-huang/following{/other_user}","gists_url":"https://api.github.com/users/gary-huang/gists{/gist_id}","starred_url":"https://api.github.com/users/gary-huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gary-huang/subscriptions","organizations_url":"https://api.github.com/users/gary-huang/orgs","repos_url":"https://api.github.com/users/gary-huang/repos","events_url":"https://api.github.com/users/gary-huang/events{/privacy}","received_events_url":"https://api.github.com/users/gary-huang/received_events","type":"User","site_admin":false},"body":"…rent IDs' to use String instead of long primitive.\r\n\r\nThis will allow the java agent to receive unsigned 64 bit integers without overflow.\r\n\r\nAlso upgraded MsgPack to handle the serialization of such Strings as numbers in JSONs.","created_at":"2018-07-19T17:48:29Z","updated_at":"2018-07-24T15:15:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7b08f3f14552193fa8124f6e677111b491334c7","assignee":null,"assignees":[],"requested_reviewers":[],"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":5,"closed_issues":3,"state":"open","created_at":"2018-07-19T16:33:08Z","updated_at":"2018-07-23T02:45:21Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392/commits","review_comments_url":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392/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/392/comments","statuses_url":"https://api.github.com/repos/DataDog/dd-trace-java/statuses/a8a7435b483cc992838d57e05e02f79766dcc4b5","head":{"label":"DataDog:gary/uint64-id-support","ref":"gary/uint64-id-support","sha":"a8a7435b483cc992838d57e05e02f79766dcc4b5","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-23T03:45:43Z","pushed_at":"2018-07-24T14:58:01Z","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":77811,"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":12,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11,"open_issues":12,"watchers":46,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"1aaa3cafeb2d89b3d38474aa799ab09a464c401b","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-23T03:45:43Z","pushed_at":"2018-07-24T14:58:01Z","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":77811,"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":12,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11,"open_issues":12,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392"},"html":{"href":"https://github.com/DataDog/dd-trace-java/pull/392"},"issue":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/issues/392"},"comments":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/issues/392/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/pulls/392/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/392/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/dd-trace-java/statuses/a8a7435b483cc992838d57e05e02f79766dcc4b5"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mar-kolya"}}