{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/62035816","id":62035816,"diff_hunk":"@@ -17,24 +17,45 @@\n  */\n package org.apache.storm.metric;\n \n+import com.google.common.base.Predicate;\n+import com.google.common.collect.Iterables;\n+import com.google.common.collect.Lists;\n import org.apache.storm.Config;\n import org.apache.storm.metric.api.IMetricsConsumer;\n import org.apache.storm.task.IBolt;\n import org.apache.storm.task.OutputCollector;\n import org.apache.storm.task.TopologyContext;\n import org.apache.storm.tuple.Tuple;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n import java.util.Collection;\n+import java.util.List;\n import java.util.Map;\n+import java.util.concurrent.BlockingQueue;\n+import java.util.concurrent.LinkedBlockingDeque;\n \n public class MetricsConsumerBolt implements IBolt {\n+    public static final Logger LOG = LoggerFactory.getLogger(MetricsConsumerBolt.class);\n+\n     IMetricsConsumer _metricsConsumer;\n     String _consumerClassName;\n     OutputCollector _collector;\n     Object _registrationArgument;\n+    private final int _maxRetainMetricTuples;\n+    private Predicate<IMetricsConsumer.DataPoint> _filterPredicate;\n+\n+    private final BlockingQueue<MetricsTask> _taskQueue = new LinkedBlockingDeque<>();\n+    private Thread _taskExecuteThread;\n+    private volatile boolean _running = true;\n+\n+    public MetricsConsumerBolt(String consumerClassName, Object registrationArgument, int maxRetainMetricTuples,\n+                               Predicate<IMetricsConsumer.DataPoint> filterPredicate) {\n \n-    public MetricsConsumerBolt(String consumerClassName, Object registrationArgument) {\n         _consumerClassName = consumerClassName;\n         _registrationArgument = registrationArgument;\n+        _maxRetainMetricTuples = maxRetainMetricTuples;","path":"storm-core/src/jvm/org/apache/storm/metric/MetricsConsumerBolt.java","position":42,"original_position":42,"commit_id":"4f1d36bfcb3d8a31f7997cb40fa36680c27dc4d3","original_commit_id":"4f1d36bfcb3d8a31f7997cb40fa36680c27dc4d3","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"body":"Sure, and behavior should be documented. I'll address it.","created_at":"2016-05-04T13:14:03Z","updated_at":"2016-05-04T13:14:03Z","html_url":"https://github.com/apache/storm/pull/1324#discussion_r62035816","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/1324","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/62035816"},"html":{"href":"https://github.com/apache/storm/pull/1324#discussion_r62035816"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/1324"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/1324","id":65871854,"html_url":"https://github.com/apache/storm/pull/1324","diff_url":"https://github.com/apache/storm/pull/1324.diff","patch_url":"https://github.com/apache/storm/pull/1324.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/1324","number":1324,"state":"open","locked":false,"title":"STORM-1700 Introduce 'whitelist' / 'blacklist' option to MetricsConsumer","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"body":"> NOTE: This is based on STORM-1698, PR #1322 \r\n\r\n* Users can set whitelist or blacklist to filter out metrics by name\r\n  * if none of them specified (by default), no metrics are filtered out\r\n* how to match: substring match with regular expression\r\n  * use both ^ and $ when you want to match strictly (full string match)\r\n* added unit test\r\n\r\nI originally worked based on 1.x-branch and cherry-picked to other branch based on master. \r\nDuring cherry-picking, though I remove the changeset of common.clj, git said this file is modified.\r\nIf we want to remove this change, I'll add commit to fix this.","created_at":"2016-04-09T05:38:00Z","updated_at":"2016-05-04T13:14:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6457bfbc26f51cc3e0dc7938b42bc25d6b5cecd6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/1324/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/1324/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/1324/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/4f1d36bfcb3d8a31f7997cb40fa36680c27dc4d3","head":{"label":"HeartSaVioR:STORM-1700","ref":"STORM-1700","sha":"4f1d36bfcb3d8a31f7997cb40fa36680c27dc4d3","user":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"repo":{"id":24730103,"name":"storm","full_name":"HeartSaVioR/storm","owner":{"login":"HeartSaVioR","id":1317309,"avatar_url":"https://avatars.githubusercontent.com/u/1317309?v=3","gravatar_id":"","url":"https://api.github.com/users/HeartSaVioR","html_url":"https://github.com/HeartSaVioR","followers_url":"https://api.github.com/users/HeartSaVioR/followers","following_url":"https://api.github.com/users/HeartSaVioR/following{/other_user}","gists_url":"https://api.github.com/users/HeartSaVioR/gists{/gist_id}","starred_url":"https://api.github.com/users/HeartSaVioR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeartSaVioR/subscriptions","organizations_url":"https://api.github.com/users/HeartSaVioR/orgs","repos_url":"https://api.github.com/users/HeartSaVioR/repos","events_url":"https://api.github.com/users/HeartSaVioR/events{/privacy}","received_events_url":"https://api.github.com/users/HeartSaVioR/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HeartSaVioR/storm","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/HeartSaVioR/storm","forks_url":"https://api.github.com/repos/HeartSaVioR/storm/forks","keys_url":"https://api.github.com/repos/HeartSaVioR/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HeartSaVioR/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HeartSaVioR/storm/teams","hooks_url":"https://api.github.com/repos/HeartSaVioR/storm/hooks","issue_events_url":"https://api.github.com/repos/HeartSaVioR/storm/issues/events{/number}","events_url":"https://api.github.com/repos/HeartSaVioR/storm/events","assignees_url":"https://api.github.com/repos/HeartSaVioR/storm/assignees{/user}","branches_url":"https://api.github.com/repos/HeartSaVioR/storm/branches{/branch}","tags_url":"https://api.github.com/repos/HeartSaVioR/storm/tags","blobs_url":"https://api.github.com/repos/HeartSaVioR/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HeartSaVioR/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HeartSaVioR/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/HeartSaVioR/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HeartSaVioR/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/HeartSaVioR/storm/languages","stargazers_url":"https://api.github.com/repos/HeartSaVioR/storm/stargazers","contributors_url":"https://api.github.com/repos/HeartSaVioR/storm/contributors","subscribers_url":"https://api.github.com/repos/HeartSaVioR/storm/subscribers","subscription_url":"https://api.github.com/repos/HeartSaVioR/storm/subscription","commits_url":"https://api.github.com/repos/HeartSaVioR/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/HeartSaVioR/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/HeartSaVioR/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/HeartSaVioR/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/HeartSaVioR/storm/contents/{+path}","compare_url":"https://api.github.com/repos/HeartSaVioR/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HeartSaVioR/storm/merges","archive_url":"https://api.github.com/repos/HeartSaVioR/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HeartSaVioR/storm/downloads","issues_url":"https://api.github.com/repos/HeartSaVioR/storm/issues{/number}","pulls_url":"https://api.github.com/repos/HeartSaVioR/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/HeartSaVioR/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/HeartSaVioR/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HeartSaVioR/storm/labels{/name}","releases_url":"https://api.github.com/repos/HeartSaVioR/storm/releases{/id}","deployments_url":"https://api.github.com/repos/HeartSaVioR/storm/deployments","created_at":"2014-10-02T18:00:01Z","updated_at":"2016-01-13T23:55:58Z","pushed_at":"2016-05-03T07:01:54Z","git_url":"git://github.com/HeartSaVioR/storm.git","ssh_url":"git@github.com:HeartSaVioR/storm.git","clone_url":"https://github.com/HeartSaVioR/storm.git","svn_url":"https://github.com/HeartSaVioR/storm","homepage":null,"size":103941,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"a5369374cf2fe7b1146685bb3581098abea56f1d","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","deployments_url":"https://api.github.com/repos/apache/storm/deployments","created_at":"2013-11-05T08:00:14Z","updated_at":"2016-05-04T09:04:31Z","pushed_at":"2016-05-04T04:12:18Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":169219,"stargazers_count":3133,"watchers_count":3133,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2339,"mirror_url":"git://git.apache.org/storm.git","open_issues_count":122,"forks":2339,"open_issues":122,"watchers":3133,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/1324"},"html":{"href":"https://github.com/apache/storm/pull/1324"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/1324"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/1324/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/1324/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/1324/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/4f1d36bfcb3d8a31f7997cb40fa36680c27dc4d3"}}}}