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): Refactor session count calculation before implementing the metrics backend #29078

Merged
merged 2 commits into from
Oct 6, 2021

Conversation

RaduW
Copy link
Contributor

@RaduW RaduW commented Oct 5, 2021

Minor change to simplify session count calculation before implementing the feature in the metrics backend.

@RaduW RaduW requested review from iProgramStuff and jjbayer October 5, 2021 17:05
# compatibility with old the implementation. It doesn't make a lot of sense to me but
# since the value is saved in cache I didn't want to change the original behaviour.
session_count_last_hour = (
result_totals["data"][0]["sessions"] if result_totals["data"] else False
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, we were storing it as False in order to differentiate between when we got no data back from Snuba, and when we got a count of 0. I think this was more relevant when we weren't making an hour long bucket and dividing it by the interval (this was an optimization done after the original implementation - we used to query per interval but this ends up making a lot more queries and puts a lot more data in the cache). Just looking at the code, it seems like it would be fine if we didn't keep False now...so maybe be okay to change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the background info, I'll change it to 0... I don't think we can get 0 as a legitimate return value from the query (I might be wrong) since a row in sessions would imply at least one session.

@RaduW RaduW merged commit edccf25 into master Oct 6, 2021
@RaduW RaduW deleted the ref/event-frequency-percent branch October 6, 2021 09:18
@github-actions github-actions bot locked and limited conversation to collaborators Oct 21, 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