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

Querying stack traces given a signature #16

merged 5 commits into from Mar 17, 2017

Conversation

ibrahimsharaf
Copy link
Collaborator

@ibrahimsharaf ibrahimsharaf commented Mar 17, 2017

Issue (#7)

@ibrahimsharaf ibrahimsharaf changed the title querying stack traces given a signature querying stack traces given a signature (issue #7) Mar 17, 2017
params = {
'signature': '=' + signature,
'_columns': '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.

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)):
Copy link
Owner

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:

params = {
'signature': '=' + 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

@@ -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?

@marco-c
Copy link
Owner

marco-c commented Mar 17, 2017

LGTM, there are just a couple of minor issues that flake8 is complaining about:
https://travis-ci.org/marco-c/crashsimilarity/builds/212100541#L239

@marco-c marco-c merged commit 971c7c3 into marco-c:master Mar 17, 2017
@marco-c
Copy link
Owner

marco-c commented Mar 17, 2017

Thanks!

@ibrahimsharaf ibrahimsharaf changed the title querying stack traces given a signature (issue #7) Querying stack traces given a signature Mar 19, 2017
@ibrahimsharaf ibrahimsharaf deleted the issue#7 branch November 10, 2017 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants