{"action":"created","comment":{"url":"https://api.github.com/repos/3scale/apisonator/pulls/comments/206507691","pull_request_review_id":141930995,"id":206507691,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjUwNzY5MQ==","diff_hunk":"@@ -0,0 +1,61 @@\n+\n+module ThreeScale\n+  module Backend\n+    module Stats\n+      module Common\n+        private\n+\n+       # Method that generates a hash having correspondence between index and\n+        # granularity name and viceversa. Maybe split it into two different\n+        # hashes???? That would make 4 constants to be created\n+        #TODO maybe move this to another place??\n+        def self.get_indexed_granularities(granularities)\n+          res = {}\n+          granularities.each_with_index do |grn, idx|\n+            res[grn.to_sym] = idx\n+            res[idx] = grn.to_sym\n+          end\n+          res\n+        end\n+\n+        public\n+\n+        SERVICE_GRANULARITIES =\n+        [:eternity, :month, :week, :day, :hour].map do |g|\n+          Period[g]\n+        end.freeze\n+\n+        # For applications and users\n+        EXPANDED_GRANULARITIES = (SERVICE_GRANULARITIES + [Period[:year], Period[:minute]]).freeze\n+\n+        GRANULARITY_EXPIRATION_TIME = { Period[:minute] => 180 }.freeze\n+        private_constant :GRANULARITY_EXPIRATION_TIME\n+\n+        #TODO maybe could be a good idea to generate this from the Period::Symbols\n+        #array in order to have a match between index order and granularity order???\n+        #or use Period::ALL and substrct specific periods from another array?\n+        PERMANENT_SERVICE_GRANULARITIES = (SERVICE_GRANULARITIES - GRANULARITY_EXPIRATION_TIME.keys).freeze\n+        PERMANENT_EXPANDED_GRANULARITIES = (EXPANDED_GRANULARITIES - GRANULARITY_EXPIRATION_TIME.keys).freeze\n+\n+        #TODO maybe move this to another place??\n+        PERMANENT_SVC_GRN_IDX = Stats::Common::get_indexed_granularities(PERMANENT_SERVICE_GRANULARITIES).freeze\n+        PERMANENT_EXP_GRN_IDX = Stats::Common::get_indexed_granularities(PERMANENT_EXPANDED_GRANULARITIES).freeze\n+\n+        # We are not going to send metrics with granularity 'eternity' or\n+        # 'week' to Kinesis, so there is no point in storing them in Redis\n+        # buckets.\n+        EXCLUDED_FOR_BUCKETS = [Period[:eternity], Period[:week]].freeze","path":"lib/3scale/backend/stats/common.rb","position":47,"original_position":47,"commit_id":"d56348e1b9f146856bfbc313736080eec5b6b770","original_commit_id":"d56348e1b9f146856bfbc313736080eec5b6b770","user":{"login":"miguelsorianod","id":37954906,"node_id":"MDQ6VXNlcjM3OTU0OTA2","avatar_url":"https://avatars3.githubusercontent.com/u/37954906?v=4","gravatar_id":"","url":"https://api.github.com/users/miguelsorianod","html_url":"https://github.com/miguelsorianod","followers_url":"https://api.github.com/users/miguelsorianod/followers","following_url":"https://api.github.com/users/miguelsorianod/following{/other_user}","gists_url":"https://api.github.com/users/miguelsorianod/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelsorianod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelsorianod/subscriptions","organizations_url":"https://api.github.com/users/miguelsorianod/orgs","repos_url":"https://api.github.com/users/miguelsorianod/repos","events_url":"https://api.github.com/users/miguelsorianod/events{/privacy}","received_events_url":"https://api.github.com/users/miguelsorianod/received_events","type":"User","site_admin":false},"body":"Not used anywhere else. I'm going to move it into aggregators again :+1: ","created_at":"2018-07-31T12:35:11Z","updated_at":"2018-07-31T12:35:11Z","html_url":"https://github.com/3scale/apisonator/pull/47#discussion_r206507691","pull_request_url":"https://api.github.com/repos/3scale/apisonator/pulls/47","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/comments/206507691"},"html":{"href":"https://github.com/3scale/apisonator/pull/47#discussion_r206507691"},"pull_request":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/47"}},"in_reply_to_id":206505836},"pull_request":{"url":"https://api.github.com/repos/3scale/apisonator/pulls/47","id":203486664,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNDg2NjY0","html_url":"https://github.com/3scale/apisonator/pull/47","diff_url":"https://github.com/3scale/apisonator/pull/47.diff","patch_url":"https://github.com/3scale/apisonator/pull/47.patch","issue_url":"https://api.github.com/repos/3scale/apisonator/issues/47","number":47,"state":"open","locked":false,"title":"[WIP] Feature/stats deletion","user":{"login":"miguelsorianod","id":37954906,"node_id":"MDQ6VXNlcjM3OTU0OTA2","avatar_url":"https://avatars3.githubusercontent.com/u/37954906?v=4","gravatar_id":"","url":"https://api.github.com/users/miguelsorianod","html_url":"https://github.com/miguelsorianod","followers_url":"https://api.github.com/users/miguelsorianod/followers","following_url":"https://api.github.com/users/miguelsorianod/following{/other_user}","gists_url":"https://api.github.com/users/miguelsorianod/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelsorianod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelsorianod/subscriptions","organizations_url":"https://api.github.com/users/miguelsorianod/orgs","repos_url":"https://api.github.com/users/miguelsorianod/repos","events_url":"https://api.github.com/users/miguelsorianod/events{/privacy}","received_events_url":"https://api.github.com/users/miguelsorianod/received_events","type":"User","site_admin":false},"body":"Work in progress. This is a PR to add stats deletion feature","created_at":"2018-07-24T10:54:10Z","updated_at":"2018-07-31T12:35:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40259c7bbc19ca43e828511b0e618b547ff0fdad","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/3scale/apisonator/pulls/47/commits","review_comments_url":"https://api.github.com/repos/3scale/apisonator/pulls/47/comments","review_comment_url":"https://api.github.com/repos/3scale/apisonator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/3scale/apisonator/issues/47/comments","statuses_url":"https://api.github.com/repos/3scale/apisonator/statuses/d56348e1b9f146856bfbc313736080eec5b6b770","head":{"label":"3scale:feature/stats-deletion","ref":"feature/stats-deletion","sha":"d56348e1b9f146856bfbc313736080eec5b6b770","user":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":119402246,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk0MDIyNDY=","name":"apisonator","full_name":"3scale/apisonator","owner":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/3scale/apisonator","description":"Red Hat 3scale API Management Apisonator backend","fork":false,"url":"https://api.github.com/repos/3scale/apisonator","forks_url":"https://api.github.com/repos/3scale/apisonator/forks","keys_url":"https://api.github.com/repos/3scale/apisonator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/apisonator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/apisonator/teams","hooks_url":"https://api.github.com/repos/3scale/apisonator/hooks","issue_events_url":"https://api.github.com/repos/3scale/apisonator/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/apisonator/events","assignees_url":"https://api.github.com/repos/3scale/apisonator/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/apisonator/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/apisonator/tags","blobs_url":"https://api.github.com/repos/3scale/apisonator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/apisonator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/apisonator/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/apisonator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/apisonator/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/apisonator/languages","stargazers_url":"https://api.github.com/repos/3scale/apisonator/stargazers","contributors_url":"https://api.github.com/repos/3scale/apisonator/contributors","subscribers_url":"https://api.github.com/repos/3scale/apisonator/subscribers","subscription_url":"https://api.github.com/repos/3scale/apisonator/subscription","commits_url":"https://api.github.com/repos/3scale/apisonator/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/apisonator/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/apisonator/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/apisonator/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/apisonator/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/apisonator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/apisonator/merges","archive_url":"https://api.github.com/repos/3scale/apisonator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/apisonator/downloads","issues_url":"https://api.github.com/repos/3scale/apisonator/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/apisonator/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/apisonator/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/apisonator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/apisonator/labels{/name}","releases_url":"https://api.github.com/repos/3scale/apisonator/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/apisonator/deployments","created_at":"2018-01-29T15:37:15Z","updated_at":"2018-07-24T13:26:36Z","pushed_at":"2018-07-31T10:41:02Z","git_url":"git://github.com/3scale/apisonator.git","ssh_url":"git@github.com:3scale/apisonator.git","clone_url":"https://github.com/3scale/apisonator.git","svn_url":"https://github.com/3scale/apisonator","homepage":"https://3scale.net","size":3182,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"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":3,"open_issues":3,"watchers":10,"default_branch":"master"}},"base":{"label":"3scale:master","ref":"master","sha":"88ecbafe5fc95af498c3e15c5578ca25477e06ca","user":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":119402246,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk0MDIyNDY=","name":"apisonator","full_name":"3scale/apisonator","owner":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/3scale/apisonator","description":"Red Hat 3scale API Management Apisonator backend","fork":false,"url":"https://api.github.com/repos/3scale/apisonator","forks_url":"https://api.github.com/repos/3scale/apisonator/forks","keys_url":"https://api.github.com/repos/3scale/apisonator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/apisonator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/apisonator/teams","hooks_url":"https://api.github.com/repos/3scale/apisonator/hooks","issue_events_url":"https://api.github.com/repos/3scale/apisonator/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/apisonator/events","assignees_url":"https://api.github.com/repos/3scale/apisonator/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/apisonator/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/apisonator/tags","blobs_url":"https://api.github.com/repos/3scale/apisonator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/apisonator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/apisonator/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/apisonator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/apisonator/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/apisonator/languages","stargazers_url":"https://api.github.com/repos/3scale/apisonator/stargazers","contributors_url":"https://api.github.com/repos/3scale/apisonator/contributors","subscribers_url":"https://api.github.com/repos/3scale/apisonator/subscribers","subscription_url":"https://api.github.com/repos/3scale/apisonator/subscription","commits_url":"https://api.github.com/repos/3scale/apisonator/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/apisonator/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/apisonator/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/apisonator/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/apisonator/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/apisonator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/apisonator/merges","archive_url":"https://api.github.com/repos/3scale/apisonator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/apisonator/downloads","issues_url":"https://api.github.com/repos/3scale/apisonator/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/apisonator/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/apisonator/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/apisonator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/apisonator/labels{/name}","releases_url":"https://api.github.com/repos/3scale/apisonator/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/apisonator/deployments","created_at":"2018-01-29T15:37:15Z","updated_at":"2018-07-24T13:26:36Z","pushed_at":"2018-07-31T10:41:02Z","git_url":"git://github.com/3scale/apisonator.git","ssh_url":"git@github.com:3scale/apisonator.git","clone_url":"https://github.com/3scale/apisonator.git","svn_url":"https://github.com/3scale/apisonator","homepage":"https://3scale.net","size":3182,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"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":3,"open_issues":3,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/47"},"html":{"href":"https://github.com/3scale/apisonator/pull/47"},"issue":{"href":"https://api.github.com/repos/3scale/apisonator/issues/47"},"comments":{"href":"https://api.github.com/repos/3scale/apisonator/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/3scale/apisonator/statuses/d56348e1b9f146856bfbc313736080eec5b6b770"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"miguelsorianod"}}