Skip to content

Commit

Permalink
Merge pull request #2053 from DataDog/talwai/openstack_fix
Browse files Browse the repository at this point in the history
[integrations][openstack] tag server stats by tenant_id
  • Loading branch information
yannmh committed Nov 5, 2015
2 parents 72ab9b4 + ff44d7f commit 495d023
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions checks.d/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ def check(self, instance):

for sid in servers:
server_tags = ["nova_managed_server"]
if instance_scope.tenant_id:
server_tags.append("tenant_id:%s" % instance_scope.tenant_id)

self.external_host_tags[sid] = host_tags
self.get_stats_for_single_server(sid, tags=server_tags)

Expand Down Expand Up @@ -806,6 +809,10 @@ def get_scoped_project(self, instance):
try:
project_details = self._make_request_with_auth_fallback(url, headers, params=filter_params)
assert len(project_details["projects"]) == 1, "Non-unique project credentials"

# Set the tenant_id so we won't have to fetch it next time
project_auth_scope.tenant_id = project_details["projects"][0].get("id")

return project_details["projects"][0]
except Exception as e:
self.warning('Unable to get the list of all project ids: {0}'.format(str(e)))
Expand Down

0 comments on commit 495d023

Please sign in to comment.