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

Show all signature matches when trying to bucket a crash. #593

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 57 additions & 59 deletions server/crashmanager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,66 +883,64 @@ def findSignatures(request, crashid):
matchingBucket = bucket
break

# TODO: This could be made configurable through a GET parameter
if distance <= 4:
proposedCrashSignature = signature.fit(entry.crashinfo)
if proposedCrashSignature:
# We now try to determine how this signature will behave in other buckets
# If the signature matches lots of other buckets as well, it is likely too
# broad and we should not consider it (or later rate it worse than others).
matchesInOtherBuckets = 0
matchesInOtherBucketsLimitExceeded = False
nonMatchesInOtherBuckets = 0
otherMatchingBucketIds = []
for otherBucket in buckets:
if otherBucket.pk == bucket.pk:
continue

if otherBucket.pk not in firstEntryPerBucketCache:
c = CrashEntry.objects.filter(bucket=otherBucket).first()
firstEntryPerBucketCache[otherBucket.pk] = c
if c:
# Omit testcase for performance reasons for now
firstEntryPerBucketCache[otherBucket.pk] = c.getCrashInfo(attachTestcase=False)

firstEntryCrashInfo = firstEntryPerBucketCache[otherBucket.pk]
if firstEntryCrashInfo:
proposedCrashSignature = signature.fit(entry.crashinfo)
if proposedCrashSignature:
# We now try to determine how this signature will behave in other buckets
# If the signature matches lots of other buckets as well, it is likely too
# broad and we should not consider it (or later rate it worse than others).
matchesInOtherBuckets = 0
matchesInOtherBucketsLimitExceeded = False
nonMatchesInOtherBuckets = 0
otherMatchingBucketIds = []
for otherBucket in buckets:
if otherBucket.pk == bucket.pk:
continue

if otherBucket.pk not in firstEntryPerBucketCache:
c = CrashEntry.objects.filter(bucket=otherBucket).first()
firstEntryPerBucketCache[otherBucket.pk] = c
if c:
# Omit testcase for performance reasons for now
if proposedCrashSignature.matches(firstEntryCrashInfo):
matchesInOtherBuckets += 1
otherMatchingBucketIds.append(otherBucket.pk)

# We already match too many foreign buckets. Abort our search here
# to speed up the response time.
if matchesInOtherBuckets > 5:
matchesInOtherBucketsLimitExceeded = True
break
else:
nonMatchesInOtherBuckets += 1

bucket.offCount = distance

if matchesInOtherBuckets + nonMatchesInOtherBuckets > 0:
bucket.foreignMatchPercentage = round((float(matchesInOtherBuckets) / (
matchesInOtherBuckets + nonMatchesInOtherBuckets)) * 100, 2)
else:
bucket.foreignMatchPercentage = 0

bucket.foreignMatchCount = matchesInOtherBuckets
bucket.foreignMatchLimitExceeded = matchesInOtherBucketsLimitExceeded

if matchesInOtherBuckets == 0:
bucket.foreignColor = "green"
elif matchesInOtherBuckets < 3:
bucket.foreignColor = "yellow"
else:
bucket.foreignColor = "red"

# Only include the bucket in our results if the number of matches in other buckets is below
# out limit. Otherwise, it will just distract the user.
if matchesInOtherBuckets <= 5:
bucket.linkToOthers = ",".join([str(x) for x in otherMatchingBucketIds])
similarBuckets.append(bucket)
firstEntryPerBucketCache[otherBucket.pk] = c.getCrashInfo(attachTestcase=False)

firstEntryCrashInfo = firstEntryPerBucketCache[otherBucket.pk]
if firstEntryCrashInfo:
# Omit testcase for performance reasons for now
if proposedCrashSignature.matches(firstEntryCrashInfo):
matchesInOtherBuckets += 1
otherMatchingBucketIds.append(otherBucket.pk)

# We already match too many foreign buckets. Abort our search here
# to speed up the response time.
if matchesInOtherBuckets > 5:
matchesInOtherBucketsLimitExceeded = True
break
else:
nonMatchesInOtherBuckets += 1

bucket.offCount = distance

if matchesInOtherBuckets + nonMatchesInOtherBuckets > 0:
bucket.foreignMatchPercentage = round((float(matchesInOtherBuckets) / (
matchesInOtherBuckets + nonMatchesInOtherBuckets)) * 100, 2)
else:
bucket.foreignMatchPercentage = 0

bucket.foreignMatchCount = matchesInOtherBuckets
bucket.foreignMatchLimitExceeded = matchesInOtherBucketsLimitExceeded

if matchesInOtherBuckets == 0:
bucket.foreignColor = "green"
elif matchesInOtherBuckets < 3:
bucket.foreignColor = "yellow"
else:
bucket.foreignColor = "red"

# Only include the bucket in our results if the number of matches in other buckets is below
# out limit. Otherwise, it will just distract the user.
if matchesInOtherBuckets <= 5:
bucket.linkToOthers = ",".join([str(x) for x in otherMatchingBucketIds])
similarBuckets.append(bucket)

if matchingBucket:
entry.bucket = matchingBucket
Expand Down