{"action":"created","comment":{"url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/comments/85731254","pull_request_review_id":6428872,"id":85731254,"diff_hunk":"@@ -0,0 +1,95 @@\n+/*\n+ * Copyright 2015-2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+'use strict'\n+\n+const http = require('http');\n+const dispatcher = require('httpdispatcher');\n+\n+const opentracing = require('opentracing');\n+const hawkularAPM = require('../index');\n+\n+opentracing.initGlobalTracer(new hawkularAPM.APMTracer());\n+const span = opentracing.globalTracer().startSpan('printUserInfo');\n+\n+const SERVER_PORT = 9000;\n+\n+// Hello handler\n+dispatcher.onGet(\"/hello\", function(req, res) {\n+    const serverSpan = opentracing.globalTracer().startSpan('hello');\n+    res.writeHead(200);\n+    res.end('Hello from Node.js!');\n+    span.finish();\n+});\n+\n+dispatcher.onGet(\"/a\", function(req, res) {\n+    const serverSpan = opentracing.globalTracer().startSpan('a');\n+    serverSpan.setTag('span.kind', 'server');\n+\n+    const clientSpan = opentracing.globalTracer().startSpan('b', {\n+        childOf: serverSpan ,\n+        tags: {\n+            'span.kind': 'client',\n+        }});\n+    http.get({\n+        host: 'localhost',\n+        port: SERVER_PORT,\n+        path: '/b',\n+        headers: createCarrier(opentracing.globalTracer(), clientSpan),\n+        }, function (response) {\n+    });\n+    clientSpan.finish();\n+\n+    res.writeHead(200);\n+    res.end('/a');\n+    serverSpan.finish();\n+});\n+\n+dispatcher.onGet(\"/b\", function(req, res) {\n+    // TODO log something and report to the server\n+    const clientSpan = extractSpanContext(opentracing.globalTracer(), req.headers);\n+    res.writeHead(200);\n+    res.end('Hello from Node.js!');\n+});\n+\n+function createCarrier(tracer, span) {\n+    const carrier = {};\n+    tracer.inject(span, opentracing.FORMAT_HTTP_HEADERS, carrier);\n+    return carrier;\n+}\n+\n+function extractSpanContext(tracer, httpHeaders) {\n+    return tracer.extract(opentracing.FORMAT_HTTP_HEADERS, httpHeaders);","path":"examples/index.js","position":null,"original_position":76,"commit_id":"cd78c22f6fba28c92d1a4da83450d86a9276f92c","original_commit_id":"6acc8769c003facbe988b29ca37a58ae4002768d","user":{"login":"pavolloffay","id":5618424,"avatar_url":"https://avatars.githubusercontent.com/u/5618424?v=3","gravatar_id":"","url":"https://api.github.com/users/pavolloffay","html_url":"https://github.com/pavolloffay","followers_url":"https://api.github.com/users/pavolloffay/followers","following_url":"https://api.github.com/users/pavolloffay/following{/other_user}","gists_url":"https://api.github.com/users/pavolloffay/gists{/gist_id}","starred_url":"https://api.github.com/users/pavolloffay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavolloffay/subscriptions","organizations_url":"https://api.github.com/users/pavolloffay/orgs","repos_url":"https://api.github.com/users/pavolloffay/repos","events_url":"https://api.github.com/users/pavolloffay/events{/privacy}","received_events_url":"https://api.github.com/users/pavolloffay/received_events","type":"User","site_admin":false},"body":"Interesting is that in code samples there is often used `opentracing.Format.HTTP_HEADERS`. I'm changing it to TEXT_MAP finally.","created_at":"2016-10-31T12:48:24Z","updated_at":"2016-10-31T12:48:24Z","html_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript/pull/3#discussion_r85731254","pull_request_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/comments/85731254"},"html":{"href":"https://github.com/hawkular/hawkular-apm-opentracing-javascript/pull/3#discussion_r85731254"},"pull_request":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3","id":91403282,"html_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript/pull/3","diff_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript/pull/3.diff","patch_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript/pull/3.patch","issue_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues/3","number":3,"state":"open","locked":false,"title":"HWKAPM-704 | Basic OpenTracing implementation","user":{"login":"pavolloffay","id":5618424,"avatar_url":"https://avatars.githubusercontent.com/u/5618424?v=3","gravatar_id":"","url":"https://api.github.com/users/pavolloffay","html_url":"https://github.com/pavolloffay","followers_url":"https://api.github.com/users/pavolloffay/followers","following_url":"https://api.github.com/users/pavolloffay/following{/other_user}","gists_url":"https://api.github.com/users/pavolloffay/gists{/gist_id}","starred_url":"https://api.github.com/users/pavolloffay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavolloffay/subscriptions","organizations_url":"https://api.github.com/users/pavolloffay/orgs","repos_url":"https://api.github.com/users/pavolloffay/repos","events_url":"https://api.github.com/users/pavolloffay/events{/privacy}","received_events_url":"https://api.github.com/users/pavolloffay/received_events","type":"User","site_admin":false},"body":"https://issues.jboss.org/browse/HWKAPM-704\r\n\r\nBasic OpenTracing implementation with console recorder.","created_at":"2016-10-28T15:35:32Z","updated_at":"2016-10-31T12:48:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2a3fa72b3a63a7fde0a0cc411d2767305e630b3e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3/commits","review_comments_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3/comments","review_comment_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues/3/comments","statuses_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/statuses/cd78c22f6fba28c92d1a4da83450d86a9276f92c","head":{"label":"pavolloffay:tracer-impl","ref":"tracer-impl","sha":"cd78c22f6fba28c92d1a4da83450d86a9276f92c","user":{"login":"pavolloffay","id":5618424,"avatar_url":"https://avatars.githubusercontent.com/u/5618424?v=3","gravatar_id":"","url":"https://api.github.com/users/pavolloffay","html_url":"https://github.com/pavolloffay","followers_url":"https://api.github.com/users/pavolloffay/followers","following_url":"https://api.github.com/users/pavolloffay/following{/other_user}","gists_url":"https://api.github.com/users/pavolloffay/gists{/gist_id}","starred_url":"https://api.github.com/users/pavolloffay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavolloffay/subscriptions","organizations_url":"https://api.github.com/users/pavolloffay/orgs","repos_url":"https://api.github.com/users/pavolloffay/repos","events_url":"https://api.github.com/users/pavolloffay/events{/privacy}","received_events_url":"https://api.github.com/users/pavolloffay/received_events","type":"User","site_admin":false},"repo":{"id":71373721,"name":"hawkular-apm-opentracing-javascript","full_name":"pavolloffay/hawkular-apm-opentracing-javascript","owner":{"login":"pavolloffay","id":5618424,"avatar_url":"https://avatars.githubusercontent.com/u/5618424?v=3","gravatar_id":"","url":"https://api.github.com/users/pavolloffay","html_url":"https://github.com/pavolloffay","followers_url":"https://api.github.com/users/pavolloffay/followers","following_url":"https://api.github.com/users/pavolloffay/following{/other_user}","gists_url":"https://api.github.com/users/pavolloffay/gists{/gist_id}","starred_url":"https://api.github.com/users/pavolloffay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavolloffay/subscriptions","organizations_url":"https://api.github.com/users/pavolloffay/orgs","repos_url":"https://api.github.com/users/pavolloffay/repos","events_url":"https://api.github.com/users/pavolloffay/events{/privacy}","received_events_url":"https://api.github.com/users/pavolloffay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pavolloffay/hawkular-apm-opentracing-javascript","description":null,"fork":true,"url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript","forks_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/forks","keys_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/teams","hooks_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/hooks","issue_events_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/issues/events{/number}","events_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/events","assignees_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/assignees{/user}","branches_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/branches{/branch}","tags_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/tags","blobs_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/git/refs{/sha}","trees_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/statuses/{sha}","languages_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/languages","stargazers_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/stargazers","contributors_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/contributors","subscribers_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/subscribers","subscription_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/subscription","commits_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/commits{/sha}","git_commits_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/git/commits{/sha}","comments_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/comments{/number}","issue_comment_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/issues/comments{/number}","contents_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/contents/{+path}","compare_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/merges","archive_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/downloads","issues_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/issues{/number}","pulls_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/pulls{/number}","milestones_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/milestones{/number}","notifications_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/labels{/name}","releases_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/releases{/id}","deployments_url":"https://api.github.com/repos/pavolloffay/hawkular-apm-opentracing-javascript/deployments","created_at":"2016-10-19T15:50:43Z","updated_at":"2016-10-19T15:35:57Z","pushed_at":"2016-10-31T12:33:16Z","git_url":"git://github.com/pavolloffay/hawkular-apm-opentracing-javascript.git","ssh_url":"git@github.com:pavolloffay/hawkular-apm-opentracing-javascript.git","clone_url":"https://github.com/pavolloffay/hawkular-apm-opentracing-javascript.git","svn_url":"https://github.com/pavolloffay/hawkular-apm-opentracing-javascript","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hawkular:master","ref":"master","sha":"20be4cbec82510a44f0d60fceccb10e09368f12f","user":{"login":"hawkular","id":10179627,"avatar_url":"https://avatars.githubusercontent.com/u/10179627?v=3","gravatar_id":"","url":"https://api.github.com/users/hawkular","html_url":"https://github.com/hawkular","followers_url":"https://api.github.com/users/hawkular/followers","following_url":"https://api.github.com/users/hawkular/following{/other_user}","gists_url":"https://api.github.com/users/hawkular/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkular/subscriptions","organizations_url":"https://api.github.com/users/hawkular/orgs","repos_url":"https://api.github.com/users/hawkular/repos","events_url":"https://api.github.com/users/hawkular/events{/privacy}","received_events_url":"https://api.github.com/users/hawkular/received_events","type":"Organization","site_admin":false},"repo":{"id":71372354,"name":"hawkular-apm-opentracing-javascript","full_name":"hawkular/hawkular-apm-opentracing-javascript","owner":{"login":"hawkular","id":10179627,"avatar_url":"https://avatars.githubusercontent.com/u/10179627?v=3","gravatar_id":"","url":"https://api.github.com/users/hawkular","html_url":"https://github.com/hawkular","followers_url":"https://api.github.com/users/hawkular/followers","following_url":"https://api.github.com/users/hawkular/following{/other_user}","gists_url":"https://api.github.com/users/hawkular/gists{/gist_id}","starred_url":"https://api.github.com/users/hawkular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawkular/subscriptions","organizations_url":"https://api.github.com/users/hawkular/orgs","repos_url":"https://api.github.com/users/hawkular/repos","events_url":"https://api.github.com/users/hawkular/events{/privacy}","received_events_url":"https://api.github.com/users/hawkular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript","description":"Hawkular-APM OpenTracing JavaScript Implementation","fork":false,"url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript","forks_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/forks","keys_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/teams","hooks_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/hooks","issue_events_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues/events{/number}","events_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/events","assignees_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/assignees{/user}","branches_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/branches{/branch}","tags_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/tags","blobs_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/git/refs{/sha}","trees_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/statuses/{sha}","languages_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/languages","stargazers_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/stargazers","contributors_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/contributors","subscribers_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/subscribers","subscription_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/subscription","commits_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/commits{/sha}","git_commits_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/git/commits{/sha}","comments_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/comments{/number}","issue_comment_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues/comments{/number}","contents_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/contents/{+path}","compare_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/merges","archive_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/downloads","issues_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues{/number}","pulls_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls{/number}","milestones_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/milestones{/number}","notifications_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/labels{/name}","releases_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/releases{/id}","deployments_url":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/deployments","created_at":"2016-10-19T15:35:48Z","updated_at":"2016-10-20T15:39:35Z","pushed_at":"2016-10-31T12:33:17Z","git_url":"git://github.com/hawkular/hawkular-apm-opentracing-javascript.git","ssh_url":"git@github.com:hawkular/hawkular-apm-opentracing-javascript.git","clone_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript.git","svn_url":"https://github.com/hawkular/hawkular-apm-opentracing-javascript","homepage":"","size":8,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3"},"html":{"href":"https://github.com/hawkular/hawkular-apm-opentracing-javascript/pull/3"},"issue":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues/3"},"comments":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/hawkular/hawkular-apm-opentracing-javascript/statuses/cd78c22f6fba28c92d1a4da83450d86a9276f92c"}}}}
{"actor":{"display_login":"pavolloffay"}}