-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
PTAL |
There was a problem hiding this 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 🎉
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.
A bunch of refactoring still, but I think this is more or less my first proposal at the logic.