{"action":"created","comment":{"url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/comments/90934379","pull_request_review_id":11447781,"id":90934379,"diff_hunk":"@@ -0,0 +1,41 @@\n+package io.buoyant.router\n+\n+import com.twitter.finagle.{Filter, Path, Stack, Stackable, ServiceFactory, param}\n+import com.twitter.finagle.buoyant.Dst\n+import com.twitter.finagle.service.StatsFilter\n+import com.twitter.finagle.stats.{ExceptionStatsHandler, StatsReceiver}\n+\n+object PerDstPathStatsFilter {\n+  val role = Stack.Role(\"PerDstPathStatsFilter\")\n+\n+  def module[Req, Rsp]: Stackable[ServiceFactory[Req, Rsp]] =\n+    new Stack.Module4[param.Stats, param.ExceptionStatsHandler, param.ResponseClassifier, StatsFilter.Param, ServiceFactory[Req, Rsp]] {\n+      val role = PerDstPathStatsFilter.role\n+      val description = \"Report request statistics for each logical destination\"\n+\n+      def make(\n+        _stats: param.Stats,\n+        _exceptions: param.ExceptionStatsHandler,\n+        _classifier: param.ResponseClassifier,\n+        _unit: StatsFilter.Param,\n+        next: ServiceFactory[Req, Rsp]\n+      ): ServiceFactory[Req, Rsp] = _stats match {\n+        case param.Stats(statsReceiver) if !statsReceiver.isNull =>\n+          val param.ResponseClassifier(classifier) = _classifier\n+          val param.ExceptionStatsHandler(handler) = _exceptions\n+          val StatsFilter.Param(unit) = _unit\n+\n+          def mkScopedStatsFilter(path: Path): Filter[Req, Rsp, Req, Rsp] = {\n+            val name = path.show.stripPrefix(\"/\")\n+            val sr = statsReceiver.scope(\"dst/path\", name)","path":"router/core/src/main/scala/io/buoyant/router/PerDstPathStatsFilter.scala","position":30,"original_position":30,"commit_id":"6677027983186948cd1e550766952fdb1519e14c","original_commit_id":"6677027983186948cd1e550766952fdb1519e14c","user":{"login":"klingerf","id":9226,"avatar_url":"https://avatars.githubusercontent.com/u/9226?v=3","gravatar_id":"","url":"https://api.github.com/users/klingerf","html_url":"https://github.com/klingerf","followers_url":"https://api.github.com/users/klingerf/followers","following_url":"https://api.github.com/users/klingerf/following{/other_user}","gists_url":"https://api.github.com/users/klingerf/gists{/gist_id}","starred_url":"https://api.github.com/users/klingerf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klingerf/subscriptions","organizations_url":"https://api.github.com/users/klingerf/orgs","repos_url":"https://api.github.com/users/klingerf/repos","events_url":"https://api.github.com/users/klingerf/events{/privacy}","received_events_url":"https://api.github.com/users/klingerf/received_events","type":"User","site_admin":false},"body":"TIOLI: I have a very slight preference for scoping this as: `statsReceiver.scope(\"path\", name)` or  `statsReceiver.scope(\"dst\", \"path\", name)`, to more closely resemble the existing dst path stats.\r\n","created_at":"2016-12-05T19:13:51Z","updated_at":"2016-12-05T19:19:32Z","html_url":"https://github.com/BuoyantIO/linkerd/pull/836#discussion_r90934379","pull_request_url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836","_links":{"self":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/comments/90934379"},"html":{"href":"https://github.com/BuoyantIO/linkerd/pull/836#discussion_r90934379"},"pull_request":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836"}}},"pull_request":{"url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836","id":96413633,"html_url":"https://github.com/BuoyantIO/linkerd/pull/836","diff_url":"https://github.com/BuoyantIO/linkerd/pull/836.diff","patch_url":"https://github.com/BuoyantIO/linkerd/pull/836.patch","issue_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/836","number":836,"state":"open","locked":false,"title":"Add top-level logical service stats to each client","user":{"login":"olix0r","id":240738,"avatar_url":"https://avatars.githubusercontent.com/u/240738?v=3","gravatar_id":"","url":"https://api.github.com/users/olix0r","html_url":"https://github.com/olix0r","followers_url":"https://api.github.com/users/olix0r/followers","following_url":"https://api.github.com/users/olix0r/following{/other_user}","gists_url":"https://api.github.com/users/olix0r/gists{/gist_id}","starred_url":"https://api.github.com/users/olix0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olix0r/subscriptions","organizations_url":"https://api.github.com/users/olix0r/orgs","repos_url":"https://api.github.com/users/olix0r/repos","events_url":"https://api.github.com/users/olix0r/events{/privacy}","received_events_url":"https://api.github.com/users/olix0r/received_events","type":"User","site_admin":false},"body":"Problem\r\n\r\nCurrently linkerd exposes top-level (latency histogram, and request/success/failure counters) for both the logical ('dst/path') and concrete ('dst/id') scopes. However, these stats expose no information about which logical requests each concrete client is serving.\r\n\r\nSolution\r\n\r\nFinagle provides a 'Context' primitive for sharing i.e. request-level metadata within a processing scope, without encoding additional information in a protocol-specific request type.\r\n\r\nThis change introduces two local contexts: ctx.DstPath and ctx.DstBound. This allows for client-level filters to access routing context in a protocol-agnostic fashion.\r\n\r\nThe ctx.DstPath context is used by a new client module, `PerDstPathStatsFilter`, which annotates metrics like:\r\n\r\n- dst/id/$id/dst/path/$path/request_latency_ms...\r\n- dst/id/$id/dst/path/$path/requests\r\n- dst/id/$id/dst/path/$path/success\r\n- dst/id/$id/dst/path/$path/failures...","created_at":"2016-12-03T22:50:24Z","updated_at":"2016-12-05T19:19:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86615f2555545c994bdc105b1698956ba37b0530","assignee":{"login":"olix0r","id":240738,"avatar_url":"https://avatars.githubusercontent.com/u/240738?v=3","gravatar_id":"","url":"https://api.github.com/users/olix0r","html_url":"https://github.com/olix0r","followers_url":"https://api.github.com/users/olix0r/followers","following_url":"https://api.github.com/users/olix0r/following{/other_user}","gists_url":"https://api.github.com/users/olix0r/gists{/gist_id}","starred_url":"https://api.github.com/users/olix0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olix0r/subscriptions","organizations_url":"https://api.github.com/users/olix0r/orgs","repos_url":"https://api.github.com/users/olix0r/repos","events_url":"https://api.github.com/users/olix0r/events{/privacy}","received_events_url":"https://api.github.com/users/olix0r/received_events","type":"User","site_admin":false},"assignees":[{"login":"olix0r","id":240738,"avatar_url":"https://avatars.githubusercontent.com/u/240738?v=3","gravatar_id":"","url":"https://api.github.com/users/olix0r","html_url":"https://github.com/olix0r","followers_url":"https://api.github.com/users/olix0r/followers","following_url":"https://api.github.com/users/olix0r/following{/other_user}","gists_url":"https://api.github.com/users/olix0r/gists{/gist_id}","starred_url":"https://api.github.com/users/olix0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olix0r/subscriptions","organizations_url":"https://api.github.com/users/olix0r/orgs","repos_url":"https://api.github.com/users/olix0r/repos","events_url":"https://api.github.com/users/olix0r/events{/privacy}","received_events_url":"https://api.github.com/users/olix0r/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/BuoyantIO/linkerd/milestones/17","html_url":"https://github.com/BuoyantIO/linkerd/milestones/0.8.4","labels_url":"https://api.github.com/repos/BuoyantIO/linkerd/milestones/17/labels","id":2162385,"number":17,"title":"0.8.4","description":"","creator":{"login":"olix0r","id":240738,"avatar_url":"https://avatars.githubusercontent.com/u/240738?v=3","gravatar_id":"","url":"https://api.github.com/users/olix0r","html_url":"https://github.com/olix0r","followers_url":"https://api.github.com/users/olix0r/followers","following_url":"https://api.github.com/users/olix0r/following{/other_user}","gists_url":"https://api.github.com/users/olix0r/gists{/gist_id}","starred_url":"https://api.github.com/users/olix0r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olix0r/subscriptions","organizations_url":"https://api.github.com/users/olix0r/orgs","repos_url":"https://api.github.com/users/olix0r/repos","events_url":"https://api.github.com/users/olix0r/events{/privacy}","received_events_url":"https://api.github.com/users/olix0r/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":8,"state":"open","created_at":"2016-11-28T22:54:38Z","updated_at":"2016-12-05T18:10:58Z","due_on":"2016-12-05T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836/commits","review_comments_url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836/comments","review_comment_url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/836/comments","statuses_url":"https://api.github.com/repos/BuoyantIO/linkerd/statuses/6677027983186948cd1e550766952fdb1519e14c","head":{"label":"BuoyantIO:ver/client-logical-stats","ref":"ver/client-logical-stats","sha":"6677027983186948cd1e550766952fdb1519e14c","user":{"login":"BuoyantIO","id":10824329,"avatar_url":"https://avatars.githubusercontent.com/u/10824329?v=3","gravatar_id":"","url":"https://api.github.com/users/BuoyantIO","html_url":"https://github.com/BuoyantIO","followers_url":"https://api.github.com/users/BuoyantIO/followers","following_url":"https://api.github.com/users/BuoyantIO/following{/other_user}","gists_url":"https://api.github.com/users/BuoyantIO/gists{/gist_id}","starred_url":"https://api.github.com/users/BuoyantIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BuoyantIO/subscriptions","organizations_url":"https://api.github.com/users/BuoyantIO/orgs","repos_url":"https://api.github.com/users/BuoyantIO/repos","events_url":"https://api.github.com/users/BuoyantIO/events{/privacy}","received_events_url":"https://api.github.com/users/BuoyantIO/received_events","type":"Organization","site_admin":false},"repo":{"id":49605596,"name":"linkerd","full_name":"BuoyantIO/linkerd","owner":{"login":"BuoyantIO","id":10824329,"avatar_url":"https://avatars.githubusercontent.com/u/10824329?v=3","gravatar_id":"","url":"https://api.github.com/users/BuoyantIO","html_url":"https://github.com/BuoyantIO","followers_url":"https://api.github.com/users/BuoyantIO/followers","following_url":"https://api.github.com/users/BuoyantIO/following{/other_user}","gists_url":"https://api.github.com/users/BuoyantIO/gists{/gist_id}","starred_url":"https://api.github.com/users/BuoyantIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BuoyantIO/subscriptions","organizations_url":"https://api.github.com/users/BuoyantIO/orgs","repos_url":"https://api.github.com/users/BuoyantIO/repos","events_url":"https://api.github.com/users/BuoyantIO/events{/privacy}","received_events_url":"https://api.github.com/users/BuoyantIO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BuoyantIO/linkerd","description":"Resilient service mesh for cloud native apps","fork":false,"url":"https://api.github.com/repos/BuoyantIO/linkerd","forks_url":"https://api.github.com/repos/BuoyantIO/linkerd/forks","keys_url":"https://api.github.com/repos/BuoyantIO/linkerd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BuoyantIO/linkerd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BuoyantIO/linkerd/teams","hooks_url":"https://api.github.com/repos/BuoyantIO/linkerd/hooks","issue_events_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/events{/number}","events_url":"https://api.github.com/repos/BuoyantIO/linkerd/events","assignees_url":"https://api.github.com/repos/BuoyantIO/linkerd/assignees{/user}","branches_url":"https://api.github.com/repos/BuoyantIO/linkerd/branches{/branch}","tags_url":"https://api.github.com/repos/BuoyantIO/linkerd/tags","blobs_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/refs{/sha}","trees_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BuoyantIO/linkerd/statuses/{sha}","languages_url":"https://api.github.com/repos/BuoyantIO/linkerd/languages","stargazers_url":"https://api.github.com/repos/BuoyantIO/linkerd/stargazers","contributors_url":"https://api.github.com/repos/BuoyantIO/linkerd/contributors","subscribers_url":"https://api.github.com/repos/BuoyantIO/linkerd/subscribers","subscription_url":"https://api.github.com/repos/BuoyantIO/linkerd/subscription","commits_url":"https://api.github.com/repos/BuoyantIO/linkerd/commits{/sha}","git_commits_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/commits{/sha}","comments_url":"https://api.github.com/repos/BuoyantIO/linkerd/comments{/number}","issue_comment_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/comments{/number}","contents_url":"https://api.github.com/repos/BuoyantIO/linkerd/contents/{+path}","compare_url":"https://api.github.com/repos/BuoyantIO/linkerd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BuoyantIO/linkerd/merges","archive_url":"https://api.github.com/repos/BuoyantIO/linkerd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BuoyantIO/linkerd/downloads","issues_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues{/number}","pulls_url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls{/number}","milestones_url":"https://api.github.com/repos/BuoyantIO/linkerd/milestones{/number}","notifications_url":"https://api.github.com/repos/BuoyantIO/linkerd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BuoyantIO/linkerd/labels{/name}","releases_url":"https://api.github.com/repos/BuoyantIO/linkerd/releases{/id}","deployments_url":"https://api.github.com/repos/BuoyantIO/linkerd/deployments","created_at":"2016-01-13T22:14:52Z","updated_at":"2016-12-05T06:30:35Z","pushed_at":"2016-12-05T18:10:50Z","git_url":"git://github.com/BuoyantIO/linkerd.git","ssh_url":"git@github.com:BuoyantIO/linkerd.git","clone_url":"https://github.com/BuoyantIO/linkerd.git","svn_url":"https://github.com/BuoyantIO/linkerd","homepage":"https://linkerd.io","size":3959,"stargazers_count":1282,"watchers_count":1282,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":102,"mirror_url":null,"open_issues_count":99,"forks":102,"open_issues":99,"watchers":1282,"default_branch":"master"}},"base":{"label":"BuoyantIO:master","ref":"master","sha":"9fe3c4d8791d1f7f9779486578ad050bd3c61158","user":{"login":"BuoyantIO","id":10824329,"avatar_url":"https://avatars.githubusercontent.com/u/10824329?v=3","gravatar_id":"","url":"https://api.github.com/users/BuoyantIO","html_url":"https://github.com/BuoyantIO","followers_url":"https://api.github.com/users/BuoyantIO/followers","following_url":"https://api.github.com/users/BuoyantIO/following{/other_user}","gists_url":"https://api.github.com/users/BuoyantIO/gists{/gist_id}","starred_url":"https://api.github.com/users/BuoyantIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BuoyantIO/subscriptions","organizations_url":"https://api.github.com/users/BuoyantIO/orgs","repos_url":"https://api.github.com/users/BuoyantIO/repos","events_url":"https://api.github.com/users/BuoyantIO/events{/privacy}","received_events_url":"https://api.github.com/users/BuoyantIO/received_events","type":"Organization","site_admin":false},"repo":{"id":49605596,"name":"linkerd","full_name":"BuoyantIO/linkerd","owner":{"login":"BuoyantIO","id":10824329,"avatar_url":"https://avatars.githubusercontent.com/u/10824329?v=3","gravatar_id":"","url":"https://api.github.com/users/BuoyantIO","html_url":"https://github.com/BuoyantIO","followers_url":"https://api.github.com/users/BuoyantIO/followers","following_url":"https://api.github.com/users/BuoyantIO/following{/other_user}","gists_url":"https://api.github.com/users/BuoyantIO/gists{/gist_id}","starred_url":"https://api.github.com/users/BuoyantIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BuoyantIO/subscriptions","organizations_url":"https://api.github.com/users/BuoyantIO/orgs","repos_url":"https://api.github.com/users/BuoyantIO/repos","events_url":"https://api.github.com/users/BuoyantIO/events{/privacy}","received_events_url":"https://api.github.com/users/BuoyantIO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BuoyantIO/linkerd","description":"Resilient service mesh for cloud native apps","fork":false,"url":"https://api.github.com/repos/BuoyantIO/linkerd","forks_url":"https://api.github.com/repos/BuoyantIO/linkerd/forks","keys_url":"https://api.github.com/repos/BuoyantIO/linkerd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BuoyantIO/linkerd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BuoyantIO/linkerd/teams","hooks_url":"https://api.github.com/repos/BuoyantIO/linkerd/hooks","issue_events_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/events{/number}","events_url":"https://api.github.com/repos/BuoyantIO/linkerd/events","assignees_url":"https://api.github.com/repos/BuoyantIO/linkerd/assignees{/user}","branches_url":"https://api.github.com/repos/BuoyantIO/linkerd/branches{/branch}","tags_url":"https://api.github.com/repos/BuoyantIO/linkerd/tags","blobs_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/refs{/sha}","trees_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BuoyantIO/linkerd/statuses/{sha}","languages_url":"https://api.github.com/repos/BuoyantIO/linkerd/languages","stargazers_url":"https://api.github.com/repos/BuoyantIO/linkerd/stargazers","contributors_url":"https://api.github.com/repos/BuoyantIO/linkerd/contributors","subscribers_url":"https://api.github.com/repos/BuoyantIO/linkerd/subscribers","subscription_url":"https://api.github.com/repos/BuoyantIO/linkerd/subscription","commits_url":"https://api.github.com/repos/BuoyantIO/linkerd/commits{/sha}","git_commits_url":"https://api.github.com/repos/BuoyantIO/linkerd/git/commits{/sha}","comments_url":"https://api.github.com/repos/BuoyantIO/linkerd/comments{/number}","issue_comment_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/comments{/number}","contents_url":"https://api.github.com/repos/BuoyantIO/linkerd/contents/{+path}","compare_url":"https://api.github.com/repos/BuoyantIO/linkerd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BuoyantIO/linkerd/merges","archive_url":"https://api.github.com/repos/BuoyantIO/linkerd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BuoyantIO/linkerd/downloads","issues_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues{/number}","pulls_url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls{/number}","milestones_url":"https://api.github.com/repos/BuoyantIO/linkerd/milestones{/number}","notifications_url":"https://api.github.com/repos/BuoyantIO/linkerd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BuoyantIO/linkerd/labels{/name}","releases_url":"https://api.github.com/repos/BuoyantIO/linkerd/releases{/id}","deployments_url":"https://api.github.com/repos/BuoyantIO/linkerd/deployments","created_at":"2016-01-13T22:14:52Z","updated_at":"2016-12-05T06:30:35Z","pushed_at":"2016-12-05T18:10:50Z","git_url":"git://github.com/BuoyantIO/linkerd.git","ssh_url":"git@github.com:BuoyantIO/linkerd.git","clone_url":"https://github.com/BuoyantIO/linkerd.git","svn_url":"https://github.com/BuoyantIO/linkerd","homepage":"https://linkerd.io","size":3959,"stargazers_count":1282,"watchers_count":1282,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":102,"mirror_url":null,"open_issues_count":99,"forks":102,"open_issues":99,"watchers":1282,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836"},"html":{"href":"https://github.com/BuoyantIO/linkerd/pull/836"},"issue":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/issues/836"},"comments":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/issues/836/comments"},"review_comments":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836/comments"},"review_comment":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/836/commits"},"statuses":{"href":"https://api.github.com/repos/BuoyantIO/linkerd/statuses/6677027983186948cd1e550766952fdb1519e14c"}}}}
{"actor":{"display_login":"klingerf"}}