{"action":"created","comment":{"url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/comments/77042650","id":77042650,"diff_hunk":"@@ -0,0 +1,140 @@\n+package timely.store;\n+\n+import static java.nio.charset.StandardCharsets.UTF_8;\n+\n+import java.io.IOException;\n+import java.util.Map;\n+\n+import org.apache.accumulo.core.data.ByteSequence;\n+import org.apache.accumulo.core.data.Key;\n+import org.apache.accumulo.core.data.Value;\n+import org.apache.accumulo.core.iterators.Filter;\n+import org.apache.accumulo.core.iterators.IteratorEnvironment;\n+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;\n+import org.apache.commons.collections4.trie.PatriciaTrie;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+public class MetricAgeOffFilter extends Filter {\n+\n+    private static final Logger LOG = LoggerFactory.getLogger(MetricAgeOffFilter.class);\n+    public static final String AGE_OFF_PREFIX = \"ageoff.\";\n+    public static final String DEFAULT_AGEOFF_KEY = \"default\";\n+    private PatriciaTrie<Long> ageoffs = null;\n+    private Long currentTime = 0L;\n+    private Long defaultAgeOff = 0L;\n+    private Long minAgeOff = Long.MAX_VALUE;\n+    private Long maxAgeOff = Long.MIN_VALUE;\n+    private byte[] prevMetricBytes = null;\n+    private Long prevAgeOff = null;\n+\n+    @Override\n+    public boolean accept(Key k, Value v) {\n+\n+        // If less than any configured ageoff, then keep it\n+        if ((this.currentTime - k.getTimestamp()) < this.minAgeOff) {\n+            return true;\n+        }\n+        // If greater than any configured ageoff, then drop it\n+        if ((this.currentTime - k.getTimestamp()) > this.maxAgeOff) {\n+            return false;\n+        }\n+        // There is a high probability that this key will have\n+        // the same metric name as the last key.\n+        ByteSequence rowData = k.getRowData();\n+        int rowStart = rowData.offset();\n+        int i = Integer.MIN_VALUE;\n+        if (null != prevMetricBytes && null != prevAgeOff","path":"server/src/main/java/timely/store/MetricAgeOffFilter.java","position":47,"original_position":47,"commit_id":"c38fb52845c2f3204791cf28617d71957560d2e9","original_commit_id":"c38fb52845c2f3204791cf28617d71957560d2e9","user":{"login":"ivakegg","id":347158,"avatar_url":"https://avatars.githubusercontent.com/u/347158?v=3","gravatar_id":"","url":"https://api.github.com/users/ivakegg","html_url":"https://github.com/ivakegg","followers_url":"https://api.github.com/users/ivakegg/followers","following_url":"https://api.github.com/users/ivakegg/following{/other_user}","gists_url":"https://api.github.com/users/ivakegg/gists{/gist_id}","starred_url":"https://api.github.com/users/ivakegg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivakegg/subscriptions","organizations_url":"https://api.github.com/users/ivakegg/orgs","repos_url":"https://api.github.com/users/ivakegg/repos","events_url":"https://api.github.com/users/ivakegg/events{/privacy}","received_events_url":"https://api.github.com/users/ivakegg/received_events","type":"User","site_admin":false},"body":"Only really need to check the prevMetricBytes for null here.","created_at":"2016-08-31T18:16:14Z","updated_at":"2016-08-31T18:16:14Z","html_url":"https://github.com/NationalSecurityAgency/timely/pull/76#discussion_r77042650","pull_request_url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/comments/77042650"},"html":{"href":"https://github.com/NationalSecurityAgency/timely/pull/76#discussion_r77042650"},"pull_request":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76","id":82940697,"html_url":"https://github.com/NationalSecurityAgency/timely/pull/76","diff_url":"https://github.com/NationalSecurityAgency/timely/pull/76.diff","patch_url":"https://github.com/NationalSecurityAgency/timely/pull/76.patch","issue_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/76","number":76,"state":"open","locked":false,"title":"#16 - per metric ageoff","user":{"login":"dlmarion","id":567911,"avatar_url":"https://avatars.githubusercontent.com/u/567911?v=3","gravatar_id":"","url":"https://api.github.com/users/dlmarion","html_url":"https://github.com/dlmarion","followers_url":"https://api.github.com/users/dlmarion/followers","following_url":"https://api.github.com/users/dlmarion/following{/other_user}","gists_url":"https://api.github.com/users/dlmarion/gists{/gist_id}","starred_url":"https://api.github.com/users/dlmarion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlmarion/subscriptions","organizations_url":"https://api.github.com/users/dlmarion/orgs","repos_url":"https://api.github.com/users/dlmarion/repos","events_url":"https://api.github.com/users/dlmarion/events{/privacy}","received_events_url":"https://api.github.com/users/dlmarion/received_events","type":"User","site_admin":false},"body":"fixes #16, added age off map to configuration to specify ageoff, in days, per metric. \"default\" accepted. Remove all ageoff iterators on server startup and re-setup with current configuration","created_at":"2016-08-26T19:26:36Z","updated_at":"2016-08-31T18:16:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ce30bc5a25e9b3d64bc3d096b046731de62fa4f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76/commits","review_comments_url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76/comments","review_comment_url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/76/comments","statuses_url":"https://api.github.com/repos/NationalSecurityAgency/timely/statuses/c38fb52845c2f3204791cf28617d71957560d2e9","head":{"label":"NationalSecurityAgency:timely16","ref":"timely16","sha":"c38fb52845c2f3204791cf28617d71957560d2e9","user":{"login":"NationalSecurityAgency","id":11298292,"avatar_url":"https://avatars.githubusercontent.com/u/11298292?v=3","gravatar_id":"","url":"https://api.github.com/users/NationalSecurityAgency","html_url":"https://github.com/NationalSecurityAgency","followers_url":"https://api.github.com/users/NationalSecurityAgency/followers","following_url":"https://api.github.com/users/NationalSecurityAgency/following{/other_user}","gists_url":"https://api.github.com/users/NationalSecurityAgency/gists{/gist_id}","starred_url":"https://api.github.com/users/NationalSecurityAgency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NationalSecurityAgency/subscriptions","organizations_url":"https://api.github.com/users/NationalSecurityAgency/orgs","repos_url":"https://api.github.com/users/NationalSecurityAgency/repos","events_url":"https://api.github.com/users/NationalSecurityAgency/events{/privacy}","received_events_url":"https://api.github.com/users/NationalSecurityAgency/received_events","type":"Organization","site_admin":false},"repo":{"id":56099345,"name":"timely","full_name":"NationalSecurityAgency/timely","owner":{"login":"NationalSecurityAgency","id":11298292,"avatar_url":"https://avatars.githubusercontent.com/u/11298292?v=3","gravatar_id":"","url":"https://api.github.com/users/NationalSecurityAgency","html_url":"https://github.com/NationalSecurityAgency","followers_url":"https://api.github.com/users/NationalSecurityAgency/followers","following_url":"https://api.github.com/users/NationalSecurityAgency/following{/other_user}","gists_url":"https://api.github.com/users/NationalSecurityAgency/gists{/gist_id}","starred_url":"https://api.github.com/users/NationalSecurityAgency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NationalSecurityAgency/subscriptions","organizations_url":"https://api.github.com/users/NationalSecurityAgency/orgs","repos_url":"https://api.github.com/users/NationalSecurityAgency/repos","events_url":"https://api.github.com/users/NationalSecurityAgency/events{/privacy}","received_events_url":"https://api.github.com/users/NationalSecurityAgency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NationalSecurityAgency/timely","description":"Accumulo backed time series database","fork":false,"url":"https://api.github.com/repos/NationalSecurityAgency/timely","forks_url":"https://api.github.com/repos/NationalSecurityAgency/timely/forks","keys_url":"https://api.github.com/repos/NationalSecurityAgency/timely/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NationalSecurityAgency/timely/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NationalSecurityAgency/timely/teams","hooks_url":"https://api.github.com/repos/NationalSecurityAgency/timely/hooks","issue_events_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/events{/number}","events_url":"https://api.github.com/repos/NationalSecurityAgency/timely/events","assignees_url":"https://api.github.com/repos/NationalSecurityAgency/timely/assignees{/user}","branches_url":"https://api.github.com/repos/NationalSecurityAgency/timely/branches{/branch}","tags_url":"https://api.github.com/repos/NationalSecurityAgency/timely/tags","blobs_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/refs{/sha}","trees_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NationalSecurityAgency/timely/statuses/{sha}","languages_url":"https://api.github.com/repos/NationalSecurityAgency/timely/languages","stargazers_url":"https://api.github.com/repos/NationalSecurityAgency/timely/stargazers","contributors_url":"https://api.github.com/repos/NationalSecurityAgency/timely/contributors","subscribers_url":"https://api.github.com/repos/NationalSecurityAgency/timely/subscribers","subscription_url":"https://api.github.com/repos/NationalSecurityAgency/timely/subscription","commits_url":"https://api.github.com/repos/NationalSecurityAgency/timely/commits{/sha}","git_commits_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/commits{/sha}","comments_url":"https://api.github.com/repos/NationalSecurityAgency/timely/comments{/number}","issue_comment_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/comments{/number}","contents_url":"https://api.github.com/repos/NationalSecurityAgency/timely/contents/{+path}","compare_url":"https://api.github.com/repos/NationalSecurityAgency/timely/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NationalSecurityAgency/timely/merges","archive_url":"https://api.github.com/repos/NationalSecurityAgency/timely/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NationalSecurityAgency/timely/downloads","issues_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues{/number}","pulls_url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls{/number}","milestones_url":"https://api.github.com/repos/NationalSecurityAgency/timely/milestones{/number}","notifications_url":"https://api.github.com/repos/NationalSecurityAgency/timely/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NationalSecurityAgency/timely/labels{/name}","releases_url":"https://api.github.com/repos/NationalSecurityAgency/timely/releases{/id}","deployments_url":"https://api.github.com/repos/NationalSecurityAgency/timely/deployments","created_at":"2016-04-12T21:33:37Z","updated_at":"2016-08-26T02:13:14Z","pushed_at":"2016-08-31T18:06:05Z","git_url":"git://github.com/NationalSecurityAgency/timely.git","ssh_url":"git@github.com:NationalSecurityAgency/timely.git","clone_url":"https://github.com/NationalSecurityAgency/timely.git","svn_url":"https://github.com/NationalSecurityAgency/timely","homepage":"https://nationalsecurityagency.github.io/timely/","size":4841,"stargazers_count":29,"watchers_count":29,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":18,"forks":5,"open_issues":18,"watchers":29,"default_branch":"master"}},"base":{"label":"NationalSecurityAgency:master","ref":"master","sha":"6cd4a8bd6787cc5b912277d02b349016b6576d2f","user":{"login":"NationalSecurityAgency","id":11298292,"avatar_url":"https://avatars.githubusercontent.com/u/11298292?v=3","gravatar_id":"","url":"https://api.github.com/users/NationalSecurityAgency","html_url":"https://github.com/NationalSecurityAgency","followers_url":"https://api.github.com/users/NationalSecurityAgency/followers","following_url":"https://api.github.com/users/NationalSecurityAgency/following{/other_user}","gists_url":"https://api.github.com/users/NationalSecurityAgency/gists{/gist_id}","starred_url":"https://api.github.com/users/NationalSecurityAgency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NationalSecurityAgency/subscriptions","organizations_url":"https://api.github.com/users/NationalSecurityAgency/orgs","repos_url":"https://api.github.com/users/NationalSecurityAgency/repos","events_url":"https://api.github.com/users/NationalSecurityAgency/events{/privacy}","received_events_url":"https://api.github.com/users/NationalSecurityAgency/received_events","type":"Organization","site_admin":false},"repo":{"id":56099345,"name":"timely","full_name":"NationalSecurityAgency/timely","owner":{"login":"NationalSecurityAgency","id":11298292,"avatar_url":"https://avatars.githubusercontent.com/u/11298292?v=3","gravatar_id":"","url":"https://api.github.com/users/NationalSecurityAgency","html_url":"https://github.com/NationalSecurityAgency","followers_url":"https://api.github.com/users/NationalSecurityAgency/followers","following_url":"https://api.github.com/users/NationalSecurityAgency/following{/other_user}","gists_url":"https://api.github.com/users/NationalSecurityAgency/gists{/gist_id}","starred_url":"https://api.github.com/users/NationalSecurityAgency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NationalSecurityAgency/subscriptions","organizations_url":"https://api.github.com/users/NationalSecurityAgency/orgs","repos_url":"https://api.github.com/users/NationalSecurityAgency/repos","events_url":"https://api.github.com/users/NationalSecurityAgency/events{/privacy}","received_events_url":"https://api.github.com/users/NationalSecurityAgency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NationalSecurityAgency/timely","description":"Accumulo backed time series database","fork":false,"url":"https://api.github.com/repos/NationalSecurityAgency/timely","forks_url":"https://api.github.com/repos/NationalSecurityAgency/timely/forks","keys_url":"https://api.github.com/repos/NationalSecurityAgency/timely/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NationalSecurityAgency/timely/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NationalSecurityAgency/timely/teams","hooks_url":"https://api.github.com/repos/NationalSecurityAgency/timely/hooks","issue_events_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/events{/number}","events_url":"https://api.github.com/repos/NationalSecurityAgency/timely/events","assignees_url":"https://api.github.com/repos/NationalSecurityAgency/timely/assignees{/user}","branches_url":"https://api.github.com/repos/NationalSecurityAgency/timely/branches{/branch}","tags_url":"https://api.github.com/repos/NationalSecurityAgency/timely/tags","blobs_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/refs{/sha}","trees_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NationalSecurityAgency/timely/statuses/{sha}","languages_url":"https://api.github.com/repos/NationalSecurityAgency/timely/languages","stargazers_url":"https://api.github.com/repos/NationalSecurityAgency/timely/stargazers","contributors_url":"https://api.github.com/repos/NationalSecurityAgency/timely/contributors","subscribers_url":"https://api.github.com/repos/NationalSecurityAgency/timely/subscribers","subscription_url":"https://api.github.com/repos/NationalSecurityAgency/timely/subscription","commits_url":"https://api.github.com/repos/NationalSecurityAgency/timely/commits{/sha}","git_commits_url":"https://api.github.com/repos/NationalSecurityAgency/timely/git/commits{/sha}","comments_url":"https://api.github.com/repos/NationalSecurityAgency/timely/comments{/number}","issue_comment_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/comments{/number}","contents_url":"https://api.github.com/repos/NationalSecurityAgency/timely/contents/{+path}","compare_url":"https://api.github.com/repos/NationalSecurityAgency/timely/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NationalSecurityAgency/timely/merges","archive_url":"https://api.github.com/repos/NationalSecurityAgency/timely/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NationalSecurityAgency/timely/downloads","issues_url":"https://api.github.com/repos/NationalSecurityAgency/timely/issues{/number}","pulls_url":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls{/number}","milestones_url":"https://api.github.com/repos/NationalSecurityAgency/timely/milestones{/number}","notifications_url":"https://api.github.com/repos/NationalSecurityAgency/timely/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NationalSecurityAgency/timely/labels{/name}","releases_url":"https://api.github.com/repos/NationalSecurityAgency/timely/releases{/id}","deployments_url":"https://api.github.com/repos/NationalSecurityAgency/timely/deployments","created_at":"2016-04-12T21:33:37Z","updated_at":"2016-08-26T02:13:14Z","pushed_at":"2016-08-31T18:06:05Z","git_url":"git://github.com/NationalSecurityAgency/timely.git","ssh_url":"git@github.com:NationalSecurityAgency/timely.git","clone_url":"https://github.com/NationalSecurityAgency/timely.git","svn_url":"https://github.com/NationalSecurityAgency/timely","homepage":"https://nationalsecurityagency.github.io/timely/","size":4841,"stargazers_count":29,"watchers_count":29,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":18,"forks":5,"open_issues":18,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76"},"html":{"href":"https://github.com/NationalSecurityAgency/timely/pull/76"},"issue":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/76"},"comments":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/NationalSecurityAgency/timely/statuses/c38fb52845c2f3204791cf28617d71957560d2e9"}}}}
{"actor":{"display_login":"ivakegg"}}