{"action":"created","comment":{"url":"https://api.github.com/repos/ipfs/go-log/pulls/comments/175974169","pull_request_review_id":105595231,"id":175974169,"diff_hunk":"@@ -80,6 +100,122 @@ type eventLogger struct {\n \t// TODO add log-level\n }\n \n+type activeSpanKeyType struct{}\n+\n+var activeSpanKey = activeSpanKeyType{}\n+\n+type activeSpan struct {\n+\tisFinished bool\n+}\n+\n+func (el *eventLogger) Start(ctx context.Context, name string) context.Context {\n+\tel.Event(ctx, name, LoggableMap{\"system\": el.system})","path":"log.go","position":57,"original_position":57,"commit_id":"19658fdd3c2bac18057cae22a84b1bbcb1d4c2a8","original_commit_id":"19658fdd3c2bac18057cae22a84b1bbcb1d4c2a8","user":{"login":"frrist","id":6546409,"avatar_url":"https://avatars1.githubusercontent.com/u/6546409?v=4","gravatar_id":"","url":"https://api.github.com/users/frrist","html_url":"https://github.com/frrist","followers_url":"https://api.github.com/users/frrist/followers","following_url":"https://api.github.com/users/frrist/following{/other_user}","gists_url":"https://api.github.com/users/frrist/gists{/gist_id}","starred_url":"https://api.github.com/users/frrist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frrist/subscriptions","organizations_url":"https://api.github.com/users/frrist/orgs","repos_url":"https://api.github.com/users/frrist/repos","events_url":"https://api.github.com/users/frrist/events{/privacy}","received_events_url":"https://api.github.com/users/frrist/received_events","type":"User","site_admin":false},"body":"yup, sorry missed this..","created_at":"2018-03-21T02:37:44Z","updated_at":"2018-03-21T02:37:44Z","html_url":"https://github.com/ipfs/go-log/pull/20#discussion_r175974169","pull_request_url":"https://api.github.com/repos/ipfs/go-log/pulls/20","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-log/pulls/comments/175974169"},"html":{"href":"https://github.com/ipfs/go-log/pull/20#discussion_r175974169"},"pull_request":{"href":"https://api.github.com/repos/ipfs/go-log/pulls/20"}},"in_reply_to_id":175862422},"pull_request":{"url":"https://api.github.com/repos/ipfs/go-log/pulls/20","id":173248638,"html_url":"https://github.com/ipfs/go-log/pull/20","diff_url":"https://github.com/ipfs/go-log/pull/20.diff","patch_url":"https://github.com/ipfs/go-log/pull/20.patch","issue_url":"https://api.github.com/repos/ipfs/go-log/issues/20","number":20,"state":"open","locked":false,"title":"Add loggabletracer and record using the MirrorWriter ","user":{"login":"frrist","id":6546409,"avatar_url":"https://avatars1.githubusercontent.com/u/6546409?v=4","gravatar_id":"","url":"https://api.github.com/users/frrist","html_url":"https://github.com/frrist","followers_url":"https://api.github.com/users/frrist/followers","following_url":"https://api.github.com/users/frrist/following{/other_user}","gists_url":"https://api.github.com/users/frrist/gists{/gist_id}","starred_url":"https://api.github.com/users/frrist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frrist/subscriptions","organizations_url":"https://api.github.com/users/frrist/orgs","repos_url":"https://api.github.com/users/frrist/repos","events_url":"https://api.github.com/users/frrist/events{/privacy}","received_events_url":"https://api.github.com/users/frrist/received_events","type":"User","site_admin":false},"body":"The standard logger has been extended with new methods to make interacting with open tracing easier. If we like this approach I propose we deprecate the `Event`, `EventBegin` and `EventBeginInContext` methods in favor of the new methods added [here](https://github.com/ipfs/go-log/pull/20/files#diff-308aaa719425f4333033c97cfb3b9868R66).\r\n\r\nA **tracer** sub-package has been added that is a trimmed down version of [opentracing/basictracer](https://github.com/opentracing/basictracer-go). Its only purpose, besides implementing the required OT interfaces, is to [records the generated span data](https://github.com/ipfs/go-log/pull/20/files#diff-29c0b0d10e076a778e372b9752ae0d87R47) to to the `MirrorWriter`. This allows tracing data to be viewed on the `ipfs log tail` endpoint as json, however the format is slightly different:\r\n```sh\r\n{\r\n  \"Operation\": \"findPeerSingle\",\r\n  \"Start\": \"2018-03-13T15:18:20.759370995-07:00\",\r\n  \"Duration\": 450241300,\r\n  \"Tags\": {\r\n    \"component\": \"dht\"\r\n  },\r\n  \"Logs\": [\r\n    {\r\n      \"Timestamp\": \"2018-03-13T15:18:21.209603661-07:00\",\r\n      \"Fields\": [\r\n        {\r\n          \"Key\": \"peerID\",\r\n          \"Value\": \"QmSPzuyxRWUy6uDEF5MmvScPCYJfQ3xEqfUsBAcLhWKPtK\"\r\n        }\r\n      ]\r\n    },\r\n    {\r\n      \"Timestamp\": \"2018-03-13T15:18:21.209609422-07:00\",\r\n      \"Fields\": [\r\n        {\r\n          \"Key\": \"peerID\",\r\n          \"Value\": \"QmRAPRT595v2E4wuaTK1hgVQQmjsg6m7yFXA9f51v6AKux\"\r\n        }\r\n      ]\r\n    },\r\n    {\r\n      \"Timestamp\": \"2018-03-13T15:18:21.20961084-07:00\",\r\n      \"Fields\": [\r\n        {\r\n          \"Key\": \"duration\",\r\n          \"Value\": \"450.22026ms\"\r\n        }\r\n      ]\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nThe events generated by `Event`, `EventBegin`, and `EventBeginInContext` will remain unchanged, and are still viewable on the `ipfs log tail` end point. \r\n**Note** There will be 2 different event log formats on this endpoint, the original format from `Event*` methods, and the format shown above.\r\n\r\nThe new methods allow Event logs to be instrumented like:\r\n```go\r\n...\r\nctx = log.Start(ctx, \"EventHappened\") //start an event\r\nctx = log.SetTag(ctx, \"Buzz\", \"Bizz\") //Something like an http method or command name\r\n...\r\nif err != nil {\r\n   log.SetError(ctx, err) //tag the event with \"error=true\" and log the error\r\n}\r\n...\r\nlog.LogKV(ctx, \"Foor\", \"Bar\") // Similar to how `Event` was used\r\n...\r\nlog.Finish(ctx) //finish the event\r\n```\r\n\r\nThe `StartFromParentState` method is used when passing trace context across ipfs nodes. (Essentially a span context is serialized to bytes, put in a protobuf, like the ones used by the dht for example with an added optional field, and then deserialized by the receiving node) This could be useful for ipfs-cluster or a testnet when all the nodes are connected to the same tracer (like jaeger).\r\n\r\n\r\nTODO\r\n\r\n- [ ] import file history from opentracing/basictracer and add licence","created_at":"2018-03-06T18:51:52Z","updated_at":"2018-03-21T02:37:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a68660d52c8a7eb2fd55ec97f5d6cff8ba9e7e06","assignee":{"login":"frrist","id":6546409,"avatar_url":"https://avatars1.githubusercontent.com/u/6546409?v=4","gravatar_id":"","url":"https://api.github.com/users/frrist","html_url":"https://github.com/frrist","followers_url":"https://api.github.com/users/frrist/followers","following_url":"https://api.github.com/users/frrist/following{/other_user}","gists_url":"https://api.github.com/users/frrist/gists{/gist_id}","starred_url":"https://api.github.com/users/frrist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frrist/subscriptions","organizations_url":"https://api.github.com/users/frrist/orgs","repos_url":"https://api.github.com/users/frrist/repos","events_url":"https://api.github.com/users/frrist/events{/privacy}","received_events_url":"https://api.github.com/users/frrist/received_events","type":"User","site_admin":false},"assignees":[{"login":"frrist","id":6546409,"avatar_url":"https://avatars1.githubusercontent.com/u/6546409?v=4","gravatar_id":"","url":"https://api.github.com/users/frrist","html_url":"https://github.com/frrist","followers_url":"https://api.github.com/users/frrist/followers","following_url":"https://api.github.com/users/frrist/following{/other_user}","gists_url":"https://api.github.com/users/frrist/gists{/gist_id}","starred_url":"https://api.github.com/users/frrist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frrist/subscriptions","organizations_url":"https://api.github.com/users/frrist/orgs","repos_url":"https://api.github.com/users/frrist/repos","events_url":"https://api.github.com/users/frrist/events{/privacy}","received_events_url":"https://api.github.com/users/frrist/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":562208267,"url":"https://api.github.com/repos/ipfs/go-log/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/go-log/pulls/20/commits","review_comments_url":"https://api.github.com/repos/ipfs/go-log/pulls/20/comments","review_comment_url":"https://api.github.com/repos/ipfs/go-log/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/go-log/issues/20/comments","statuses_url":"https://api.github.com/repos/ipfs/go-log/statuses/19658fdd3c2bac18057cae22a84b1bbcb1d4c2a8","head":{"label":"ipfs:feat/newEventType","ref":"feat/newEventType","sha":"19658fdd3c2bac18057cae22a84b1bbcb1d4c2a8","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":42484122,"name":"go-log","full_name":"ipfs/go-log","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-log","description":"A logging library used by go-ipfs","fork":false,"url":"https://api.github.com/repos/ipfs/go-log","forks_url":"https://api.github.com/repos/ipfs/go-log/forks","keys_url":"https://api.github.com/repos/ipfs/go-log/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-log/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-log/teams","hooks_url":"https://api.github.com/repos/ipfs/go-log/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-log/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-log/events","assignees_url":"https://api.github.com/repos/ipfs/go-log/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-log/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-log/tags","blobs_url":"https://api.github.com/repos/ipfs/go-log/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-log/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-log/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-log/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-log/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-log/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-log/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-log/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-log/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-log/subscription","commits_url":"https://api.github.com/repos/ipfs/go-log/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-log/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-log/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-log/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-log/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-log/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-log/merges","archive_url":"https://api.github.com/repos/ipfs/go-log/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-log/downloads","issues_url":"https://api.github.com/repos/ipfs/go-log/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-log/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-log/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-log/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-log/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-log/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-log/deployments","created_at":"2015-09-15T00:04:46Z","updated_at":"2018-03-19T04:19:54Z","pushed_at":"2018-03-17T20:30:42Z","git_url":"git://github.com/ipfs/go-log.git","ssh_url":"git@github.com:ipfs/go-log.git","clone_url":"https://github.com/ipfs/go-log.git","svn_url":"https://github.com/ipfs/go-log","homepage":null,"size":76,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":9,"open_issues":3,"watchers":5,"default_branch":"master"}},"base":{"label":"ipfs:master","ref":"master","sha":"0e2a17b81af445147a78d94a45d4398c4008c219","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":42484122,"name":"go-log","full_name":"ipfs/go-log","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars0.githubusercontent.com/u/10536621?v=4","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-log","description":"A logging library used by go-ipfs","fork":false,"url":"https://api.github.com/repos/ipfs/go-log","forks_url":"https://api.github.com/repos/ipfs/go-log/forks","keys_url":"https://api.github.com/repos/ipfs/go-log/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-log/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-log/teams","hooks_url":"https://api.github.com/repos/ipfs/go-log/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-log/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-log/events","assignees_url":"https://api.github.com/repos/ipfs/go-log/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-log/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-log/tags","blobs_url":"https://api.github.com/repos/ipfs/go-log/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-log/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-log/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-log/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-log/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-log/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-log/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-log/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-log/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-log/subscription","commits_url":"https://api.github.com/repos/ipfs/go-log/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-log/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-log/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-log/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-log/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-log/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-log/merges","archive_url":"https://api.github.com/repos/ipfs/go-log/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-log/downloads","issues_url":"https://api.github.com/repos/ipfs/go-log/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-log/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-log/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-log/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-log/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-log/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-log/deployments","created_at":"2015-09-15T00:04:46Z","updated_at":"2018-03-19T04:19:54Z","pushed_at":"2018-03-17T20:30:42Z","git_url":"git://github.com/ipfs/go-log.git","ssh_url":"git@github.com:ipfs/go-log.git","clone_url":"https://github.com/ipfs/go-log.git","svn_url":"https://github.com/ipfs/go-log","homepage":null,"size":76,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":9,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-log/pulls/20"},"html":{"href":"https://github.com/ipfs/go-log/pull/20"},"issue":{"href":"https://api.github.com/repos/ipfs/go-log/issues/20"},"comments":{"href":"https://api.github.com/repos/ipfs/go-log/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/go-log/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/go-log/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/go-log/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/go-log/statuses/19658fdd3c2bac18057cae22a84b1bbcb1d4c2a8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"frrist"}}