{"action":"created","comment":{"url":"https://api.github.com/repos/m3db/m3metrics/pulls/comments/193458394","pull_request_review_id":126435053,"id":193458394,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzQ1ODM5NA==","diff_hunk":"@@ -0,0 +1,76 @@\n+// Copyright (c) 2018 Uber Technologies, Inc.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a copy\n+// of this software and associated documentation files (the \"Software\"), to deal\n+// in the Software without restriction, including without limitation the rights\n+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+// copies of the Software, and to permit persons to whom the Software is\n+// furnished to do so, subject to the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+// THE SOFTWARE.\n+\n+package rules\n+\n+import (\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"sort\"\n+\n+\t\"github.com/m3db/m3metrics/aggregation\"\n+\t\"github.com/m3db/m3metrics/generated/proto/policypb\"\n+\t\"github.com/m3db/m3metrics/policy\"\n+)\n+\n+var (\n+\terrNilPolicyProto = errors.New(\"nil policy proto\")\n+)\n+\n+// toAggregationIDAndStoragePolicies converts a list of policies to a single\n+// aggregation ID and a list of storage policies. This is needed for the purpose\n+// of transparently evolving v1 mapping rule protos and rollup target protos into\n+// v2 protos and associated data structures.\n+func toAggregationIDAndStoragePolicies(\n+\tpbPolicies []*policypb.Policy,\n+) (aggregation.ID, policy.StoragePolicies, error) {\n+\tvar (\n+\t\taggregationID      aggregation.ID\n+\t\tfirstTime          = true\n+\t\tstoragePoliciesSet = make(map[policy.StoragePolicy]struct{}, len(pbPolicies))\n+\t)\n+\tfor _, pbPolicy := range pbPolicies {\n+\t\tif pbPolicy == nil {\n+\t\t\treturn aggregation.DefaultID, nil, errNilPolicyProto\n+\t\t}\n+\t\tsp, err := policy.NewStoragePolicyFromProto(pbPolicy.StoragePolicy)\n+\t\tif err != nil {\n+\t\t\treturn aggregation.DefaultID, nil, err\n+\t\t}\n+\t\tnewAggID, err := aggregation.NewIDFromProto(pbPolicy.AggregationTypes)\n+\t\tif err != nil {\n+\t\t\treturn aggregation.DefaultID, nil, err\n+\t\t}\n+\t\tif firstTime {\n+\t\t\taggregationID = newAggID\n+\t\t\tfirstTime = false\n+\t\t} else if !aggregationID.Equal(newAggID) {\n+\t\t\treturn aggregation.DefaultID, nil, fmt.Errorf(\"more than one aggregation ID in legacy policies list proto: ID1=%v, ID2=%v\", aggregationID, newAggID)","path":"rules/convert.go","position":65,"original_position":65,"commit_id":"1f133d90c757e308ef79fa71489997d75b977f92","original_commit_id":"d53430877f346027caec99851147ac3dc3570903","user":{"login":"cw9","id":6710599,"node_id":"MDQ6VXNlcjY3MTA1OTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6710599?v=4","gravatar_id":"","url":"https://api.github.com/users/cw9","html_url":"https://github.com/cw9","followers_url":"https://api.github.com/users/cw9/followers","following_url":"https://api.github.com/users/cw9/following{/other_user}","gists_url":"https://api.github.com/users/cw9/gists{/gist_id}","starred_url":"https://api.github.com/users/cw9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cw9/subscriptions","organizations_url":"https://api.github.com/users/cw9/orgs","repos_url":"https://api.github.com/users/cw9/repos","events_url":"https://api.github.com/users/cw9/events{/privacy}","received_events_url":"https://api.github.com/users/cw9/received_events","type":"User","site_admin":false},"body":"I see, I thought we had some rules like P999,P9999 for 10:2d and P9999 for 1m:40d for ingesters, but seems I remembered it wrong.","created_at":"2018-06-06T15:40:09Z","updated_at":"2018-06-06T15:40:09Z","html_url":"https://github.com/m3db/m3metrics/pull/164#discussion_r193458394","pull_request_url":"https://api.github.com/repos/m3db/m3metrics/pulls/164","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/m3db/m3metrics/pulls/comments/193458394"},"html":{"href":"https://github.com/m3db/m3metrics/pull/164#discussion_r193458394"},"pull_request":{"href":"https://api.github.com/repos/m3db/m3metrics/pulls/164"}},"in_reply_to_id":193200841},"pull_request":{"url":"https://api.github.com/repos/m3db/m3metrics/pulls/164","id":192760476,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNzYwNDc2","html_url":"https://github.com/m3db/m3metrics/pull/164","diff_url":"https://github.com/m3db/m3metrics/pull/164.diff","patch_url":"https://github.com/m3db/m3metrics/pull/164.patch","issue_url":"https://api.github.com/repos/m3db/m3metrics/issues/164","number":164,"state":"open","locked":false,"title":"Incorporate pipeline information in mapping rules and rollup rules","user":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","gravatar_id":"","url":"https://api.github.com/users/xichen2020","html_url":"https://github.com/xichen2020","followers_url":"https://api.github.com/users/xichen2020/followers","following_url":"https://api.github.com/users/xichen2020/following{/other_user}","gists_url":"https://api.github.com/users/xichen2020/gists{/gist_id}","starred_url":"https://api.github.com/users/xichen2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xichen2020/subscriptions","organizations_url":"https://api.github.com/users/xichen2020/orgs","repos_url":"https://api.github.com/users/xichen2020/repos","events_url":"https://api.github.com/users/xichen2020/events{/privacy}","received_events_url":"https://api.github.com/users/xichen2020/received_events","type":"User","site_admin":false},"body":"cc @cw9 @jeromefroe \r\n\r\nThis PR incorporates pipeline information in mapping rules and rollup rules. It also updates the models and the rule matching logic to reflect the data model changes.","created_at":"2018-06-05T16:07:21Z","updated_at":"2018-06-06T15:40:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61bd8fbf2d71a55fd3237c2c84d683eaee1ad84f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/m3db/m3metrics/pulls/164/commits","review_comments_url":"https://api.github.com/repos/m3db/m3metrics/pulls/164/comments","review_comment_url":"https://api.github.com/repos/m3db/m3metrics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m3db/m3metrics/issues/164/comments","statuses_url":"https://api.github.com/repos/m3db/m3metrics/statuses/1f133d90c757e308ef79fa71489997d75b977f92","head":{"label":"m3db:xichen-rules-with-pipeline","ref":"xichen-rules-with-pipeline","sha":"1f133d90c757e308ef79fa71489997d75b977f92","user":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"repo":{"id":76399863,"node_id":"MDEwOlJlcG9zaXRvcnk3NjM5OTg2Mw==","name":"m3metrics","full_name":"m3db/m3metrics","owner":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m3db/m3metrics","description":"Metrics data structures and serialization/deserialization protocols","fork":false,"url":"https://api.github.com/repos/m3db/m3metrics","forks_url":"https://api.github.com/repos/m3db/m3metrics/forks","keys_url":"https://api.github.com/repos/m3db/m3metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3metrics/teams","hooks_url":"https://api.github.com/repos/m3db/m3metrics/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3metrics/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3metrics/events","assignees_url":"https://api.github.com/repos/m3db/m3metrics/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3metrics/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3metrics/tags","blobs_url":"https://api.github.com/repos/m3db/m3metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3metrics/languages","stargazers_url":"https://api.github.com/repos/m3db/m3metrics/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3metrics/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3metrics/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3metrics/subscription","commits_url":"https://api.github.com/repos/m3db/m3metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3metrics/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3metrics/merges","archive_url":"https://api.github.com/repos/m3db/m3metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3metrics/downloads","issues_url":"https://api.github.com/repos/m3db/m3metrics/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3metrics/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3metrics/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3metrics/deployments","created_at":"2016-12-13T21:28:26Z","updated_at":"2018-05-18T03:15:20Z","pushed_at":"2018-06-06T03:14:53Z","git_url":"git://github.com/m3db/m3metrics.git","ssh_url":"git@github.com:m3db/m3metrics.git","clone_url":"https://github.com/m3db/m3metrics.git","svn_url":"https://github.com/m3db/m3metrics","homepage":"","size":1044,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"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":10,"watchers":2,"default_branch":"master"}},"base":{"label":"m3db:dev","ref":"dev","sha":"25bf171b5e4428032aae77e732d340279abea63a","user":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"repo":{"id":76399863,"node_id":"MDEwOlJlcG9zaXRvcnk3NjM5OTg2Mw==","name":"m3metrics","full_name":"m3db/m3metrics","owner":{"login":"m3db","id":19937171,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5OTM3MTcx","avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m3db/m3metrics","description":"Metrics data structures and serialization/deserialization protocols","fork":false,"url":"https://api.github.com/repos/m3db/m3metrics","forks_url":"https://api.github.com/repos/m3db/m3metrics/forks","keys_url":"https://api.github.com/repos/m3db/m3metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3metrics/teams","hooks_url":"https://api.github.com/repos/m3db/m3metrics/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3metrics/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3metrics/events","assignees_url":"https://api.github.com/repos/m3db/m3metrics/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3metrics/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3metrics/tags","blobs_url":"https://api.github.com/repos/m3db/m3metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3metrics/languages","stargazers_url":"https://api.github.com/repos/m3db/m3metrics/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3metrics/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3metrics/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3metrics/subscription","commits_url":"https://api.github.com/repos/m3db/m3metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3metrics/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3metrics/merges","archive_url":"https://api.github.com/repos/m3db/m3metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3metrics/downloads","issues_url":"https://api.github.com/repos/m3db/m3metrics/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3metrics/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3metrics/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3metrics/deployments","created_at":"2016-12-13T21:28:26Z","updated_at":"2018-05-18T03:15:20Z","pushed_at":"2018-06-06T03:14:53Z","git_url":"git://github.com/m3db/m3metrics.git","ssh_url":"git@github.com:m3db/m3metrics.git","clone_url":"https://github.com/m3db/m3metrics.git","svn_url":"https://github.com/m3db/m3metrics","homepage":"","size":1044,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":10,"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":10,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m3db/m3metrics/pulls/164"},"html":{"href":"https://github.com/m3db/m3metrics/pull/164"},"issue":{"href":"https://api.github.com/repos/m3db/m3metrics/issues/164"},"comments":{"href":"https://api.github.com/repos/m3db/m3metrics/issues/164/comments"},"review_comments":{"href":"https://api.github.com/repos/m3db/m3metrics/pulls/164/comments"},"review_comment":{"href":"https://api.github.com/repos/m3db/m3metrics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m3db/m3metrics/pulls/164/commits"},"statuses":{"href":"https://api.github.com/repos/m3db/m3metrics/statuses/1f133d90c757e308ef79fa71489997d75b977f92"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cw9"}}