{"action":"closed","number":103,"pull_request":{"url":"https://api.github.com/repos/influxdb/telegraf/pulls/103","id":42059043,"html_url":"https://github.com/influxdb/telegraf/pull/103","diff_url":"https://github.com/influxdb/telegraf/pull/103.diff","patch_url":"https://github.com/influxdb/telegraf/pull/103.patch","issue_url":"https://api.github.com/repos/influxdb/telegraf/issues/103","number":103,"state":"closed","locked":false,"title":"Add the ability to filter by metric tags","user":{"login":"srfraser","id":5933384,"avatar_url":"https://avatars.githubusercontent.com/u/5933384?v=3","gravatar_id":"","url":"https://api.github.com/users/srfraser","html_url":"https://github.com/srfraser","followers_url":"https://api.github.com/users/srfraser/followers","following_url":"https://api.github.com/users/srfraser/following{/other_user}","gists_url":"https://api.github.com/users/srfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/srfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srfraser/subscriptions","organizations_url":"https://api.github.com/users/srfraser/orgs","repos_url":"https://api.github.com/users/srfraser/repos","events_url":"https://api.github.com/users/srfraser/events{/privacy}","received_events_url":"https://api.github.com/users/srfraser/received_events","type":"User","site_admin":false},"body":"The original case for this was the ability to filter the disk usage stats by filesystem type, so that duplicate entries for nfs partitions, and meaningless entries like the capacity of /proc weren't submitted. \r\n\r\nIn order to do this in a way that works for any plugin, a plugin's configuration can now have two subsections: `tagpass` and `tagdrop`. \r\n\r\nAn example configuration section would look like this:\r\n```\r\n# Read metrics about disk usage by mount point\r\n[disk]\r\ninterval = \"1m\" # Run at a 1 minute interval instead of the default\r\n\r\n[disk.tagpass]\r\nfstype = [ \"ext4\", \"xfs\" ]\r\npath = [ \"/\", /opt\", \"/home\" ]\r\n\r\n[disk.tagdrop]\r\npath = [ \"/\" ]\r\n\r\n```\r\n\r\nIt's important to note that at the moment, the multiple tag filters are OR'd together, so in the example above the 'tag pass' test will succeed if the (filesystem is ext4 or xfs) or (the path is /opt or /home). The tag contents are checked as an exact match. The measurement names are tested as a prefix so that a  filter of 'foo' will catch 'foobar', 'foobaz', and so on. This didn't make as much sense with the tags, as you would encounter situations like filtering the root filesystem '/' and accidentally matching all others. \r\n\r\nAll the measurement pass and drop filters are run first, and so overrule the tag pass and drop filters. All the tag pass filters are checked, then all the tag drop filters are checked. This continues the way that the measurement name pass and drop are working. \r\n\r\nPotential points for discussion:\r\n\r\n1. I looked at a few ways of encoding this configuration in toml and thought this was the clearest, but I'm open to suggestions for improvements. \r\n2. You could make a case that with multiple tag filters, they should be 'AND' rather than 'OR'. For example, 'if the filesystem type is (ext4 or xfs) AND the path is ( / or /opt or /home )' ... \r\n","created_at":"2015-08-10T19:54:54Z","updated_at":"2015-08-11T01:23:26Z","closed_at":"2015-08-11T01:23:26Z","merged_at":null,"merge_commit_sha":"ed77c5b4d42862d28bd43395c778a2ec9ed423cc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/influxdb/telegraf/pulls/103/commits","review_comments_url":"https://api.github.com/repos/influxdb/telegraf/pulls/103/comments","review_comment_url":"https://api.github.com/repos/influxdb/telegraf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/influxdb/telegraf/issues/103/comments","statuses_url":"https://api.github.com/repos/influxdb/telegraf/statuses/e7b86be35a9763642b9e2128162c67aa3cb152a9","head":{"label":"srfraser:tagfiltering","ref":"tagfiltering","sha":"e7b86be35a9763642b9e2128162c67aa3cb152a9","user":{"login":"srfraser","id":5933384,"avatar_url":"https://avatars.githubusercontent.com/u/5933384?v=3","gravatar_id":"","url":"https://api.github.com/users/srfraser","html_url":"https://github.com/srfraser","followers_url":"https://api.github.com/users/srfraser/followers","following_url":"https://api.github.com/users/srfraser/following{/other_user}","gists_url":"https://api.github.com/users/srfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/srfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srfraser/subscriptions","organizations_url":"https://api.github.com/users/srfraser/orgs","repos_url":"https://api.github.com/users/srfraser/repos","events_url":"https://api.github.com/users/srfraser/events{/privacy}","received_events_url":"https://api.github.com/users/srfraser/received_events","type":"User","site_admin":false},"repo":{"id":39901861,"name":"telegraf","full_name":"srfraser/telegraf","owner":{"login":"srfraser","id":5933384,"avatar_url":"https://avatars.githubusercontent.com/u/5933384?v=3","gravatar_id":"","url":"https://api.github.com/users/srfraser","html_url":"https://github.com/srfraser","followers_url":"https://api.github.com/users/srfraser/followers","following_url":"https://api.github.com/users/srfraser/following{/other_user}","gists_url":"https://api.github.com/users/srfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/srfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srfraser/subscriptions","organizations_url":"https://api.github.com/users/srfraser/orgs","repos_url":"https://api.github.com/users/srfraser/repos","events_url":"https://api.github.com/users/srfraser/events{/privacy}","received_events_url":"https://api.github.com/users/srfraser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/srfraser/telegraf","description":"The plugin-driven server agent for reporting metrics into InfluxDB.","fork":true,"url":"https://api.github.com/repos/srfraser/telegraf","forks_url":"https://api.github.com/repos/srfraser/telegraf/forks","keys_url":"https://api.github.com/repos/srfraser/telegraf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/srfraser/telegraf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/srfraser/telegraf/teams","hooks_url":"https://api.github.com/repos/srfraser/telegraf/hooks","issue_events_url":"https://api.github.com/repos/srfraser/telegraf/issues/events{/number}","events_url":"https://api.github.com/repos/srfraser/telegraf/events","assignees_url":"https://api.github.com/repos/srfraser/telegraf/assignees{/user}","branches_url":"https://api.github.com/repos/srfraser/telegraf/branches{/branch}","tags_url":"https://api.github.com/repos/srfraser/telegraf/tags","blobs_url":"https://api.github.com/repos/srfraser/telegraf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/srfraser/telegraf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/srfraser/telegraf/git/refs{/sha}","trees_url":"https://api.github.com/repos/srfraser/telegraf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/srfraser/telegraf/statuses/{sha}","languages_url":"https://api.github.com/repos/srfraser/telegraf/languages","stargazers_url":"https://api.github.com/repos/srfraser/telegraf/stargazers","contributors_url":"https://api.github.com/repos/srfraser/telegraf/contributors","subscribers_url":"https://api.github.com/repos/srfraser/telegraf/subscribers","subscription_url":"https://api.github.com/repos/srfraser/telegraf/subscription","commits_url":"https://api.github.com/repos/srfraser/telegraf/commits{/sha}","git_commits_url":"https://api.github.com/repos/srfraser/telegraf/git/commits{/sha}","comments_url":"https://api.github.com/repos/srfraser/telegraf/comments{/number}","issue_comment_url":"https://api.github.com/repos/srfraser/telegraf/issues/comments{/number}","contents_url":"https://api.github.com/repos/srfraser/telegraf/contents/{+path}","compare_url":"https://api.github.com/repos/srfraser/telegraf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/srfraser/telegraf/merges","archive_url":"https://api.github.com/repos/srfraser/telegraf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/srfraser/telegraf/downloads","issues_url":"https://api.github.com/repos/srfraser/telegraf/issues{/number}","pulls_url":"https://api.github.com/repos/srfraser/telegraf/pulls{/number}","milestones_url":"https://api.github.com/repos/srfraser/telegraf/milestones{/number}","notifications_url":"https://api.github.com/repos/srfraser/telegraf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/srfraser/telegraf/labels{/name}","releases_url":"https://api.github.com/repos/srfraser/telegraf/releases{/id}","created_at":"2015-07-29T15:43:05Z","updated_at":"2015-07-29T15:43:06Z","pushed_at":"2015-08-10T23:11:27Z","git_url":"git://github.com/srfraser/telegraf.git","ssh_url":"git@github.com:srfraser/telegraf.git","clone_url":"https://github.com/srfraser/telegraf.git","svn_url":"https://github.com/srfraser/telegraf","homepage":"","size":393,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"influxdb:master","ref":"master","sha":"a3e20ab2d675308f01d147ca43fab2d5cc0f080f","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":33258973,"name":"telegraf","full_name":"influxdb/telegraf","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/telegraf","description":"The plugin-driven server agent for reporting metrics into InfluxDB.","fork":false,"url":"https://api.github.com/repos/influxdb/telegraf","forks_url":"https://api.github.com/repos/influxdb/telegraf/forks","keys_url":"https://api.github.com/repos/influxdb/telegraf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/telegraf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/telegraf/teams","hooks_url":"https://api.github.com/repos/influxdb/telegraf/hooks","issue_events_url":"https://api.github.com/repos/influxdb/telegraf/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/telegraf/events","assignees_url":"https://api.github.com/repos/influxdb/telegraf/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/telegraf/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/telegraf/tags","blobs_url":"https://api.github.com/repos/influxdb/telegraf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/telegraf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/telegraf/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/telegraf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/telegraf/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/telegraf/languages","stargazers_url":"https://api.github.com/repos/influxdb/telegraf/stargazers","contributors_url":"https://api.github.com/repos/influxdb/telegraf/contributors","subscribers_url":"https://api.github.com/repos/influxdb/telegraf/subscribers","subscription_url":"https://api.github.com/repos/influxdb/telegraf/subscription","commits_url":"https://api.github.com/repos/influxdb/telegraf/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/telegraf/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/telegraf/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/telegraf/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdb/telegraf/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/telegraf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/telegraf/merges","archive_url":"https://api.github.com/repos/influxdb/telegraf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/telegraf/downloads","issues_url":"https://api.github.com/repos/influxdb/telegraf/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/telegraf/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/telegraf/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/telegraf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/telegraf/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/telegraf/releases{/id}","created_at":"2015-04-01T16:28:44Z","updated_at":"2015-08-10T14:58:43Z","pushed_at":"2015-08-11T01:22:45Z","git_url":"git://github.com/influxdb/telegraf.git","ssh_url":"git@github.com:influxdb/telegraf.git","clone_url":"https://github.com/influxdb/telegraf.git","svn_url":"https://github.com/influxdb/telegraf","homepage":"","size":4843,"stargazers_count":378,"watchers_count":378,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":22,"forks":52,"open_issues":22,"watchers":378,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/103"},"html":{"href":"https://github.com/influxdb/telegraf/pull/103"},"issue":{"href":"https://api.github.com/repos/influxdb/telegraf/issues/103"},"comments":{"href":"https://api.github.com/repos/influxdb/telegraf/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/influxdb/telegraf/statuses/e7b86be35a9763642b9e2128162c67aa3cb152a9"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":5,"review_comments":0,"commits":7,"additions":121,"deletions":9,"changed_files":8}}