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

Querying stack traces given a signature #16

Merged
merged 5 commits into from Mar 17, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions crash_similarity.py
Expand Up @@ -68,18 +68,19 @@ def get_stack_trace_from_crashid(crash_id):


def get_stack_traces_for_signature(fnames, signature):
Copy link
Owner

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?

traces = set()
traces = set()

#query stack traces online
url = 'https://crash-stats.mozilla.com/api/SuperSearch'
params = {
'signature': '=' + signature,
'_columns': 'proto_signature'
'_facets': ['proto_signature'],
'_results_number' : 0
Copy link
Contributor

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

}
Copy link
Owner

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.

Copy link
Collaborator Author

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

Copy link
Owner

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.

res = utils.get_with_retries(url, params)
records = res.json()['hits']
for i in range(len(records)):
traces.add(records[i]['proto_signature'])
records = res.json()['facets']['proto_signature']
for record in records:
traces.add(record['term'])

#query stack traces from downloaded data
for fname in fnames:
Expand Down