{"action":"created","comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/210053250","pull_request_review_id":146189649,"id":210053250,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDA1MzI1MA==","diff_hunk":"@@ -24,14 +26,45 @@ RouteConstSharedPtr RouteEntryImplBase::clusterEntry() const { return shared_fro\n \n MethodNameRouteEntryImpl::MethodNameRouteEntryImpl(\n     const envoy::config::filter::network::thrift_proxy::v2alpha1::Route& route)\n-    : RouteEntryImplBase(route), method_name_(route.match().method()) {}\n+    : RouteEntryImplBase(route), method_name_(route.match().method_name()),\n+      invert_(route.match().invert()) {\n+  if (method_name_.empty() && invert_) {\n+    throw EnvoyException(\"Cannot have an empty method name with inversion enabled\");\n+  }\n+}\n \n RouteConstSharedPtr MethodNameRouteEntryImpl::matches(const MessageMetadata& metadata) const {\n-  if (method_name_.empty()) {\n+  bool matches =\n+      method_name_.empty() || (metadata.hasMethodName() && metadata.methodName() == method_name_);\n+\n+  if (matches ^ invert_) {\n     return clusterEntry();\n   }\n \n-  if (metadata.hasMethodName() && metadata.methodName() == method_name_) {\n+  return nullptr;\n+}\n+\n+ServiceNameRouteEntryImpl::ServiceNameRouteEntryImpl(\n+    const envoy::config::filter::network::thrift_proxy::v2alpha1::Route& route)\n+    : RouteEntryImplBase(route), invert_(route.match().invert()) {\n+  std::string service_name = route.match().service_name();\n+  if (service_name.empty() && invert_) {\n+    throw EnvoyException(\"Cannot have an empty service name with inversion enabled\");\n+  }\n+\n+  if (!service_name.empty() && !StringUtil::endsWith(service_name.c_str(), \":\")) {","path":"source/extensions/filters/network/thrift_proxy/router/router_impl.cc","position":42,"original_position":42,"commit_id":"ec5a1434e7db07f692148f9898c52bac36889795","original_commit_id":"ec5a1434e7db07f692148f9898c52bac36889795","user":{"login":"brirams","id":1807482,"node_id":"MDQ6VXNlcjE4MDc0ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/1807482?v=4","gravatar_id":"","url":"https://api.github.com/users/brirams","html_url":"https://github.com/brirams","followers_url":"https://api.github.com/users/brirams/followers","following_url":"https://api.github.com/users/brirams/following{/other_user}","gists_url":"https://api.github.com/users/brirams/gists{/gist_id}","starred_url":"https://api.github.com/users/brirams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brirams/subscriptions","organizations_url":"https://api.github.com/users/brirams/orgs","repos_url":"https://api.github.com/users/brirams/repos","events_url":"https://api.github.com/users/brirams/events{/privacy}","received_events_url":"https://api.github.com/users/brirams/received_events","type":"User","site_admin":false},"body":"ah -- I think this is a vestige of when I using the class member as an arg to this.  will update.","created_at":"2018-08-14T18:16:50Z","updated_at":"2018-08-14T18:16:50Z","html_url":"https://github.com/envoyproxy/envoy/pull/4130#discussion_r210053250","pull_request_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/210053250"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/4130#discussion_r210053250"},"pull_request":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130"}},"in_reply_to_id":210049532},"pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130","id":208076766,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4MDc2NzY2","html_url":"https://github.com/envoyproxy/envoy/pull/4130","diff_url":"https://github.com/envoyproxy/envoy/pull/4130.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/4130.patch","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/4130","number":4130,"state":"open","locked":false,"title":"[thrift_proxy/router] Add service name matching to router implementation","user":{"login":"brirams","id":1807482,"node_id":"MDQ6VXNlcjE4MDc0ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/1807482?v=4","gravatar_id":"","url":"https://api.github.com/users/brirams","html_url":"https://github.com/brirams","followers_url":"https://api.github.com/users/brirams/followers","following_url":"https://api.github.com/users/brirams/following{/other_user}","gists_url":"https://api.github.com/users/brirams/gists{/gist_id}","starred_url":"https://api.github.com/users/brirams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brirams/subscriptions","organizations_url":"https://api.github.com/users/brirams/orgs","repos_url":"https://api.github.com/users/brirams/repos","events_url":"https://api.github.com/users/brirams/events{/privacy}","received_events_url":"https://api.github.com/users/brirams/received_events","type":"User","site_admin":false},"body":"*Description*:\r\nCurrently, the thrift router only supports method matching as a way to route thrift requests. This builds on that by adding the ability to specify a service name that is used when matching. This change updates the `RouteMatch` proto definition to use a `oneof` field to indicate what type of matching should be done, as well as an `invert` flag that will allow for inverse matching rules.\r\n\r\nAdditionally:\r\n- ensure new `RouteEntryImplBase` implementations check that inversion and wildcard matching are not enabled at the same time, as this would result in no matches for a route\r\n- implement service matching as checking the prefix of the method name, as that's how it's implemented in thrift\r\n\r\n*Risk Level*: \r\nLow\r\n\r\n*Testing*: \r\n- new and existing unit tests pass. \r\n- updated integration test use new matching rules and ensure that expected upstreams receive requests.\r\n\r\n*Docs Changes*:\r\n*Release Notes*:","created_at":"2018-08-13T19:20:47Z","updated_at":"2018-08-14T18:16:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5db81f67d0bc11a0ccc0959bcd0f968e3f0ec01e","assignee":{"login":"zuercher","id":53179,"node_id":"MDQ6VXNlcjUzMTc5","avatar_url":"https://avatars3.githubusercontent.com/u/53179?v=4","gravatar_id":"","url":"https://api.github.com/users/zuercher","html_url":"https://github.com/zuercher","followers_url":"https://api.github.com/users/zuercher/followers","following_url":"https://api.github.com/users/zuercher/following{/other_user}","gists_url":"https://api.github.com/users/zuercher/gists{/gist_id}","starred_url":"https://api.github.com/users/zuercher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuercher/subscriptions","organizations_url":"https://api.github.com/users/zuercher/orgs","repos_url":"https://api.github.com/users/zuercher/repos","events_url":"https://api.github.com/users/zuercher/events{/privacy}","received_events_url":"https://api.github.com/users/zuercher/received_events","type":"User","site_admin":false},"assignees":[{"login":"zuercher","id":53179,"node_id":"MDQ6VXNlcjUzMTc5","avatar_url":"https://avatars3.githubusercontent.com/u/53179?v=4","gravatar_id":"","url":"https://api.github.com/users/zuercher","html_url":"https://github.com/zuercher","followers_url":"https://api.github.com/users/zuercher/followers","following_url":"https://api.github.com/users/zuercher/following{/other_user}","gists_url":"https://api.github.com/users/zuercher/gists{/gist_id}","starred_url":"https://api.github.com/users/zuercher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuercher/subscriptions","organizations_url":"https://api.github.com/users/zuercher/orgs","repos_url":"https://api.github.com/users/zuercher/repos","events_url":"https://api.github.com/users/zuercher/events{/privacy}","received_events_url":"https://api.github.com/users/zuercher/received_events","type":"User","site_admin":false},{"login":"brian-pane","id":24847780,"node_id":"MDQ6VXNlcjI0ODQ3Nzgw","avatar_url":"https://avatars3.githubusercontent.com/u/24847780?v=4","gravatar_id":"","url":"https://api.github.com/users/brian-pane","html_url":"https://github.com/brian-pane","followers_url":"https://api.github.com/users/brian-pane/followers","following_url":"https://api.github.com/users/brian-pane/following{/other_user}","gists_url":"https://api.github.com/users/brian-pane/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-pane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-pane/subscriptions","organizations_url":"https://api.github.com/users/brian-pane/orgs","repos_url":"https://api.github.com/users/brian-pane/repos","events_url":"https://api.github.com/users/brian-pane/events{/privacy}","received_events_url":"https://api.github.com/users/brian-pane/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130/commits","review_comments_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130/comments","review_comment_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/4130/comments","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/ec5a1434e7db07f692148f9898c52bac36889795","head":{"label":"turbinelabs:brirams/#5550/thrift_service_name_matching","ref":"brirams/#5550/thrift_service_name_matching","sha":"ec5a1434e7db07f692148f9898c52bac36889795","user":{"login":"turbinelabs","id":12767820,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzY3ODIw","avatar_url":"https://avatars0.githubusercontent.com/u/12767820?v=4","gravatar_id":"","url":"https://api.github.com/users/turbinelabs","html_url":"https://github.com/turbinelabs","followers_url":"https://api.github.com/users/turbinelabs/followers","following_url":"https://api.github.com/users/turbinelabs/following{/other_user}","gists_url":"https://api.github.com/users/turbinelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/turbinelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turbinelabs/subscriptions","organizations_url":"https://api.github.com/users/turbinelabs/orgs","repos_url":"https://api.github.com/users/turbinelabs/repos","events_url":"https://api.github.com/users/turbinelabs/events{/privacy}","received_events_url":"https://api.github.com/users/turbinelabs/received_events","type":"Organization","site_admin":false},"repo":{"id":97758644,"node_id":"MDEwOlJlcG9zaXRvcnk5Nzc1ODY0NA==","name":"envoy","full_name":"turbinelabs/envoy","owner":{"login":"turbinelabs","id":12767820,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNzY3ODIw","avatar_url":"https://avatars0.githubusercontent.com/u/12767820?v=4","gravatar_id":"","url":"https://api.github.com/users/turbinelabs","html_url":"https://github.com/turbinelabs","followers_url":"https://api.github.com/users/turbinelabs/followers","following_url":"https://api.github.com/users/turbinelabs/following{/other_user}","gists_url":"https://api.github.com/users/turbinelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/turbinelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turbinelabs/subscriptions","organizations_url":"https://api.github.com/users/turbinelabs/orgs","repos_url":"https://api.github.com/users/turbinelabs/repos","events_url":"https://api.github.com/users/turbinelabs/events{/privacy}","received_events_url":"https://api.github.com/users/turbinelabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/turbinelabs/envoy","description":"C++ front/service proxy","fork":true,"url":"https://api.github.com/repos/turbinelabs/envoy","forks_url":"https://api.github.com/repos/turbinelabs/envoy/forks","keys_url":"https://api.github.com/repos/turbinelabs/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/turbinelabs/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/turbinelabs/envoy/teams","hooks_url":"https://api.github.com/repos/turbinelabs/envoy/hooks","issue_events_url":"https://api.github.com/repos/turbinelabs/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/turbinelabs/envoy/events","assignees_url":"https://api.github.com/repos/turbinelabs/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/turbinelabs/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/turbinelabs/envoy/tags","blobs_url":"https://api.github.com/repos/turbinelabs/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/turbinelabs/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/turbinelabs/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/turbinelabs/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/turbinelabs/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/turbinelabs/envoy/languages","stargazers_url":"https://api.github.com/repos/turbinelabs/envoy/stargazers","contributors_url":"https://api.github.com/repos/turbinelabs/envoy/contributors","subscribers_url":"https://api.github.com/repos/turbinelabs/envoy/subscribers","subscription_url":"https://api.github.com/repos/turbinelabs/envoy/subscription","commits_url":"https://api.github.com/repos/turbinelabs/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/turbinelabs/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/turbinelabs/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/turbinelabs/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/turbinelabs/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/turbinelabs/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/turbinelabs/envoy/merges","archive_url":"https://api.github.com/repos/turbinelabs/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/turbinelabs/envoy/downloads","issues_url":"https://api.github.com/repos/turbinelabs/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/turbinelabs/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/turbinelabs/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/turbinelabs/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/turbinelabs/envoy/labels{/name}","releases_url":"https://api.github.com/repos/turbinelabs/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/turbinelabs/envoy/deployments","created_at":"2017-07-19T20:32:31Z","updated_at":"2018-08-07T17:13:44Z","pushed_at":"2018-08-14T17:56:44Z","git_url":"git://github.com/turbinelabs/envoy.git","ssh_url":"git@github.com:turbinelabs/envoy.git","clone_url":"https://github.com/turbinelabs/envoy.git","svn_url":"https://github.com/turbinelabs/envoy","homepage":"https://www.envoyproxy.io","size":44174,"stargazers_count":0,"watchers_count":0,"language":"C++","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":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"envoyproxy:master","ref":"master","sha":"da500d20fb41b4e89dabc3ae2ce6680b09968ece","user":{"login":"envoyproxy","id":30125649,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMTI1NjQ5","avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"repo":{"id":65214191,"node_id":"MDEwOlJlcG9zaXRvcnk2NTIxNDE5MQ==","name":"envoy","full_name":"envoyproxy/envoy","owner":{"login":"envoyproxy","id":30125649,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMTI1NjQ5","avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/envoyproxy/envoy","description":"C++ front/service proxy","fork":false,"url":"https://api.github.com/repos/envoyproxy/envoy","forks_url":"https://api.github.com/repos/envoyproxy/envoy/forks","keys_url":"https://api.github.com/repos/envoyproxy/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/envoyproxy/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/envoyproxy/envoy/teams","hooks_url":"https://api.github.com/repos/envoyproxy/envoy/hooks","issue_events_url":"https://api.github.com/repos/envoyproxy/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/envoyproxy/envoy/events","assignees_url":"https://api.github.com/repos/envoyproxy/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/envoyproxy/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/envoyproxy/envoy/tags","blobs_url":"https://api.github.com/repos/envoyproxy/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/envoyproxy/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/envoyproxy/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/envoyproxy/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/envoyproxy/envoy/languages","stargazers_url":"https://api.github.com/repos/envoyproxy/envoy/stargazers","contributors_url":"https://api.github.com/repos/envoyproxy/envoy/contributors","subscribers_url":"https://api.github.com/repos/envoyproxy/envoy/subscribers","subscription_url":"https://api.github.com/repos/envoyproxy/envoy/subscription","commits_url":"https://api.github.com/repos/envoyproxy/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/envoyproxy/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/envoyproxy/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/envoyproxy/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/envoyproxy/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/envoyproxy/envoy/merges","archive_url":"https://api.github.com/repos/envoyproxy/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/envoyproxy/envoy/downloads","issues_url":"https://api.github.com/repos/envoyproxy/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/envoyproxy/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/envoyproxy/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/envoyproxy/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/envoyproxy/envoy/labels{/name}","releases_url":"https://api.github.com/repos/envoyproxy/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/envoyproxy/envoy/deployments","created_at":"2016-08-08T15:07:24Z","updated_at":"2018-08-14T17:57:35Z","pushed_at":"2018-08-14T17:56:46Z","git_url":"git://github.com/envoyproxy/envoy.git","ssh_url":"git@github.com:envoyproxy/envoy.git","clone_url":"https://github.com/envoyproxy/envoy.git","svn_url":"https://github.com/envoyproxy/envoy","homepage":"https://www.envoyproxy.io","size":19005,"stargazers_count":6194,"watchers_count":6194,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":814,"mirror_url":null,"archived":false,"open_issues_count":324,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":814,"open_issues":324,"watchers":6194,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/4130"},"issue":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/4130"},"comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/4130/comments"},"review_comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130/comments"},"review_comment":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4130/commits"},"statuses":{"href":"https://api.github.com/repos/envoyproxy/envoy/statuses/ec5a1434e7db07f692148f9898c52bac36889795"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"brirams"}}