-
-
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
test(metrics): Write all session metrics in test [INGEST-386] #28667
Conversation
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.
Generally looks good.
The only think that I think is questionable is instantiating typings.DefaultDict.
Didn't follow in details the tests but the changes seem reasonable
@@ -1,4 +1,5 @@ | |||
from typing import Optional | |||
import itertools | |||
from typing import DefaultDict, Optional |
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.
Shouldn't you import defaultdict
from collections rather than this, since you are not using
it as typeinfo but you are instantiating it
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.
Whoops yes, this was an auto-import I did not pay attention to.
@@ -18,25 +19,43 @@ | |||
"staging": 10, | |||
"user": 11, | |||
"init": 12, | |||
"session.error": 13, | |||
} |
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.
Nit. Why a dictionary here since all the indexes are sequential, a simple array would do (and just use the index in the array as the value).
|
||
def __init__(self): | ||
self._counter = itertools.count(start=len(_STRINGS)) | ||
self._strings = DefaultDict(self._counter.__next__) |
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.
As commented above I don't think typings.DefaultDict
is supposed to be used like this, could we use collections.defaultdict
instead ?
Write more session metrics to snuba in metrics test case, mimicking the
extract_session_metrics
function in relay.This prepares for https://getsentry.atlassian.net/browse/INGEST-386.