{"action":"created","comment":{"url":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments/43136080","id":43136080,"diff_hunk":"@@ -501,10 +616,33 @@ def check(self, instance):\n             self.log.debug(\"Auth Token: %s\", self._auth_token)\n \n             try:\n-                hyp_stats = self.get_hypervisor_stats()\n-                self.nova_stats_to_metrics(hyp_stats)\n+                if self._local_only:\n+                    # The new default: restrict monitoring to this (host, hypervisor, project)\n+                    # and it's guest servers\n+\n+                    hyp = self.get_local_hypervisor()\n+                    project = self.get_local_project()\n+\n+                    aggregate = self.get_aggregates_for_local_host()\n+\n+                    # Restrict monitoring to hyp and servers, don't do anything else\n+                    servers = self.get_servers_managed_by_hypervisor()\n+                    host_tags = self._get_tags_for_host()\n+\n+                    for sid in servers:\n+                        server_tags = host_tags + ['host:%s' % sid]","path":"checks.d/openstack.py","position":463,"original_position":463,"commit_id":"dd0917c1223855ddbbb5a61e9abb3405f2de34fc","original_commit_id":"dd0917c1223855ddbbb5a61e9abb3405f2de34fc","user":{"login":"talwai","id":3237580,"avatar_url":"https://avatars.githubusercontent.com/u/3237580?v=3","gravatar_id":"","url":"https://api.github.com/users/talwai","html_url":"https://github.com/talwai","followers_url":"https://api.github.com/users/talwai/followers","following_url":"https://api.github.com/users/talwai/following{/other_user}","gists_url":"https://api.github.com/users/talwai/gists{/gist_id}","starred_url":"https://api.github.com/users/talwai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talwai/subscriptions","organizations_url":"https://api.github.com/users/talwai/orgs","repos_url":"https://api.github.com/users/talwai/repos","events_url":"https://api.github.com/users/talwai/events{/privacy}","received_events_url":"https://api.github.com/users/talwai/received_events","type":"User","site_admin":false},"body":"Agreed, will fix","created_at":"2015-10-27T15:18:47Z","updated_at":"2015-10-27T15:18:47Z","html_url":"https://github.com/DataDog/dd-agent/pull/2001#discussion_r43136080","pull_request_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001","_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments/43136080"},"html":{"href":"https://github.com/DataDog/dd-agent/pull/2001#discussion_r43136080"},"pull_request":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001"}}},"pull_request":{"url":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001","id":48773853,"html_url":"https://github.com/DataDog/dd-agent/pull/2001","diff_url":"https://github.com/DataDog/dd-agent/pull/2001.diff","patch_url":"https://github.com/DataDog/dd-agent/pull/2001.patch","issue_url":"https://api.github.com/repos/DataDog/dd-agent/issues/2001","number":2001,"state":"open","locked":false,"title":"[integration] [openstack] Add project limit collection and implement agent scoping","user":{"login":"talwai","id":3237580,"avatar_url":"https://avatars.githubusercontent.com/u/3237580?v=3","gravatar_id":"","url":"https://api.github.com/users/talwai","html_url":"https://github.com/talwai","followers_url":"https://api.github.com/users/talwai/followers","following_url":"https://api.github.com/users/talwai/following{/other_user}","gists_url":"https://api.github.com/users/talwai/gists{/gist_id}","starred_url":"https://api.github.com/users/talwai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talwai/subscriptions","organizations_url":"https://api.github.com/users/talwai/orgs","repos_url":"https://api.github.com/users/talwai/repos","events_url":"https://api.github.com/users/talwai/events{/privacy}","received_events_url":"https://api.github.com/users/talwai/received_events","type":"User","site_admin":false},"body":"This PR is a rebased and updated version of @mtougeron's PR #1966 \r\nIt also incorporates a few other miscellaneous changes and fixes (apologies to reviewers for shoddy commits)\r\n\r\nIt adds the following:\r\n- Collection of project-level metrics related to limits and quotas, courtesy @mtougeron\r\n- Caching of host aggregates, which change infrequently, in between check runs. This allows us to query \r\nfor `os-aggregates` only every `CACHE_TTL` seconds, rather than at the standard interval of 15s\r\n- Proper failover of endpoints in the service catalog - we now correctly accept `internal` endpoints for \r\nNova and Neutron when `public` endpoints are not present\r\n- **IMPT - a new default** for the metric collection - local-only scoping. This is to handle the tricky case of ensuring that no two agents running in the same cluster accidentally duplicate the same metrics. This default ensures that the agent will collect metrics local to its `(physical_host, hypervisor, project)` along with guest servers contained in that scope. Any external servers / hypervisors / projects previously captured by the `check_all_*` directives will cease to be monitored. This is to ensure a manageable workload for the agent and allows it to run with fewer global permissions. The prior behavior can still be maintained by setting `local_only: false` in the `init_config` for this check.\r\n- Also ensures that metrics from local-only servers / hypervisors as collected in the default scenario, have host-level tags propagated to them to allow for better aggregation on the backend\r\n\r\ncc @mtougeron , let me know what you think!\r\n\r\n","created_at":"2015-10-26T17:52:29Z","updated_at":"2015-10-27T15:18:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83ae8159a1ac2802aa8a2199e3c40a760f312db4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001/commits","review_comments_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001/comments","review_comment_url":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/issues/2001/comments","statuses_url":"https://api.github.com/repos/DataDog/dd-agent/statuses/dd0917c1223855ddbbb5a61e9abb3405f2de34fc","head":{"label":"DataDog:pr/1966","ref":"pr/1966","sha":"dd0917c1223855ddbbb5a61e9abb3405f2de34fc","user":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","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":1210071,"name":"dd-agent","full_name":"DataDog/dd-agent","owner":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","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/dd-agent","description":"Datadog Agent","fork":false,"url":"https://api.github.com/repos/DataDog/dd-agent","forks_url":"https://api.github.com/repos/DataDog/dd-agent/forks","keys_url":"https://api.github.com/repos/DataDog/dd-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-agent/events","assignees_url":"https://api.github.com/repos/DataDog/dd-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-agent/merges","archive_url":"https://api.github.com/repos/DataDog/dd-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-agent/releases{/id}","created_at":"2010-12-31T03:02:47Z","updated_at":"2015-10-27T02:24:41Z","pushed_at":"2015-10-27T14:33:10Z","git_url":"git://github.com/DataDog/dd-agent.git","ssh_url":"git@github.com:DataDog/dd-agent.git","clone_url":"https://github.com/DataDog/dd-agent.git","svn_url":"https://github.com/DataDog/dd-agent","homepage":"http://docs.datadoghq.com/","size":54101,"stargazers_count":357,"watchers_count":357,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":311,"mirror_url":null,"open_issues_count":190,"forks":311,"open_issues":190,"watchers":357,"default_branch":"master"}},"base":{"label":"DataDog:talwai/openstack","ref":"talwai/openstack","sha":"c5159ca55078ab47f902e7335c7380c31152eb1c","user":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","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":1210071,"name":"dd-agent","full_name":"DataDog/dd-agent","owner":{"login":"DataDog","id":365230,"avatar_url":"https://avatars.githubusercontent.com/u/365230?v=3","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/dd-agent","description":"Datadog Agent","fork":false,"url":"https://api.github.com/repos/DataDog/dd-agent","forks_url":"https://api.github.com/repos/DataDog/dd-agent/forks","keys_url":"https://api.github.com/repos/DataDog/dd-agent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataDog/dd-agent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataDog/dd-agent/teams","hooks_url":"https://api.github.com/repos/DataDog/dd-agent/hooks","issue_events_url":"https://api.github.com/repos/DataDog/dd-agent/issues/events{/number}","events_url":"https://api.github.com/repos/DataDog/dd-agent/events","assignees_url":"https://api.github.com/repos/DataDog/dd-agent/assignees{/user}","branches_url":"https://api.github.com/repos/DataDog/dd-agent/branches{/branch}","tags_url":"https://api.github.com/repos/DataDog/dd-agent/tags","blobs_url":"https://api.github.com/repos/DataDog/dd-agent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataDog/dd-agent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataDog/dd-agent/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataDog/dd-agent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataDog/dd-agent/statuses/{sha}","languages_url":"https://api.github.com/repos/DataDog/dd-agent/languages","stargazers_url":"https://api.github.com/repos/DataDog/dd-agent/stargazers","contributors_url":"https://api.github.com/repos/DataDog/dd-agent/contributors","subscribers_url":"https://api.github.com/repos/DataDog/dd-agent/subscribers","subscription_url":"https://api.github.com/repos/DataDog/dd-agent/subscription","commits_url":"https://api.github.com/repos/DataDog/dd-agent/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataDog/dd-agent/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataDog/dd-agent/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataDog/dd-agent/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataDog/dd-agent/contents/{+path}","compare_url":"https://api.github.com/repos/DataDog/dd-agent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataDog/dd-agent/merges","archive_url":"https://api.github.com/repos/DataDog/dd-agent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataDog/dd-agent/downloads","issues_url":"https://api.github.com/repos/DataDog/dd-agent/issues{/number}","pulls_url":"https://api.github.com/repos/DataDog/dd-agent/pulls{/number}","milestones_url":"https://api.github.com/repos/DataDog/dd-agent/milestones{/number}","notifications_url":"https://api.github.com/repos/DataDog/dd-agent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataDog/dd-agent/labels{/name}","releases_url":"https://api.github.com/repos/DataDog/dd-agent/releases{/id}","created_at":"2010-12-31T03:02:47Z","updated_at":"2015-10-27T02:24:41Z","pushed_at":"2015-10-27T14:33:10Z","git_url":"git://github.com/DataDog/dd-agent.git","ssh_url":"git@github.com:DataDog/dd-agent.git","clone_url":"https://github.com/DataDog/dd-agent.git","svn_url":"https://github.com/DataDog/dd-agent","homepage":"http://docs.datadoghq.com/","size":54101,"stargazers_count":357,"watchers_count":357,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":311,"mirror_url":null,"open_issues_count":190,"forks":311,"open_issues":190,"watchers":357,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001"},"html":{"href":"https://github.com/DataDog/dd-agent/pull/2001"},"issue":{"href":"https://api.github.com/repos/DataDog/dd-agent/issues/2001"},"comments":{"href":"https://api.github.com/repos/DataDog/dd-agent/issues/2001/comments"},"review_comments":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001/comments"},"review_comment":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataDog/dd-agent/pulls/2001/commits"},"statuses":{"href":"https://api.github.com/repos/DataDog/dd-agent/statuses/dd0917c1223855ddbbb5a61e9abb3405f2de34fc"}}}}