{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments/199218814","pull_request_review_id":133299921,"id":199218814,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTIxODgxNA==","diff_hunk":"@@ -0,0 +1,51 @@\n+// Unless explicitly stated otherwise all files in this repository are licensed\n+// under the Apache License Version 2.0.\n+// This product includes software developed at Datadog (https://www.datadoghq.com/).\n+// Copyright 2018 Datadog, Inc.\n+\n+package tmplvar","path":"pkg/util/tmplvar/parse.go","position":6,"original_position":6,"commit_id":"8d7e093bda8d427192e2ec537bcfa9e86dc07fac","original_commit_id":"8d7e093bda8d427192e2ec537bcfa9e86dc07fac","user":{"login":"devonboyer","id":5367914,"node_id":"MDQ6VXNlcjUzNjc5MTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5367914?v=4","gravatar_id":"","url":"https://api.github.com/users/devonboyer","html_url":"https://github.com/devonboyer","followers_url":"https://api.github.com/users/devonboyer/followers","following_url":"https://api.github.com/users/devonboyer/following{/other_user}","gists_url":"https://api.github.com/users/devonboyer/gists{/gist_id}","starred_url":"https://api.github.com/users/devonboyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devonboyer/subscriptions","organizations_url":"https://api.github.com/users/devonboyer/orgs","repos_url":"https://api.github.com/users/devonboyer/repos","events_url":"https://api.github.com/users/devonboyer/events{/privacy}","received_events_url":"https://api.github.com/users/devonboyer/received_events","type":"User","site_admin":false},"body":"All this code was pulled out of `autodiscovery` so it can be used by the `tagger` too.","created_at":"2018-06-29T16:47:07Z","updated_at":"2018-06-29T16:47:07Z","html_url":"https://github.com/DataDog/datadog-agent/pull/1916#discussion_r199218814","pull_request_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments/199218814"},"html":{"href":"https://github.com/DataDog/datadog-agent/pull/1916#discussion_r199218814"},"pull_request":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916","id":198367309,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MzY3MzA5","html_url":"https://github.com/DataDog/datadog-agent/pull/1916","diff_url":"https://github.com/DataDog/datadog-agent/pull/1916.diff","patch_url":"https://github.com/DataDog/datadog-agent/pull/1916.patch","issue_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1916","number":1916,"state":"open","locked":false,"title":"Add wildcard support to label to tag mappings for containers.","user":{"login":"devonboyer","id":5367914,"node_id":"MDQ6VXNlcjUzNjc5MTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5367914?v=4","gravatar_id":"","url":"https://api.github.com/users/devonboyer","html_url":"https://github.com/devonboyer","followers_url":"https://api.github.com/users/devonboyer/followers","following_url":"https://api.github.com/users/devonboyer/following{/other_user}","gists_url":"https://api.github.com/users/devonboyer/gists{/gist_id}","starred_url":"https://api.github.com/users/devonboyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devonboyer/subscriptions","organizations_url":"https://api.github.com/users/devonboyer/orgs","repos_url":"https://api.github.com/users/devonboyer/repos","events_url":"https://api.github.com/users/devonboyer/events{/privacy}","received_events_url":"https://api.github.com/users/devonboyer/received_events","type":"User","site_admin":false},"body":"### What does this PR do?\r\n\r\nWe currently have the env var `DD_KUBERNETES_POD_LABELS_AS_TAGS` in Agent 6, which allows people to map a pod label to any tag name. This gives users a lot more freedom than a blacklist and label-to-tag prefix (like Agent 5) and I wanted to keep this freedom. \r\n\r\nThis PR allows wildcards in `DD_KUBERNETES_POD_LABELS_AS_TAGS`, for example `{\"app*\",\"kube_%%label%%\"}` would resolve to the tag `kube_application:value` for the label `application`. More interestingly `{\"*\", \"kube_%%label%%\"}` would add all pod labels as tags prefixed with `kube_`.\r\n\r\n### Potential problems\r\n\r\n- This feature would have to continue to be maintained and supported\r\n- This could potentially add a lot more tags to Kubernetes metrics if wildcards are used recklessly\r\n- This feature may not always give \"clean\" tag names, for example, a rule like `{\"com.docker.swarm.*\":\"swarm_%%label%%\"}` would resolve this label `com.docker.swarm.node.id`  to `swarm_com.docker.swarm.node.id`\r\n\r\n### Other solutions\r\n\r\n- We could add env vars like `DD_KUBERNETES_EXCLUDE_POD_LABELS_AS_TAGS` and `DD_KUBERNETES_LABEL_TO_TAG_PREFIX` to give the same behaviour as Agent 5. The problem is that users have much less freedom for how a label name is mapped to a tag name and the issue I previously mentioned about \"clean\" tag names still exists here.\r\n\r\n### Motivation\r\n\r\nAgent 5 supported the ability to easily add all pod labels as tags. This adds a similar feature to Agent 6 with a bit more freedom for the user.\r\n\r\n### Additional Notes\r\n\r\nThis is still a WIP for the purposes of gathering feedback to validate the idea.\r\n\r\nThis feature could also be added for all of \r\n\r\n- `DD_DOCKER_LABELS_AS_TAGS`\r\n- `DD_DOCKER_ENV_AS_TAGS`\r\n- `DD_KUBERNETES_POD_LABELS_AS_TAGS`\r\n- `DD_KUBERNETES_POD_ANNOTATIONS_AS_TAGS`\r\n","created_at":"2018-06-29T16:33:58Z","updated_at":"2018-06-29T16:47:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3548fedc7444dfb04603986ef65c7526ab32985","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[{"name":"agent-core","id":1224133,"node_id":"MDQ6VGVhbTEyMjQxMzM=","slug":"agent-core","description":"(formerly Croissant) Core Infra Agent and Agent packaging","privacy":"closed","url":"https://api.github.com/teams/1224133","members_url":"https://api.github.com/teams/1224133/members{/member}","repositories_url":"https://api.github.com/teams/1224133/repos","permission":"pull"},{"name":"container-integrations","id":2380322,"node_id":"MDQ6VGVhbTIzODAzMjI=","slug":"container-integrations","description":"(formerly kenafeh) containers and their orchestrators","privacy":"closed","url":"https://api.github.com/teams/2380322","members_url":"https://api.github.com/teams/2380322/members{/member}","repositories_url":"https://api.github.com/teams/2380322/repos","permission":"pull"}],"labels":[{"id":571127627,"node_id":"MDU6TGFiZWw1NzExMjc2Mjc=","url":"https://api.github.com/repos/DataDog/datadog-agent/labels/do-not-merge/WIP","name":"do-not-merge/WIP","color":"000000","default":false}],"milestone":{"url":"https://api.github.com/repos/DataDog/datadog-agent/milestones/28","html_url":"https://github.com/DataDog/datadog-agent/milestone/28","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/milestones/28/labels","id":3411180,"node_id":"MDk6TWlsZXN0b25lMzQxMTE4MA==","number":28,"title":"6.4.0","description":null,"creator":{"login":"antoinepouille","id":25852569,"node_id":"MDQ6VXNlcjI1ODUyNTY5","avatar_url":"https://avatars0.githubusercontent.com/u/25852569?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinepouille","html_url":"https://github.com/antoinepouille","followers_url":"https://api.github.com/users/antoinepouille/followers","following_url":"https://api.github.com/users/antoinepouille/following{/other_user}","gists_url":"https://api.github.com/users/antoinepouille/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinepouille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinepouille/subscriptions","organizations_url":"https://api.github.com/users/antoinepouille/orgs","repos_url":"https://api.github.com/users/antoinepouille/repos","events_url":"https://api.github.com/users/antoinepouille/events{/privacy}","received_events_url":"https://api.github.com/users/antoinepouille/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":9,"state":"open","created_at":"2018-06-08T15:22:32Z","updated_at":"2018-06-29T16:44:05Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916/commits","review_comments_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916/comments","review_comment_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1916/comments","statuses_url":"https://api.github.com/repos/DataDog/datadog-agent/statuses/8d7e093bda8d427192e2ec537bcfa9e86dc07fac","head":{"label":"DataDog:devon/pod-labels-as-tags","ref":"devon/pod-labels-as-tags","sha":"8d7e093bda8d427192e2ec537bcfa9e86dc07fac","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":49970739,"node_id":"MDEwOlJlcG9zaXRvcnk0OTk3MDczOQ==","name":"datadog-agent","full_name":"DataDog/datadog-agent","owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/datadog-agent","description":"Datadog Agent ","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-agent/deployments","created_at":"2016-01-19T17:40:41Z","updated_at":"2018-06-29T15:28:40Z","pushed_at":"2018-06-29T16:37:21Z","git_url":"git://github.com/DataDog/datadog-agent.git","ssh_url":"git@github.com:DataDog/datadog-agent.git","clone_url":"https://github.com/DataDog/datadog-agent.git","svn_url":"https://github.com/DataDog/datadog-agent","homepage":"https://docs.datadoghq.com/","size":19549,"stargazers_count":198,"watchers_count":198,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":103,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":75,"open_issues":103,"watchers":198,"default_branch":"master"}},"base":{"label":"DataDog:master","ref":"master","sha":"30c1fbb8dba61cdb223a19e768f4bd4d4317335f","user":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"repo":{"id":49970739,"node_id":"MDEwOlJlcG9zaXRvcnk0OTk3MDczOQ==","name":"datadog-agent","full_name":"DataDog/datadog-agent","owner":{"login":"DataDog","id":365230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2NTIzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/365230?v=4","gravatar_id":"","url":"https://api.github.com/users/DataDog","html_url":"https://github.com/DataDog","followers_url":"https://api.github.com/users/DataDog/followers","following_url":"https://api.github.com/users/DataDog/following{/other_user}","gists_url":"https://api.github.com/users/DataDog/gists{/gist_id}","starred_url":"https://api.github.com/users/DataDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataDog/subscriptions","organizations_url":"https://api.github.com/users/DataDog/orgs","repos_url":"https://api.github.com/users/DataDog/repos","events_url":"https://api.github.com/users/DataDog/events{/privacy}","received_events_url":"https://api.github.com/users/DataDog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataDog/datadog-agent","description":"Datadog Agent ","fork":false,"url":"https://api.github.com/repos/DataDog/datadog-agent","forks_url":"https://api.github.com/repos/DataDog/datadog-agent/forks","keys_url":"https://api.github.com/repos/DataDog/datadog-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/datadog-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/datadog-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/datadog-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/datadog-agent/events","assignees_url":"https://api.github.com/repos/DataDog/datadog-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/datadog-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/datadog-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/datadog-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/datadog-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/datadog-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/datadog-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/datadog-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/datadog-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/datadog-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/datadog-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/datadog-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/datadog-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/datadog-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/datadog-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/datadog-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/datadog-agent/merges","archive_url":"https://api.github.com/repos/DataDog/datadog-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/datadog-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/datadog-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/datadog-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/datadog-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/datadog-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/datadog-agent/releases{/id}","deployments_url":"https://api.github.com/repos/DataDog/datadog-agent/deployments","created_at":"2016-01-19T17:40:41Z","updated_at":"2018-06-29T15:28:40Z","pushed_at":"2018-06-29T16:37:21Z","git_url":"git://github.com/DataDog/datadog-agent.git","ssh_url":"git@github.com:DataDog/datadog-agent.git","clone_url":"https://github.com/DataDog/datadog-agent.git","svn_url":"https://github.com/DataDog/datadog-agent","homepage":"https://docs.datadoghq.com/","size":19549,"stargazers_count":198,"watchers_count":198,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":103,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":75,"open_issues":103,"watchers":198,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916"},"html":{"href":"https://github.com/DataDog/datadog-agent/pull/1916"},"issue":{"href":"https://api.github.com/repos/DataDog/datadog-agent/issues/1916"},"comments":{"href":"https://api.github.com/repos/DataDog/datadog-agent/issues/1916/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/datadog-agent/pulls/1916/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/datadog-agent/statuses/8d7e093bda8d427192e2ec537bcfa9e86dc07fac"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"devonboyer"}}