{"action":"created","comment":{"url":"https://api.github.com/repos/coredns/coredns/pulls/comments/229370493","pull_request_review_id":169855468,"id":229370493,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTM3MDQ5Mw==","diff_hunk":"@@ -22,8 +22,13 @@ type Replacer interface {\n \tSet(key, value string)\n }\n \n+// Func is the type of function in the metadata, when called they return the value of the label.\n+type Func func() string\n+\n type replacer struct {\n-\treplacements map[string]string\n+\tctx          context.Context\n+\treplacements map[string]Func   // replacements are given as function for lazy init","path":"plugin/pkg/replacer/replacer.go","position":20,"original_position":20,"commit_id":"e8952ef90d3b43252454de29498099af43600196","original_commit_id":"e8952ef90d3b43252454de29498099af43600196","user":{"login":"miekg","id":353371,"node_id":"MDQ6VXNlcjM1MzM3MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/353371?v=4","gravatar_id":"","url":"https://api.github.com/users/miekg","html_url":"https://github.com/miekg","followers_url":"https://api.github.com/users/miekg/followers","following_url":"https://api.github.com/users/miekg/following{/other_user}","gists_url":"https://api.github.com/users/miekg/gists{/gist_id}","starred_url":"https://api.github.com/users/miekg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miekg/subscriptions","organizations_url":"https://api.github.com/users/miekg/orgs","repos_url":"https://api.github.com/users/miekg/repos","events_url":"https://api.github.com/users/miekg/events{/privacy}","received_events_url":"https://api.github.com/users/miekg/received_events","type":"User","site_admin":false},"body":"yes, but this only matters for labels, to we just needs a separate map just for that. ","created_at":"2018-10-30T16:00:43Z","updated_at":"2018-10-30T16:00:44Z","html_url":"https://github.com/coredns/coredns/pull/2251#discussion_r229370493","pull_request_url":"https://api.github.com/repos/coredns/coredns/pulls/2251","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/coredns/coredns/pulls/comments/229370493"},"html":{"href":"https://github.com/coredns/coredns/pull/2251#discussion_r229370493"},"pull_request":{"href":"https://api.github.com/repos/coredns/coredns/pulls/2251"}},"in_reply_to_id":229198070},"pull_request":{"url":"https://api.github.com/repos/coredns/coredns/pulls/2251","id":226763465,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2NzYzNDY1","html_url":"https://github.com/coredns/coredns/pull/2251","diff_url":"https://github.com/coredns/coredns/pull/2251.diff","patch_url":"https://github.com/coredns/coredns/pull/2251.patch","issue_url":"https://api.github.com/repos/coredns/coredns/issues/2251","number":2251,"state":"open","locked":false,"title":"plugin/log - Support for Metadata","user":{"login":"fturib","id":19315664,"node_id":"MDQ6VXNlcjE5MzE1NjY0","avatar_url":"https://avatars1.githubusercontent.com/u/19315664?v=4","gravatar_id":"","url":"https://api.github.com/users/fturib","html_url":"https://github.com/fturib","followers_url":"https://api.github.com/users/fturib/followers","following_url":"https://api.github.com/users/fturib/following{/other_user}","gists_url":"https://api.github.com/users/fturib/gists{/gist_id}","starred_url":"https://api.github.com/users/fturib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fturib/subscriptions","organizations_url":"https://api.github.com/users/fturib/orgs","repos_url":"https://api.github.com/users/fturib/repos","events_url":"https://api.github.com/users/fturib/events{/privacy}","received_events_url":"https://api.github.com/users/fturib/received_events","type":"User","site_admin":false},"body":"- add metadata support to Log and introduce laze init for replacer\r\n\r\n### 1. Why is this pull request needed and what does it do?\r\n\r\n**Support of Metadata for plugin Log**\r\nAny place holder with a valid metadata label format : {<plugin>/<label>} we be accepted and replaced by the value of the corresponding metadata.\r\nIf metadata does not exist or provide an empty value, the default \"emptyvalue\" will be applied.\r\n\r\n**Lazy initialization**\r\nAll Placeholder values are now given with a function that will be called ONLY of the placeholder is defined in the log. It allows lazy initialization.\r\n\r\n**parsing the log format**\r\nThe process of replacement is now changed into a scan of {} and replacement placeholder by placeholder instead of the former try to replace for each possible placeholders.\r\n(side-effect of lazy-initialization)\r\n\r\n### 2. Which issues (if any) are related?\r\n#2250 \r\n\r\nNOTE: 3 place holders added recently within PR #2240 are removed:\r\n- one was already a metadata and will be interpreted directly\r\n- the 2 other are counting the number of A and AAAA records. Considered as very specific, and can now be added as metadata by who needs it. (@drazhanski : I proposed a PR for plugin AtepMonitor that can handle thoseMetadata specifics for your logging).\r\n\r\nNOTE: this PR does not transform into Metadata the standard place holders of Log. That can be done later if we wish.\r\n\r\n### 3. Which documentation changes (if any) need to be made?\r\nUpdated the README of plugin/log\r\n","created_at":"2018-10-30T01:25:23Z","updated_at":"2018-10-30T16:00:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb31b3913610e7a4a049faa0ad17fa4368b83785","assignee":null,"assignees":[],"requested_reviewers":[{"login":"johnbelamaric","id":9468083,"node_id":"MDQ6VXNlcjk0NjgwODM=","avatar_url":"https://avatars2.githubusercontent.com/u/9468083?v=4","gravatar_id":"","url":"https://api.github.com/users/johnbelamaric","html_url":"https://github.com/johnbelamaric","followers_url":"https://api.github.com/users/johnbelamaric/followers","following_url":"https://api.github.com/users/johnbelamaric/following{/other_user}","gists_url":"https://api.github.com/users/johnbelamaric/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbelamaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbelamaric/subscriptions","organizations_url":"https://api.github.com/users/johnbelamaric/orgs","repos_url":"https://api.github.com/users/johnbelamaric/repos","events_url":"https://api.github.com/users/johnbelamaric/events{/privacy}","received_events_url":"https://api.github.com/users/johnbelamaric/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/coredns/coredns/pulls/2251/commits","review_comments_url":"https://api.github.com/repos/coredns/coredns/pulls/2251/comments","review_comment_url":"https://api.github.com/repos/coredns/coredns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coredns/coredns/issues/2251/comments","statuses_url":"https://api.github.com/repos/coredns/coredns/statuses/e8952ef90d3b43252454de29498099af43600196","head":{"label":"fturib:log-metadata","ref":"log-metadata","sha":"e8952ef90d3b43252454de29498099af43600196","user":{"login":"fturib","id":19315664,"node_id":"MDQ6VXNlcjE5MzE1NjY0","avatar_url":"https://avatars1.githubusercontent.com/u/19315664?v=4","gravatar_id":"","url":"https://api.github.com/users/fturib","html_url":"https://github.com/fturib","followers_url":"https://api.github.com/users/fturib/followers","following_url":"https://api.github.com/users/fturib/following{/other_user}","gists_url":"https://api.github.com/users/fturib/gists{/gist_id}","starred_url":"https://api.github.com/users/fturib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fturib/subscriptions","organizations_url":"https://api.github.com/users/fturib/orgs","repos_url":"https://api.github.com/users/fturib/repos","events_url":"https://api.github.com/users/fturib/events{/privacy}","received_events_url":"https://api.github.com/users/fturib/received_events","type":"User","site_admin":false},"repo":{"id":102144738,"node_id":"MDEwOlJlcG9zaXRvcnkxMDIxNDQ3Mzg=","name":"coredns","full_name":"fturib/coredns","private":false,"owner":{"login":"fturib","id":19315664,"node_id":"MDQ6VXNlcjE5MzE1NjY0","avatar_url":"https://avatars1.githubusercontent.com/u/19315664?v=4","gravatar_id":"","url":"https://api.github.com/users/fturib","html_url":"https://github.com/fturib","followers_url":"https://api.github.com/users/fturib/followers","following_url":"https://api.github.com/users/fturib/following{/other_user}","gists_url":"https://api.github.com/users/fturib/gists{/gist_id}","starred_url":"https://api.github.com/users/fturib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fturib/subscriptions","organizations_url":"https://api.github.com/users/fturib/orgs","repos_url":"https://api.github.com/users/fturib/repos","events_url":"https://api.github.com/users/fturib/events{/privacy}","received_events_url":"https://api.github.com/users/fturib/received_events","type":"User","site_admin":false},"html_url":"https://github.com/fturib/coredns","description":"CoreDNS is a DNS server that chains middleware","fork":true,"url":"https://api.github.com/repos/fturib/coredns","forks_url":"https://api.github.com/repos/fturib/coredns/forks","keys_url":"https://api.github.com/repos/fturib/coredns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fturib/coredns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fturib/coredns/teams","hooks_url":"https://api.github.com/repos/fturib/coredns/hooks","issue_events_url":"https://api.github.com/repos/fturib/coredns/issues/events{/number}","events_url":"https://api.github.com/repos/fturib/coredns/events","assignees_url":"https://api.github.com/repos/fturib/coredns/assignees{/user}","branches_url":"https://api.github.com/repos/fturib/coredns/branches{/branch}","tags_url":"https://api.github.com/repos/fturib/coredns/tags","blobs_url":"https://api.github.com/repos/fturib/coredns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fturib/coredns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fturib/coredns/git/refs{/sha}","trees_url":"https://api.github.com/repos/fturib/coredns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fturib/coredns/statuses/{sha}","languages_url":"https://api.github.com/repos/fturib/coredns/languages","stargazers_url":"https://api.github.com/repos/fturib/coredns/stargazers","contributors_url":"https://api.github.com/repos/fturib/coredns/contributors","subscribers_url":"https://api.github.com/repos/fturib/coredns/subscribers","subscription_url":"https://api.github.com/repos/fturib/coredns/subscription","commits_url":"https://api.github.com/repos/fturib/coredns/commits{/sha}","git_commits_url":"https://api.github.com/repos/fturib/coredns/git/commits{/sha}","comments_url":"https://api.github.com/repos/fturib/coredns/comments{/number}","issue_comment_url":"https://api.github.com/repos/fturib/coredns/issues/comments{/number}","contents_url":"https://api.github.com/repos/fturib/coredns/contents/{+path}","compare_url":"https://api.github.com/repos/fturib/coredns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fturib/coredns/merges","archive_url":"https://api.github.com/repos/fturib/coredns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fturib/coredns/downloads","issues_url":"https://api.github.com/repos/fturib/coredns/issues{/number}","pulls_url":"https://api.github.com/repos/fturib/coredns/pulls{/number}","milestones_url":"https://api.github.com/repos/fturib/coredns/milestones{/number}","notifications_url":"https://api.github.com/repos/fturib/coredns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fturib/coredns/labels{/name}","releases_url":"https://api.github.com/repos/fturib/coredns/releases{/id}","deployments_url":"https://api.github.com/repos/fturib/coredns/deployments","created_at":"2017-09-01T19:06:18Z","updated_at":"2018-10-04T23:13:29Z","pushed_at":"2018-10-30T01:16:04Z","git_url":"git://github.com/fturib/coredns.git","ssh_url":"git@github.com:fturib/coredns.git","clone_url":"https://github.com/fturib/coredns.git","svn_url":"https://github.com/fturib/coredns","homepage":"https://coredns.io","size":87083,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coredns:master","ref":"master","sha":"8045aa279b510793a7c083a50de66e1df8871564","user":{"login":"coredns","id":21110084,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMTEwMDg0","avatar_url":"https://avatars3.githubusercontent.com/u/21110084?v=4","gravatar_id":"","url":"https://api.github.com/users/coredns","html_url":"https://github.com/coredns","followers_url":"https://api.github.com/users/coredns/followers","following_url":"https://api.github.com/users/coredns/following{/other_user}","gists_url":"https://api.github.com/users/coredns/gists{/gist_id}","starred_url":"https://api.github.com/users/coredns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coredns/subscriptions","organizations_url":"https://api.github.com/users/coredns/orgs","repos_url":"https://api.github.com/users/coredns/repos","events_url":"https://api.github.com/users/coredns/events{/privacy}","received_events_url":"https://api.github.com/users/coredns/received_events","type":"Organization","site_admin":false},"repo":{"id":54230994,"node_id":"MDEwOlJlcG9zaXRvcnk1NDIzMDk5NA==","name":"coredns","full_name":"coredns/coredns","private":false,"owner":{"login":"coredns","id":21110084,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMTEwMDg0","avatar_url":"https://avatars3.githubusercontent.com/u/21110084?v=4","gravatar_id":"","url":"https://api.github.com/users/coredns","html_url":"https://github.com/coredns","followers_url":"https://api.github.com/users/coredns/followers","following_url":"https://api.github.com/users/coredns/following{/other_user}","gists_url":"https://api.github.com/users/coredns/gists{/gist_id}","starred_url":"https://api.github.com/users/coredns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coredns/subscriptions","organizations_url":"https://api.github.com/users/coredns/orgs","repos_url":"https://api.github.com/users/coredns/repos","events_url":"https://api.github.com/users/coredns/events{/privacy}","received_events_url":"https://api.github.com/users/coredns/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/coredns/coredns","description":"CoreDNS is a DNS server that chains plugins","fork":false,"url":"https://api.github.com/repos/coredns/coredns","forks_url":"https://api.github.com/repos/coredns/coredns/forks","keys_url":"https://api.github.com/repos/coredns/coredns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coredns/coredns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coredns/coredns/teams","hooks_url":"https://api.github.com/repos/coredns/coredns/hooks","issue_events_url":"https://api.github.com/repos/coredns/coredns/issues/events{/number}","events_url":"https://api.github.com/repos/coredns/coredns/events","assignees_url":"https://api.github.com/repos/coredns/coredns/assignees{/user}","branches_url":"https://api.github.com/repos/coredns/coredns/branches{/branch}","tags_url":"https://api.github.com/repos/coredns/coredns/tags","blobs_url":"https://api.github.com/repos/coredns/coredns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coredns/coredns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coredns/coredns/git/refs{/sha}","trees_url":"https://api.github.com/repos/coredns/coredns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coredns/coredns/statuses/{sha}","languages_url":"https://api.github.com/repos/coredns/coredns/languages","stargazers_url":"https://api.github.com/repos/coredns/coredns/stargazers","contributors_url":"https://api.github.com/repos/coredns/coredns/contributors","subscribers_url":"https://api.github.com/repos/coredns/coredns/subscribers","subscription_url":"https://api.github.com/repos/coredns/coredns/subscription","commits_url":"https://api.github.com/repos/coredns/coredns/commits{/sha}","git_commits_url":"https://api.github.com/repos/coredns/coredns/git/commits{/sha}","comments_url":"https://api.github.com/repos/coredns/coredns/comments{/number}","issue_comment_url":"https://api.github.com/repos/coredns/coredns/issues/comments{/number}","contents_url":"https://api.github.com/repos/coredns/coredns/contents/{+path}","compare_url":"https://api.github.com/repos/coredns/coredns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coredns/coredns/merges","archive_url":"https://api.github.com/repos/coredns/coredns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coredns/coredns/downloads","issues_url":"https://api.github.com/repos/coredns/coredns/issues{/number}","pulls_url":"https://api.github.com/repos/coredns/coredns/pulls{/number}","milestones_url":"https://api.github.com/repos/coredns/coredns/milestones{/number}","notifications_url":"https://api.github.com/repos/coredns/coredns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coredns/coredns/labels{/name}","releases_url":"https://api.github.com/repos/coredns/coredns/releases{/id}","deployments_url":"https://api.github.com/repos/coredns/coredns/deployments","created_at":"2016-03-18T20:56:45Z","updated_at":"2018-10-30T15:47:38Z","pushed_at":"2018-10-30T01:25:24Z","git_url":"git://github.com/coredns/coredns.git","ssh_url":"git@github.com:coredns/coredns.git","clone_url":"https://github.com/coredns/coredns.git","svn_url":"https://github.com/coredns/coredns","homepage":"https://coredns.io","size":87246,"stargazers_count":2746,"watchers_count":2746,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":426,"mirror_url":null,"archived":false,"open_issues_count":77,"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":426,"open_issues":77,"watchers":2746,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coredns/coredns/pulls/2251"},"html":{"href":"https://github.com/coredns/coredns/pull/2251"},"issue":{"href":"https://api.github.com/repos/coredns/coredns/issues/2251"},"comments":{"href":"https://api.github.com/repos/coredns/coredns/issues/2251/comments"},"review_comments":{"href":"https://api.github.com/repos/coredns/coredns/pulls/2251/comments"},"review_comment":{"href":"https://api.github.com/repos/coredns/coredns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coredns/coredns/pulls/2251/commits"},"statuses":{"href":"https://api.github.com/repos/coredns/coredns/statuses/e8952ef90d3b43252454de29498099af43600196"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"miekg"}}