{"action":"created","comment":{"url":"https://api.github.com/repos/hudl/registrator/pulls/comments/95139140","pull_request_review_id":15683430,"id":95139140,"diff_hunk":"@@ -37,16 +34,26 @@ func getDataOrFail(svc IEC2Metadata, key string) string {\n \n // GetMetadata - retrieve metadata from AWS about the current host, using IAM role\n func GetMetadata() *Metadata {\n+\n+\tif inited {\n+\t\tlog.Println(\"Returning cached metadata.\")\n+\t\treturn metadataCache\n+\t}\n+\n \tsess, err := session.NewSession()\n \tif err != nil {\n \t\tfmt.Printf(\"Unable to connect to the EC2 metadata service: %s\\n\", err)\n \t}\n \tsvc := ec2metadata.New(sess)\n-\treturn retrieveMetadata(svc)\n+\n+\tmetadataCache = retrieveMetadata(svc)","path":"aws/metadata.go","position":44,"original_position":44,"commit_id":"b59e942b7630552c6716806650a8183165115106","original_commit_id":"b59e942b7630552c6716806650a8183165115106","user":{"login":"chrisgilbert","id":361112,"avatar_url":"https://avatars.githubusercontent.com/u/361112?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisgilbert","html_url":"https://github.com/chrisgilbert","followers_url":"https://api.github.com/users/chrisgilbert/followers","following_url":"https://api.github.com/users/chrisgilbert/following{/other_user}","gists_url":"https://api.github.com/users/chrisgilbert/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisgilbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisgilbert/subscriptions","organizations_url":"https://api.github.com/users/chrisgilbert/orgs","repos_url":"https://api.github.com/users/chrisgilbert/repos","events_url":"https://api.github.com/users/chrisgilbert/events{/privacy}","received_events_url":"https://api.github.com/users/chrisgilbert/received_events","type":"User","site_admin":false},"body":"No, it doesn't need to be thread safe really - we aren't going to modify it, and it will be the same result every time, it's just to save making unnecessary calls to the AWS API (and being rate limited, etc).","created_at":"2017-01-09T11:29:25Z","updated_at":"2017-01-09T11:29:25Z","html_url":"https://github.com/hudl/registrator/pull/5#discussion_r95139140","pull_request_url":"https://api.github.com/repos/hudl/registrator/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/hudl/registrator/pulls/comments/95139140"},"html":{"href":"https://github.com/hudl/registrator/pull/5#discussion_r95139140"},"pull_request":{"href":"https://api.github.com/repos/hudl/registrator/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/hudl/registrator/pulls/5","id":100463203,"html_url":"https://github.com/hudl/registrator/pull/5","diff_url":"https://github.com/hudl/registrator/pull/5.diff","patch_url":"https://github.com/hudl/registrator/pull/5.patch","issue_url":"https://api.github.com/repos/hudl/registrator/issues/5","number":5,"state":"open","locked":false,"title":"Add ELB Unit Tests, Improve Performance","user":{"login":"chrisgilbert","id":361112,"avatar_url":"https://avatars.githubusercontent.com/u/361112?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisgilbert","html_url":"https://github.com/chrisgilbert","followers_url":"https://api.github.com/users/chrisgilbert/followers","following_url":"https://api.github.com/users/chrisgilbert/following{/other_user}","gists_url":"https://api.github.com/users/chrisgilbert/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisgilbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisgilbert/subscriptions","organizations_url":"https://api.github.com/users/chrisgilbert/orgs","repos_url":"https://api.github.com/users/chrisgilbert/repos","events_url":"https://api.github.com/users/chrisgilbert/events{/privacy}","received_events_url":"https://api.github.com/users/chrisgilbert/received_events","type":"User","site_admin":false},"body":"This PR does a couple of things:\r\n\r\n1. Add unit tests for ELBs.\r\n2. Change/improve metadata unit tests\r\n3. Add some basic caching, so AWS metadata is cached at startup (specific to host)\r\n4. Add a basic cache for ELBv2, so the AWS API will only be used when adding new containers, and not for heartbeats.\r\n","created_at":"2017-01-06T14:03:45Z","updated_at":"2017-01-09T11:29:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6db8ff8e32e06322e9725ffe58d0d3e461fd53f8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hudl/registrator/pulls/5/commits","review_comments_url":"https://api.github.com/repos/hudl/registrator/pulls/5/comments","review_comment_url":"https://api.github.com/repos/hudl/registrator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hudl/registrator/issues/5/comments","statuses_url":"https://api.github.com/repos/hudl/registrator/statuses/b59e942b7630552c6716806650a8183165115106","head":{"label":"hudl:AddELBUnitTests","ref":"AddELBUnitTests","sha":"b59e942b7630552c6716806650a8183165115106","user":{"login":"hudl","id":123340,"avatar_url":"https://avatars.githubusercontent.com/u/123340?v=3","gravatar_id":"","url":"https://api.github.com/users/hudl","html_url":"https://github.com/hudl","followers_url":"https://api.github.com/users/hudl/followers","following_url":"https://api.github.com/users/hudl/following{/other_user}","gists_url":"https://api.github.com/users/hudl/gists{/gist_id}","starred_url":"https://api.github.com/users/hudl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudl/subscriptions","organizations_url":"https://api.github.com/users/hudl/orgs","repos_url":"https://api.github.com/users/hudl/repos","events_url":"https://api.github.com/users/hudl/events{/privacy}","received_events_url":"https://api.github.com/users/hudl/received_events","type":"Organization","site_admin":false},"repo":{"id":75857520,"name":"registrator","full_name":"hudl/registrator","owner":{"login":"hudl","id":123340,"avatar_url":"https://avatars.githubusercontent.com/u/123340?v=3","gravatar_id":"","url":"https://api.github.com/users/hudl","html_url":"https://github.com/hudl","followers_url":"https://api.github.com/users/hudl/followers","following_url":"https://api.github.com/users/hudl/following{/other_user}","gists_url":"https://api.github.com/users/hudl/gists{/gist_id}","starred_url":"https://api.github.com/users/hudl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudl/subscriptions","organizations_url":"https://api.github.com/users/hudl/orgs","repos_url":"https://api.github.com/users/hudl/repos","events_url":"https://api.github.com/users/hudl/events{/privacy}","received_events_url":"https://api.github.com/users/hudl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hudl/registrator","description":"Service registry bridge for Docker with pluggable adapters","fork":true,"url":"https://api.github.com/repos/hudl/registrator","forks_url":"https://api.github.com/repos/hudl/registrator/forks","keys_url":"https://api.github.com/repos/hudl/registrator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hudl/registrator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hudl/registrator/teams","hooks_url":"https://api.github.com/repos/hudl/registrator/hooks","issue_events_url":"https://api.github.com/repos/hudl/registrator/issues/events{/number}","events_url":"https://api.github.com/repos/hudl/registrator/events","assignees_url":"https://api.github.com/repos/hudl/registrator/assignees{/user}","branches_url":"https://api.github.com/repos/hudl/registrator/branches{/branch}","tags_url":"https://api.github.com/repos/hudl/registrator/tags","blobs_url":"https://api.github.com/repos/hudl/registrator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hudl/registrator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hudl/registrator/git/refs{/sha}","trees_url":"https://api.github.com/repos/hudl/registrator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hudl/registrator/statuses/{sha}","languages_url":"https://api.github.com/repos/hudl/registrator/languages","stargazers_url":"https://api.github.com/repos/hudl/registrator/stargazers","contributors_url":"https://api.github.com/repos/hudl/registrator/contributors","subscribers_url":"https://api.github.com/repos/hudl/registrator/subscribers","subscription_url":"https://api.github.com/repos/hudl/registrator/subscription","commits_url":"https://api.github.com/repos/hudl/registrator/commits{/sha}","git_commits_url":"https://api.github.com/repos/hudl/registrator/git/commits{/sha}","comments_url":"https://api.github.com/repos/hudl/registrator/comments{/number}","issue_comment_url":"https://api.github.com/repos/hudl/registrator/issues/comments{/number}","contents_url":"https://api.github.com/repos/hudl/registrator/contents/{+path}","compare_url":"https://api.github.com/repos/hudl/registrator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hudl/registrator/merges","archive_url":"https://api.github.com/repos/hudl/registrator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hudl/registrator/downloads","issues_url":"https://api.github.com/repos/hudl/registrator/issues{/number}","pulls_url":"https://api.github.com/repos/hudl/registrator/pulls{/number}","milestones_url":"https://api.github.com/repos/hudl/registrator/milestones{/number}","notifications_url":"https://api.github.com/repos/hudl/registrator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hudl/registrator/labels{/name}","releases_url":"https://api.github.com/repos/hudl/registrator/releases{/id}","deployments_url":"https://api.github.com/repos/hudl/registrator/deployments","created_at":"2016-12-07T17:01:59Z","updated_at":"2016-12-07T17:02:00Z","pushed_at":"2017-01-06T15:20:37Z","git_url":"git://github.com/hudl/registrator.git","ssh_url":"git@github.com:hudl/registrator.git","clone_url":"https://github.com/hudl/registrator.git","svn_url":"https://github.com/hudl/registrator","homepage":"http://gliderlabs.com/registrator","size":22023,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hudl:master","ref":"master","sha":"d8606e275b4c2f836a2ea9b03ac4b331c70c8c26","user":{"login":"hudl","id":123340,"avatar_url":"https://avatars.githubusercontent.com/u/123340?v=3","gravatar_id":"","url":"https://api.github.com/users/hudl","html_url":"https://github.com/hudl","followers_url":"https://api.github.com/users/hudl/followers","following_url":"https://api.github.com/users/hudl/following{/other_user}","gists_url":"https://api.github.com/users/hudl/gists{/gist_id}","starred_url":"https://api.github.com/users/hudl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudl/subscriptions","organizations_url":"https://api.github.com/users/hudl/orgs","repos_url":"https://api.github.com/users/hudl/repos","events_url":"https://api.github.com/users/hudl/events{/privacy}","received_events_url":"https://api.github.com/users/hudl/received_events","type":"Organization","site_admin":false},"repo":{"id":75857520,"name":"registrator","full_name":"hudl/registrator","owner":{"login":"hudl","id":123340,"avatar_url":"https://avatars.githubusercontent.com/u/123340?v=3","gravatar_id":"","url":"https://api.github.com/users/hudl","html_url":"https://github.com/hudl","followers_url":"https://api.github.com/users/hudl/followers","following_url":"https://api.github.com/users/hudl/following{/other_user}","gists_url":"https://api.github.com/users/hudl/gists{/gist_id}","starred_url":"https://api.github.com/users/hudl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hudl/subscriptions","organizations_url":"https://api.github.com/users/hudl/orgs","repos_url":"https://api.github.com/users/hudl/repos","events_url":"https://api.github.com/users/hudl/events{/privacy}","received_events_url":"https://api.github.com/users/hudl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hudl/registrator","description":"Service registry bridge for Docker with pluggable adapters","fork":true,"url":"https://api.github.com/repos/hudl/registrator","forks_url":"https://api.github.com/repos/hudl/registrator/forks","keys_url":"https://api.github.com/repos/hudl/registrator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hudl/registrator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hudl/registrator/teams","hooks_url":"https://api.github.com/repos/hudl/registrator/hooks","issue_events_url":"https://api.github.com/repos/hudl/registrator/issues/events{/number}","events_url":"https://api.github.com/repos/hudl/registrator/events","assignees_url":"https://api.github.com/repos/hudl/registrator/assignees{/user}","branches_url":"https://api.github.com/repos/hudl/registrator/branches{/branch}","tags_url":"https://api.github.com/repos/hudl/registrator/tags","blobs_url":"https://api.github.com/repos/hudl/registrator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hudl/registrator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hudl/registrator/git/refs{/sha}","trees_url":"https://api.github.com/repos/hudl/registrator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hudl/registrator/statuses/{sha}","languages_url":"https://api.github.com/repos/hudl/registrator/languages","stargazers_url":"https://api.github.com/repos/hudl/registrator/stargazers","contributors_url":"https://api.github.com/repos/hudl/registrator/contributors","subscribers_url":"https://api.github.com/repos/hudl/registrator/subscribers","subscription_url":"https://api.github.com/repos/hudl/registrator/subscription","commits_url":"https://api.github.com/repos/hudl/registrator/commits{/sha}","git_commits_url":"https://api.github.com/repos/hudl/registrator/git/commits{/sha}","comments_url":"https://api.github.com/repos/hudl/registrator/comments{/number}","issue_comment_url":"https://api.github.com/repos/hudl/registrator/issues/comments{/number}","contents_url":"https://api.github.com/repos/hudl/registrator/contents/{+path}","compare_url":"https://api.github.com/repos/hudl/registrator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hudl/registrator/merges","archive_url":"https://api.github.com/repos/hudl/registrator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hudl/registrator/downloads","issues_url":"https://api.github.com/repos/hudl/registrator/issues{/number}","pulls_url":"https://api.github.com/repos/hudl/registrator/pulls{/number}","milestones_url":"https://api.github.com/repos/hudl/registrator/milestones{/number}","notifications_url":"https://api.github.com/repos/hudl/registrator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hudl/registrator/labels{/name}","releases_url":"https://api.github.com/repos/hudl/registrator/releases{/id}","deployments_url":"https://api.github.com/repos/hudl/registrator/deployments","created_at":"2016-12-07T17:01:59Z","updated_at":"2016-12-07T17:02:00Z","pushed_at":"2017-01-06T15:20:37Z","git_url":"git://github.com/hudl/registrator.git","ssh_url":"git@github.com:hudl/registrator.git","clone_url":"https://github.com/hudl/registrator.git","svn_url":"https://github.com/hudl/registrator","homepage":"http://gliderlabs.com/registrator","size":22023,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hudl/registrator/pulls/5"},"html":{"href":"https://github.com/hudl/registrator/pull/5"},"issue":{"href":"https://api.github.com/repos/hudl/registrator/issues/5"},"comments":{"href":"https://api.github.com/repos/hudl/registrator/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/hudl/registrator/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/hudl/registrator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hudl/registrator/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/hudl/registrator/statuses/b59e942b7630552c6716806650a8183165115106"}}}}
{"actor":{"display_login":"chrisgilbert"}}