{"action":"created","comment":{"url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/comments/46371485","id":46371485,"diff_hunk":"@@ -0,0 +1,132 @@\n+package tracer\n+\n+import (\n+\t\"fmt\"\n+\t\"time\"\n+\n+\t\"sourcegraph.com/sourcegraph/appdash\"\n+\t\"sourcegraph.com/sourcegraph/go-vcs/vcs\"\n+)\n+\n+func init() { appdash.RegisterEvent(GoVCS{}) }\n+\n+// GoVCS records a go-vcs method invocation.\n+type GoVCS struct {\n+\tName, Args string\n+\n+\tStartTime time.Time\n+\tEndTime   time.Time\n+}\n+\n+// Schema returns the constant \"GoVCS\".\n+func (GoVCS) Schema() string { return \"GoVCS\" }\n+\n+func (e GoVCS) Start() time.Time { return e.StartTime }\n+func (e GoVCS) End() time.Time   { return e.EndTime }\n+\n+// Wrap wraps the given VCS repository, returning a repository which emits\n+// tracing events.\n+func Wrap(r vcs.Repository, rec *appdash.Recorder) vcs.Repository {\n+\t// Wrap the repository.\n+\tt := repository{r: r, rec: rec}\n+\n+\t// Also wrap optional interface.\n+\tfinal := vcs.Repository(t)\n+\tif b, ok := r.(vcs.Blamer); ok {\n+\t\tfinal = blamer{Repository: final, b: b, rec: rec}\n+\t}\n+\tif d, ok := r.(vcs.Differ); ok {\n+\t\tfinal = differ{Repository: final, d: d, rec: rec}\n+\t}\n+\tif c, ok := r.(vcs.CrossRepoDiffer); ok {\n+\t\tfinal = crossRepoDiffer{Repository: final, c: c, rec: rec}\n+\t}\n+\tif f, ok := r.(vcs.FileLister); ok {\n+\t\tfinal = fileLister{Repository: final, f: f, rec: rec}\n+\t}\n+\treturn final\n+}\n+\n+// blamer implements the vcs.Repository interface, adding a wrapped vcs.Blamer\n+// implementation.\n+type blamer struct {\n+\tvcs.Repository","path":"vcs/util/tracer/tracer.go","position":53,"original_position":53,"commit_id":"2ddb5a541ba6920ce0d1b7a168ccaed60f70b013","original_commit_id":"2ddb5a541ba6920ce0d1b7a168ccaed60f70b013","user":{"login":"beyang","id":1646931,"avatar_url":"https://avatars.githubusercontent.com/u/1646931?v=3","gravatar_id":"","url":"https://api.github.com/users/beyang","html_url":"https://github.com/beyang","followers_url":"https://api.github.com/users/beyang/followers","following_url":"https://api.github.com/users/beyang/following{/other_user}","gists_url":"https://api.github.com/users/beyang/gists{/gist_id}","starred_url":"https://api.github.com/users/beyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beyang/subscriptions","organizations_url":"https://api.github.com/users/beyang/orgs","repos_url":"https://api.github.com/users/beyang/repos","events_url":"https://api.github.com/users/beyang/events{/privacy}","received_events_url":"https://api.github.com/users/beyang/received_events","type":"User","site_admin":false},"body":"and likewise for `differ`, `crossRepoDiffer` and `fileLister`?","created_at":"2015-12-02T02:40:11Z","updated_at":"2015-12-02T02:40:11Z","html_url":"https://github.com/sourcegraph/go-vcs/pull/85#discussion_r46371485","pull_request_url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/comments/46371485"},"html":{"href":"https://github.com/sourcegraph/go-vcs/pull/85#discussion_r46371485"},"pull_request":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85","id":52324577,"html_url":"https://github.com/sourcegraph/go-vcs/pull/85","diff_url":"https://github.com/sourcegraph/go-vcs/pull/85.diff","patch_url":"https://github.com/sourcegraph/go-vcs/pull/85.patch","issue_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues/85","number":85,"state":"open","locked":false,"title":"vcs/util/tracer: add a utility package for recording VCS operations to Appdash","user":{"login":"slimsag","id":3173176,"avatar_url":"https://avatars.githubusercontent.com/u/3173176?v=3","gravatar_id":"","url":"https://api.github.com/users/slimsag","html_url":"https://github.com/slimsag","followers_url":"https://api.github.com/users/slimsag/followers","following_url":"https://api.github.com/users/slimsag/following{/other_user}","gists_url":"https://api.github.com/users/slimsag/gists{/gist_id}","starred_url":"https://api.github.com/users/slimsag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slimsag/subscriptions","organizations_url":"https://api.github.com/users/slimsag/orgs","repos_url":"https://api.github.com/users/slimsag/repos","events_url":"https://api.github.com/users/slimsag/events{/privacy}","received_events_url":"https://api.github.com/users/slimsag/received_events","type":"User","site_admin":false},"body":"This change adds a utility package which records VCS operations to an `*appdash.Recorder`\r\nby wrapping a `vcs.Repository` value. It implements the optional interface types\r\nthat a `vcs.Repository` implementation may opt-in to, so no functionality is\r\nlost. Because it works at the interface level we can trace all different\r\nbackends (`gitcmd`, `git`, `hg`, etc) without writing new tracing code.\r\n\r\nIn Appdash, all events are prefixed with `vcs.Type` for easier filtering:\r\n\r\n![screenshot](http://virtivia.com:27080/1nt70brhgfma7.png)","created_at":"2015-12-01T22:17:29Z","updated_at":"2015-12-02T02:40:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83eb8e89ffaa28e28807a4f428575bd5acf863b9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85/commits","review_comments_url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85/comments","review_comment_url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues/85/comments","statuses_url":"https://api.github.com/repos/sourcegraph/go-vcs/statuses/2ddb5a541ba6920ce0d1b7a168ccaed60f70b013","head":{"label":"sourcegraph:sg/util-tracer","ref":"sg/util-tracer","sha":"2ddb5a541ba6920ce0d1b7a168ccaed60f70b013","user":{"login":"sourcegraph","id":3979584,"avatar_url":"https://avatars.githubusercontent.com/u/3979584?v=3","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":10431493,"name":"go-vcs","full_name":"sourcegraph/go-vcs","owner":{"login":"sourcegraph","id":3979584,"avatar_url":"https://avatars.githubusercontent.com/u/3979584?v=3","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sourcegraph/go-vcs","description":"manipulate and inspect VCS repositories in Go","fork":false,"url":"https://api.github.com/repos/sourcegraph/go-vcs","forks_url":"https://api.github.com/repos/sourcegraph/go-vcs/forks","keys_url":"https://api.github.com/repos/sourcegraph/go-vcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/go-vcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/go-vcs/teams","hooks_url":"https://api.github.com/repos/sourcegraph/go-vcs/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/go-vcs/events","assignees_url":"https://api.github.com/repos/sourcegraph/go-vcs/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/go-vcs/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/go-vcs/tags","blobs_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/go-vcs/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/go-vcs/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/go-vcs/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/go-vcs/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/go-vcs/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/go-vcs/subscription","commits_url":"https://api.github.com/repos/sourcegraph/go-vcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/go-vcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/go-vcs/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/go-vcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/go-vcs/merges","archive_url":"https://api.github.com/repos/sourcegraph/go-vcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/go-vcs/downloads","issues_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/go-vcs/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/go-vcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/go-vcs/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/go-vcs/releases{/id}","created_at":"2013-06-02T02:36:18Z","updated_at":"2015-11-07T03:03:47Z","pushed_at":"2015-12-01T22:43:37Z","git_url":"git://github.com/sourcegraph/go-vcs.git","ssh_url":"git@github.com:sourcegraph/go-vcs.git","clone_url":"https://github.com/sourcegraph/go-vcs.git","svn_url":"https://github.com/sourcegraph/go-vcs","homepage":"https://sourcegraph.com/sourcegraph/go-vcs","size":664,"stargazers_count":32,"watchers_count":32,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":19,"forks":11,"open_issues":19,"watchers":32,"default_branch":"master"}},"base":{"label":"sourcegraph:master","ref":"master","sha":"55e422b8c44395a6261cb70509aa66359c4af827","user":{"login":"sourcegraph","id":3979584,"avatar_url":"https://avatars.githubusercontent.com/u/3979584?v=3","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":10431493,"name":"go-vcs","full_name":"sourcegraph/go-vcs","owner":{"login":"sourcegraph","id":3979584,"avatar_url":"https://avatars.githubusercontent.com/u/3979584?v=3","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sourcegraph/go-vcs","description":"manipulate and inspect VCS repositories in Go","fork":false,"url":"https://api.github.com/repos/sourcegraph/go-vcs","forks_url":"https://api.github.com/repos/sourcegraph/go-vcs/forks","keys_url":"https://api.github.com/repos/sourcegraph/go-vcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/go-vcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/go-vcs/teams","hooks_url":"https://api.github.com/repos/sourcegraph/go-vcs/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/go-vcs/events","assignees_url":"https://api.github.com/repos/sourcegraph/go-vcs/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/go-vcs/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/go-vcs/tags","blobs_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/go-vcs/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/go-vcs/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/go-vcs/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/go-vcs/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/go-vcs/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/go-vcs/subscription","commits_url":"https://api.github.com/repos/sourcegraph/go-vcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/go-vcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/go-vcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/go-vcs/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/go-vcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/go-vcs/merges","archive_url":"https://api.github.com/repos/sourcegraph/go-vcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/go-vcs/downloads","issues_url":"https://api.github.com/repos/sourcegraph/go-vcs/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/go-vcs/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/go-vcs/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/go-vcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/go-vcs/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/go-vcs/releases{/id}","created_at":"2013-06-02T02:36:18Z","updated_at":"2015-11-07T03:03:47Z","pushed_at":"2015-12-01T22:43:37Z","git_url":"git://github.com/sourcegraph/go-vcs.git","ssh_url":"git@github.com:sourcegraph/go-vcs.git","clone_url":"https://github.com/sourcegraph/go-vcs.git","svn_url":"https://github.com/sourcegraph/go-vcs","homepage":"https://sourcegraph.com/sourcegraph/go-vcs","size":664,"stargazers_count":32,"watchers_count":32,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":19,"forks":11,"open_issues":19,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85"},"html":{"href":"https://github.com/sourcegraph/go-vcs/pull/85"},"issue":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/issues/85"},"comments":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/sourcegraph/go-vcs/statuses/2ddb5a541ba6920ce0d1b7a168ccaed60f70b013"}}}}