Skip to content

Commit

Permalink
feat(seer grouping): Add metrics for feature flag and eligible content (
Browse files Browse the repository at this point in the history
#76639)

This adds two new metrics, `grouping.similarity.event_from_backfilled_project` and `grouping.similarity.event_content_seer_eligible`, to the helpers called in `should_call_seer_for_grouping`. In order that they both always be recorded, the order of checks there has also been rearranged, so failing one of the relevant checks doesn't prevent checking the other.
  • Loading branch information
lobsterkatie authored and ArthurKnaus committed Aug 29, 2024
1 parent ab32c6f commit 885020d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/sentry/grouping/ingest/seer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ def should_call_seer_for_grouping(event: Event, primary_hashes: CalculatedHashes

project = event.project

if not _project_has_similarity_grouping_enabled(project):
return False
# Check both of these before returning based on either so we can gather metrics on their results
content_is_eligible = event_content_is_seer_eligible(event)
seer_enabled_for_project = _project_has_similarity_grouping_enabled(project)

if _has_customized_fingerprint(event, primary_hashes):
if not (content_is_eligible and seer_enabled_for_project):
return False

if not event_content_is_seer_eligible(event):
if _has_customized_fingerprint(event, primary_hashes):
return False

# **Do not add any new checks after this.** The rate limit check MUST remain the last of all the
Expand Down Expand Up @@ -70,6 +71,12 @@ def _project_has_similarity_grouping_enabled(project: Project) -> bool:
# projects have been backfilled, the option (and this check) can go away.
has_been_backfilled = project.get_option("sentry:similarity_backfill_completed")

metrics.incr(
"grouping.similarity.event_from_backfilled_project",
sample_rate=options.get("seer.similarity.metrics_sample_rate"),
tags={"backfilled": has_seer_grouping_flag_on or has_been_backfilled},
)

return has_seer_grouping_flag_on or has_been_backfilled


Expand Down
15 changes: 15 additions & 0 deletions src/sentry/seer/similarity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,26 @@ def event_content_is_seer_eligible(event: Event) -> bool:
"""
# TODO: Determine if we want to filter out non-sourcemapped events
if not event_content_has_stacktrace(event):
metrics.incr(
"grouping.similarity.event_content_seer_eligible",
sample_rate=options.get("seer.similarity.metrics_sample_rate"),
tags={"eligible": False, "blocker": "no-stacktrace"},
)
return False

if event.platform not in SEER_ELIGIBLE_PLATFORMS:
metrics.incr(
"grouping.similarity.event_content_seer_eligible",
sample_rate=options.get("seer.similarity.metrics_sample_rate"),
tags={"eligible": False, "blocker": "unsupported-platform"},
)
return False

metrics.incr(
"grouping.similarity.event_content_seer_eligible",
sample_rate=options.get("seer.similarity.metrics_sample_rate"),
tags={"eligible": True, "blocker": "none"},
)
return True


Expand Down

0 comments on commit 885020d

Please sign in to comment.