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
Querying stack traces given a signature #16
Conversation
crash_similarity.py
Outdated
params = { | ||
'signature': '=' + signature, | ||
'_columns': 'proto_signature' | ||
} |
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.
Instead of using _columns
, which will also return duplicate results, we could use _facets
: https://crash-stats.mozilla.com/documentation/supersearch/api/#param-_facets.
The default number of facets returned is 50, we can increase it using the _facets_size
parameter: https://crash-stats.mozilla.com/documentation/supersearch/api/#param-_facets_size.
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.
I am trying using
params = { 'signature': '=' + signature, '_facets': ['proto_signature'] }
but the response doesn't contain proto_signature
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 result will be in res.json()['facets']
instead of res.json()['hits']
, see for example: https://crash-stats.mozilla.com/api/SuperSearch/?signature=%3Djs::jit::ICStub::trace&_facets=proto_signature.
Also, you can add _results_number=0
to make the query less expensive: https://crash-stats.mozilla.com/api/SuperSearch/?signature=%3Djs::jit::ICStub::trace&_facets=proto_signature&_results_number=0.
crash_similarity.py
Outdated
} | ||
res = utils.get_with_retries(url, params) | ||
records = res.json()['hits'] | ||
for i in range(len(records)): |
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: you could directly iterate the records: for record in records:
crash_similarity.py
Outdated
params = { | ||
'signature': '=' + signature, | ||
'_facets': ['proto_signature'], | ||
'_results_number' : 0 |
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.
PEP8: no spaces before :
in dict
crash_similarity.py
Outdated
@@ -68,18 +68,19 @@ def get_stack_trace_from_crashid(crash_id): | |||
|
|||
|
|||
def get_stack_traces_for_signature(fnames, signature): |
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.
Can you add a parameter, traces_num
, with a default of 100, and use it in the request with _facets_size
?
LGTM, there are just a couple of minor issues that flake8 is complaining about: |
Thanks! |
Issue (#7)