Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add space and org names as tags to events #7297

Merged
merged 5 commits into from
Aug 7, 2020
Merged

Add space and org names as tags to events #7297

merged 5 commits into from
Aug 7, 2020

Conversation

zippolyte
Copy link
Contributor

What does this PR do?

Fetch org and space names from Cloud Controller API to add as tags to events

Motivation

Customer request

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@zippolyte zippolyte changed the title Add space and org names as tags Add space and org names as tags to events Aug 5, 2020
Copy link
Contributor

@bkabrda bkabrda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good, I just have one suggestion for refactoring - left a comment inline.

params = {
"results-per-page": MAX_PAGE_SIZE_V2,
}
headers = {"Authorization": "Bearer {}".format(self._oauth_token)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this line is repeated multiple times. Maybe we can create a utility function get_auth_headers that would refresh the get_oauth_token and return this dict?

event_guid = ""
event_ts = 0

if self._api_version == "v2":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a shame that you have to put back that code in the check itself. I like that you started hiding some of the v2/v3 differences. Ideally, all of it would be hidden in the check class, and we'd use some utilities. This is probably a bigger refactoring that can be done later though.

if not next_url:
break
page += 1
finally:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you remove the try/finally and just do the service_check at the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no because for events for instance, we break before the generator is exhausted, so we never reach the service check line in that case

@codecov
Copy link

codecov bot commented Aug 6, 2020

@hithwen hithwen merged commit 7cfcef1 into master Aug 7, 2020
@hithwen hithwen deleted the hippo/osnt branch August 7, 2020 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants