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

feat(symbolication): Selection logic for low priority queue [NATIVE-211] #29258

Merged
merged 27 commits into from
Oct 20, 2021

Conversation

flub
Copy link
Contributor

@flub flub commented Oct 12, 2021

A bunch of refactoring still, but I think this is more or less my first proposal at the logic.

@flub flub requested review from relaxolotl, loewenheim and a team October 12, 2021 13:13
otherwise mypy isn't very happy.  Though I would be because I'd get a
nice sentry error when it would be broken.  Now I'll still get that
but mypy wasn't smart enough to spot that...
Co-authored-by: Sebastian Zivota <loewenheim@users.noreply.github.com>

@dataclasses.dataclass(frozen=True)
class DurationHistogram:
def rate(self, period: Union[int, _Period] = TOTAL_PERIOD) -> float:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@loewenheim since you asked about tagged unions in python. I think generally you don't but duck-type instead. It seems with mypy this looks something like this. It was a little easier before mypy, the class attribute would have been simply TOTAL_PERIOD = object() and you get a singleton you can compare with is. Apparently with mypy you need to do this kind of enum-with-one-variant thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Rust-like tagged union would have been an arg of type:

enum Period {
    Total,
    Partial(u32),
}

in case you're lost why i bring this up here.

They're kind of covered already, since we already asserted a spike
does not break through a low rate.  But I guess it doesn't do any harm.
@flub
Copy link
Contributor Author

flub commented Oct 18, 2021

PTAL

Copy link
Contributor

@relaxolotl relaxolotl left a comment

Choose a reason for hiding this comment

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

thanks for making these changes and going through all of the suggestions 🎉

@flub
Copy link
Contributor Author

flub commented Oct 19, 2021

thanks for making these changes and going through all of the suggestions 🎉

Thanks for the thorough review!

Also, I completely forgot to commit this new test file before.  Oops.
Without these the tests are not in a package and file names result in
conflicting test names.
@flub flub merged commit d9dd570 into master Oct 20, 2021
@flub flub deleted the lpq/computation branch October 20, 2021 08:00
@github-actions github-actions bot locked and limited conversation to collaborators Nov 4, 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.

4 participants