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

Change return type from features.query. #4926

Merged
merged 1 commit into from Feb 16, 2017

Conversation

tkaemming
Copy link
Contributor

This more closely matches the upcoming API response, and reflects how people will likely actually use this function.

Before:

>>> features.query(Group.objects.get(id=550))
{'exception:message:character-shingles': [(550, 1.0)],
 'exception:stacktrace:application-chunks': [(550, 1.0)],
 'exception:stacktrace:pairs': [(550, 1.0),
  (354, 0.225),
  (355, 0.225),
  (356, 0.225),
  …

After:

>>> features.query(Group.objects.get(id=550))                                                                                                             
[(550,
  {'exception:message:character-shingles': 1.0,
   'exception:stacktrace:application-chunks': 1.0,
   'exception:stacktrace:pairs': 1.0,
   'message:message:character-shingles': 1.0}),
 (385, {'exception:stacktrace:pairs': 0.225}),
 (394, {'exception:stacktrace:pairs': 0.225}),
 …


return sorted(
results.items(),
key=lambda (id, features): sum(features.values()),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty naive, but should work well enough until we decide what kind of default weighting makes sense.

@getsentry-bot
Copy link
Contributor

1 Warning
⚠️ Changes require @getsentry/security sign-off

Security concerns found

  • src/sentry/similarity.py

Generated by 🚫 danger

Copy link
Contributor

@JTCunning JTCunning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.

@tkaemming tkaemming merged commit 4ab7eb4 into master Feb 16, 2017
@tkaemming tkaemming deleted the similarity-feature-set-query branch February 16, 2017 22:42
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants