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

ref(releasehealth): Implement check_releases_have_health_data on metrics backend [INGEST-249] #28823

Merged
merged 6 commits into from
Sep 27, 2021

Conversation

RaduW
Copy link
Contributor

@RaduW RaduW commented Sep 24, 2021

Add check_releases_have_health_data to the metrics backend

@RaduW RaduW requested review from untitaker and jjbayer September 24, 2021 13:34
Co-authored-by: Markus Unterwaditzer <markus-honeypot@unterwaditzer.net>
Co-authored-by: Markus Unterwaditzer <markus-honeypot@unterwaditzer.net>
)

def extract_row_info(row: Mapping[str, Union[OrganizationId, str]]) -> ReleaseName:
return reverse_tag_value(organization_id, row.get(release_column_name)) # type: ignore
Copy link
Contributor

@ahmedetefy ahmedetefy Sep 26, 2021

Choose a reason for hiding this comment

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

Adding here a # type: ignore is unnecessary imo.. I'd much rather not have ReleaseName as a type and return a str here since ReleaseName is just basically an str

Copy link
Contributor

Choose a reason for hiding this comment

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

Please # type: ignore comments should not be used liberally, and there must be a good reason to actually add them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, #type: ignore should not be used liberally, it is necessary here to avoid error generated by row.get():

Argument 2 to "reverse_tag_value" has incompatible type "Union[int, str, None]"; expected "int"

Regarding the point on ReleaseName I disagree though. Any way ReleaseName is used in more APIs.

@@ -971,6 +971,10 @@ def store_session(self, session):
if status != "ok": # terminal
self._push_metric(session, "distribution", "session.duration", {}, session["duration"])

def bulk_store_sessions(self, sessions):
for session in sessions:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: self.store(session) for session in sessions

Copy link
Contributor Author

@RaduW RaduW Sep 27, 2021

Choose a reason for hiding this comment

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

Not sure what are you suggesting ?
are you suggesting:

def bulk_store_sessions(self, sessions):
         [self.store_session(session) for session in sessions ]

That would generate a list for no good reason

or:

def bulk_store_sessions(self, sessions):
         (self.store_session(session) for session in sessions)

that would create an iterator that would not do anything (since it is not iterated over).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nvm, ignore this plz.. misread, thought you were returning a list

@@ -568,7 +567,7 @@ def test_fetching_release_sessions_time_bounds_for_different_release_with_no_ses

class SnubaSessionsTestMetrics(ReleaseHealthMetricsTestCase, SnubaSessionsTest):
"""
Same tests as in SnunbaSessionsTest but using the Metrics backendx
Same tests as in SnunbaSessionsTest but using the Metrics backend
"""

pass
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this indicate that tests will be added in the future for metrics? If so I would clarify that with a ToDo comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This class runs the same tests with SnubaSessionsTest from which is derived but with the metrics backend due to it being derived from ReleaseHealthMetricsTestCase , no further code needed

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh okay, I did not get that from the comment .. I thought you were just using the class as a placeholder to write future tests.. maybe Runs the same tests as in SnubaSessionsTestClass but using the Metrics backend

@RaduW RaduW requested a review from ahmedetefy September 27, 2021 08:24
@RaduW RaduW merged commit f619395 into master Sep 27, 2021
@RaduW RaduW deleted the feat/check_releases_have_health_data branch September 27, 2021 08:57
vuluongj20 pushed a commit that referenced this pull request Sep 30, 2021
…ics backend [INGEST-249] (#28823)

Implement metrics version for check_releases_have_health_data [INGEST-249]
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants