Skip to content

Commit

Permalink
Add space_id and org_id tags in addition to space_guid and org_guid (D…
Browse files Browse the repository at this point in the history
  • Loading branch information
Slavek Kabrda authored Aug 20, 2020
1 parent f28c24c commit 3a500e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,22 @@ def build_dd_event(
org_guid,
):
# type: (str, str, int, str, str, str, str, str, str, str, str) -> Event
space_id = space_guid if space_guid else "none"
org_id = org_guid if org_guid else "none"
# we include both space_guid+space_id and org_guid+org_id; the *_guid are kept for
# backwards compatibility, the *_id are added to maintain consistency with
# https://github.com/DataDog/datadog-firehose-nozzle
tags = [
"event_type:{}".format(event_type),
"{}_name:{}".format(target_type, target_name),
"{}_guid:{}".format(target_type, target_guid),
"{}_name:{}".format(actor_type, actor_name),
"{}_guid:{}".format(actor_type, actor_guid),
"space_guid:{}".format(space_guid if space_guid else "none"),
"space_guid:{}".format(space_id),
"space_id:{}".format(space_id),
"space_name:{}".format(self.get_space_name(space_guid) if space_guid else "none"),
"org_guid:{}".format(org_guid if org_guid else "none"),
"org_guid:{}".format(org_id),
"org_id:{}".format(org_id),
"org_name:{}".format(self.get_org_name(org_guid) if org_guid else "none"),
] + self._tags
dd_event = {
Expand Down
4 changes: 4 additions & 0 deletions cloud_foundry_api/tests/test_cloud_foundry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,10 @@ def test_build_dd_event(_, __, ___, instance):
"actor_type_name:actor_name",
"actor_type_guid:actor_guid",
"space_guid:space_guid",
"space_id:space_guid",
"space_name:space_name",
"org_guid:org_guid",
"org_id:org_guid",
"org_name:org_name",
"foo:bar",
]
Expand Down Expand Up @@ -478,8 +480,10 @@ def test_build_dd_event(_, __, ___, instance):
"actor_type_name:actor_name",
"actor_type_guid:actor_guid",
"space_guid:none",
"space_id:none",
"space_name:none",
"org_guid:none",
"org_id:none",
"org_name:none",
"foo:bar",
]
Expand Down

0 comments on commit 3a500e7

Please sign in to comment.