{"action":"created","comment":{"url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/comments/225071638","pull_request_review_id":164589664,"id":225071638,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTA3MTYzOA==","diff_hunk":"@@ -73,35 +70,35 @@ function makeOptional(val) {\n   }\n }\n \n-function SpanCreator({ tracer, serviceName, kind }) {\n-  return class Span {\n-    _constructedFromOutside(options) {\n-      return (\n-        typeof options.traceId === \"object\" &&\n-        typeof options.traceId.spanId === \"string\"\n-      );\n-    }\n+function SpanCreator({ otTracer, tracer, serviceName, kind, sampler }) {\n+  return class Span extends OpenTracing.Span {\n     _getTraceId(options) {\n-      // construct from give traceId\n-      if (this._constructedFromOutside(options)) {\n-        const { traceId, parentId, spanId, sampled } = options.traceId;\n-        return new TraceId({\n-          traceId: makeOptional(traceId),\n-          parentId: makeOptional(parentId),\n-          spanId: spanId,\n-          sampled: makeOptional(sampled)\n-        });\n-      }\n-\n       // construct with parent\n-      if (options.childOf !== null && typeof options.childOf === \"object\") {\n-        const parent = options.childOf;\n+      // for \"references\" see: https://github.com/opentracing/opentracing-javascript/blob/d2c1c6a5a50439bd769d02c7f4638293db40140a/src/tracer.ts#L79-L93\n+      const childOf =\n+        options.references &&\n+        options.references.find(\n+          r => r.type() === OpenTracing.REFERENCE_CHILD_OF\n+        );\n+      const followsFrom =\n+        options.references &&\n+        options.references.find(\n+          r => r.type() === OpenTracing.REFERENCE_FOLLOWS_FROM\n+        );\n+      const parent = childOf || followsFrom; // prefer \"child-of\" refs over \"follows-from\" refs as \"parent\"\n+      const parentCtx = parent && parent.referencedContext();\n+      if (parentCtx) {\n+        // with newer zipkin version switch to:","path":"src/index.js","position":68,"original_position":68,"commit_id":"b2d708ef1e45f74b2a335804f5c01ee25dac3b01","original_commit_id":"b2d708ef1e45f74b2a335804f5c01ee25dac3b01","user":{"login":"Kosta-Github","id":2526664,"node_id":"MDQ6VXNlcjI1MjY2NjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2526664?v=4","gravatar_id":"","url":"https://api.github.com/users/Kosta-Github","html_url":"https://github.com/Kosta-Github","followers_url":"https://api.github.com/users/Kosta-Github/followers","following_url":"https://api.github.com/users/Kosta-Github/following{/other_user}","gists_url":"https://api.github.com/users/Kosta-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/Kosta-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kosta-Github/subscriptions","organizations_url":"https://api.github.com/users/Kosta-Github/orgs","repos_url":"https://api.github.com/users/Kosta-Github/repos","events_url":"https://api.github.com/users/Kosta-Github/events{/privacy}","received_events_url":"https://api.github.com/users/Kosta-Github/received_events","type":"User","site_admin":false},"body":"the passed-in `references` array (which gets partly constructed or enhanced here: https://github.com/opentracing/opentracing-javascript/blob/d2c1c6a5a50439bd769d02c7f4638293db40140a/src/tracer.ts#L81-L92) can contain references to `child-of` relationships and to `follows-from` relationships.\r\nIMHO, `child-of` is a better fit for a `parent` here and should be used if present; if it is not present a `follows-from` relationship should be used as `parent`...","created_at":"2018-10-15T08:08:25Z","updated_at":"2018-10-15T08:08:25Z","html_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing/pull/79#discussion_r225071638","pull_request_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/comments/225071638"},"html":{"href":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing/pull/79#discussion_r225071638"},"pull_request":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79"}},"in_reply_to_id":225068538},"pull_request":{"url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79","id":222806659,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyODA2NjU5","html_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing/pull/79","diff_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing/pull/79.diff","patch_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing/pull/79.patch","issue_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues/79","number":79,"state":"open","locked":false,"title":"use inheritance from `OpenTracing` base classes","user":{"login":"Kosta-Github","id":2526664,"node_id":"MDQ6VXNlcjI1MjY2NjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2526664?v=4","gravatar_id":"","url":"https://api.github.com/users/Kosta-Github","html_url":"https://github.com/Kosta-Github","followers_url":"https://api.github.com/users/Kosta-Github/followers","following_url":"https://api.github.com/users/Kosta-Github/following{/other_user}","gists_url":"https://api.github.com/users/Kosta-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/Kosta-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kosta-Github/subscriptions","organizations_url":"https://api.github.com/users/Kosta-Github/orgs","repos_url":"https://api.github.com/users/Kosta-Github/repos","events_url":"https://api.github.com/users/Kosta-Github/events{/privacy}","received_events_url":"https://api.github.com/users/Kosta-Github/received_events","type":"User","site_admin":false},"body":"Use proper inheritance from the `OpenTracing` base classes for `Span` and `Tracer` as indicated here: https://github.com/opentracing/opentracing-javascript#opentracing-tracer-implementations\r\n\r\nThe major change is the usage of `TraceId` as a `span context` which is returned from `Tracer.extract()` instead of a `span`. The unit tests have been adjusted accordingly. And the implementation have been simplified by this.\r\n\r\nSince I don't know much about the `zipkin` protocol itself, I was not able to fill in some reasonable implementations for the `baggage` feature of `OpenTracing`.","created_at":"2018-10-15T07:30:10Z","updated_at":"2018-10-15T08:08:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"213930fbeb85e0c8969694253302dc74ab0640db","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79/commits","review_comments_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79/comments","review_comment_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues/79/comments","statuses_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/statuses/b2d708ef1e45f74b2a335804f5c01ee25dac3b01","head":{"label":"Kosta-Github:opentracing-inheritance","ref":"opentracing-inheritance","sha":"b2d708ef1e45f74b2a335804f5c01ee25dac3b01","user":{"login":"Kosta-Github","id":2526664,"node_id":"MDQ6VXNlcjI1MjY2NjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2526664?v=4","gravatar_id":"","url":"https://api.github.com/users/Kosta-Github","html_url":"https://github.com/Kosta-Github","followers_url":"https://api.github.com/users/Kosta-Github/followers","following_url":"https://api.github.com/users/Kosta-Github/following{/other_user}","gists_url":"https://api.github.com/users/Kosta-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/Kosta-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kosta-Github/subscriptions","organizations_url":"https://api.github.com/users/Kosta-Github/orgs","repos_url":"https://api.github.com/users/Kosta-Github/repos","events_url":"https://api.github.com/users/Kosta-Github/events{/privacy}","received_events_url":"https://api.github.com/users/Kosta-Github/received_events","type":"User","site_admin":false},"repo":{"id":153068351,"node_id":"MDEwOlJlcG9zaXRvcnkxNTMwNjgzNTE=","name":"zipkin-javascript-opentracing","full_name":"Kosta-Github/zipkin-javascript-opentracing","private":false,"owner":{"login":"Kosta-Github","id":2526664,"node_id":"MDQ6VXNlcjI1MjY2NjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2526664?v=4","gravatar_id":"","url":"https://api.github.com/users/Kosta-Github","html_url":"https://github.com/Kosta-Github","followers_url":"https://api.github.com/users/Kosta-Github/followers","following_url":"https://api.github.com/users/Kosta-Github/following{/other_user}","gists_url":"https://api.github.com/users/Kosta-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/Kosta-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kosta-Github/subscriptions","organizations_url":"https://api.github.com/users/Kosta-Github/orgs","repos_url":"https://api.github.com/users/Kosta-Github/repos","events_url":"https://api.github.com/users/Kosta-Github/events{/privacy}","received_events_url":"https://api.github.com/users/Kosta-Github/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Kosta-Github/zipkin-javascript-opentracing","description":"Opentracing implementation for Zipkin in Javascript","fork":true,"url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing","forks_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/forks","keys_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/teams","hooks_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/hooks","issue_events_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/issues/events{/number}","events_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/events","assignees_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/assignees{/user}","branches_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/branches{/branch}","tags_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/tags","blobs_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/statuses/{sha}","languages_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/languages","stargazers_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/stargazers","contributors_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/contributors","subscribers_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/subscribers","subscription_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/subscription","commits_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/contents/{+path}","compare_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/merges","archive_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/downloads","issues_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/issues{/number}","pulls_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/pulls{/number}","milestones_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/milestones{/number}","notifications_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/labels{/name}","releases_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/releases{/id}","deployments_url":"https://api.github.com/repos/Kosta-Github/zipkin-javascript-opentracing/deployments","created_at":"2018-10-15T07:09:47Z","updated_at":"2018-10-15T07:09:49Z","pushed_at":"2018-10-15T07:29:51Z","git_url":"git://github.com/Kosta-Github/zipkin-javascript-opentracing.git","ssh_url":"git@github.com:Kosta-Github/zipkin-javascript-opentracing.git","clone_url":"https://github.com/Kosta-Github/zipkin-javascript-opentracing.git","svn_url":"https://github.com/Kosta-Github/zipkin-javascript-opentracing","homepage":"","size":1095,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DanielMSchmidt:master","ref":"master","sha":"ee2b64e2dbec1abf1db76d5ab622820af0ac17e7","user":{"login":"DanielMSchmidt","id":1337046,"node_id":"MDQ6VXNlcjEzMzcwNDY=","avatar_url":"https://avatars2.githubusercontent.com/u/1337046?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielMSchmidt","html_url":"https://github.com/DanielMSchmidt","followers_url":"https://api.github.com/users/DanielMSchmidt/followers","following_url":"https://api.github.com/users/DanielMSchmidt/following{/other_user}","gists_url":"https://api.github.com/users/DanielMSchmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielMSchmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielMSchmidt/subscriptions","organizations_url":"https://api.github.com/users/DanielMSchmidt/orgs","repos_url":"https://api.github.com/users/DanielMSchmidt/repos","events_url":"https://api.github.com/users/DanielMSchmidt/events{/privacy}","received_events_url":"https://api.github.com/users/DanielMSchmidt/received_events","type":"User","site_admin":false},"repo":{"id":108824309,"node_id":"MDEwOlJlcG9zaXRvcnkxMDg4MjQzMDk=","name":"zipkin-javascript-opentracing","full_name":"DanielMSchmidt/zipkin-javascript-opentracing","private":false,"owner":{"login":"DanielMSchmidt","id":1337046,"node_id":"MDQ6VXNlcjEzMzcwNDY=","avatar_url":"https://avatars2.githubusercontent.com/u/1337046?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielMSchmidt","html_url":"https://github.com/DanielMSchmidt","followers_url":"https://api.github.com/users/DanielMSchmidt/followers","following_url":"https://api.github.com/users/DanielMSchmidt/following{/other_user}","gists_url":"https://api.github.com/users/DanielMSchmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielMSchmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielMSchmidt/subscriptions","organizations_url":"https://api.github.com/users/DanielMSchmidt/orgs","repos_url":"https://api.github.com/users/DanielMSchmidt/repos","events_url":"https://api.github.com/users/DanielMSchmidt/events{/privacy}","received_events_url":"https://api.github.com/users/DanielMSchmidt/received_events","type":"User","site_admin":false},"html_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing","description":"Opentracing implementation for Zipkin in Javascript","fork":false,"url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing","forks_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/forks","keys_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/teams","hooks_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/hooks","issue_events_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues/events{/number}","events_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/events","assignees_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/assignees{/user}","branches_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/branches{/branch}","tags_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/tags","blobs_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/git/refs{/sha}","trees_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/statuses/{sha}","languages_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/languages","stargazers_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/stargazers","contributors_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/contributors","subscribers_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/subscribers","subscription_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/subscription","commits_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/commits{/sha}","git_commits_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/git/commits{/sha}","comments_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/comments{/number}","issue_comment_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues/comments{/number}","contents_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/contents/{+path}","compare_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/merges","archive_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/downloads","issues_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues{/number}","pulls_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls{/number}","milestones_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/milestones{/number}","notifications_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/labels{/name}","releases_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/releases{/id}","deployments_url":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/deployments","created_at":"2017-10-30T08:46:17Z","updated_at":"2018-10-14T04:30:08Z","pushed_at":"2018-10-15T07:30:11Z","git_url":"git://github.com/DanielMSchmidt/zipkin-javascript-opentracing.git","ssh_url":"git@github.com:DanielMSchmidt/zipkin-javascript-opentracing.git","clone_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing.git","svn_url":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing","homepage":"","size":1095,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":30,"license":null,"forks":7,"open_issues":30,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79"},"html":{"href":"https://github.com/DanielMSchmidt/zipkin-javascript-opentracing/pull/79"},"issue":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues/79"},"comments":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/issues/79/comments"},"review_comments":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79/comments"},"review_comment":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/pulls/79/commits"},"statuses":{"href":"https://api.github.com/repos/DanielMSchmidt/zipkin-javascript-opentracing/statuses/b2d708ef1e45f74b2a335804f5c01ee25dac3b01"}},"author_association":"NONE"}}
{"actor":{"display_login":"Kosta-Github"}}