Skip to content

Conversation

@shayna-ch
Copy link
Member

@shayna-ch shayna-ch commented Dec 1, 2025

create a default metric monitor for new projects

with these settings:
image

  • Default assignee is the team that is assigned to the project
  • Defaults to event.type is error
  • Enabled on creation
  • 15 minute interval, low sensitivity, above bounds only

Feature Flag organizations:default-anomaly-detector

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 89.83051% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/receivers/project_detectors.py 80.00% 4 Missing ⚠️
src/sentry/workflow_engine/processors/detector.py 94.73% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #104208      +/-   ##
===========================================
+ Coverage   80.50%    80.61%   +0.11%     
===========================================
  Files        9342      9344       +2     
  Lines      399240    400731    +1491     
  Branches    25560     25560              
===========================================
+ Hits       321408    323056    +1648     
+ Misses      77383     77226     -157     
  Partials      449       449              

@shayna-ch shayna-ch changed the title feat(anomaly detection): create default detector for new projects feat(default detector): create default detector for new projects Dec 8, 2025
@shayna-ch shayna-ch marked this pull request as ready for review December 8, 2025 18:46
@shayna-ch shayna-ch requested a review from a team as a code owner December 8, 2025 18:46
@shayna-ch shayna-ch requested a review from a team December 8, 2025 18:46
Copy link
Member

@roggenkemper roggenkemper left a comment

Choose a reason for hiding this comment

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

is there a test we can add for this?

Comment on lines +78 to +80
detector = _ensure_metric_detector(
project, owner_team_id=owner_team.id if owner_team else None, enabled=enabled
)
Copy link
Member

Choose a reason for hiding this comment

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

Is this so that an org on a plan w/o anomaly detection would have the default detector in the case that they do upgrade? FYI I have a task in my team's backlog to address an edge case I think you're likely to hit here - Seer won't keep data on detectors they're not receiving updates for over 90 days for, so when they upgrade the alert might not work. Here is the task: https://getsentry.atlassian.net/browse/ACI-528

Copy link
Member Author

Choose a reason for hiding this comment

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

will follow up

assert detector.enabled is True

def test_send_new_detector_data_failure_does_not_block_creation(self):
"""Test that detector is still created even if sending data to Seer fails."""
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you'd actually want this to happen - if sending the data to Seer fails then it will not function. However, it might be worth checking with the Seer team since as I mentioned in a previous comment a new project isn't likely to have historical data anyway so maybe it is ok since we wouldn't expect this monitor to function for 28 days - I can't remember if it'd be ok on their end if they suddenly start getting data on a monitor they don't have any previous data for though, I think they might rely on having the previous historical data though.

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch - I will have it skip creating a detector if sending data to seer fails for now and follow up with seer team

shayna-ch and others added 3 commits December 10, 2025 14:59
Co-authored-by: Colleen O'Rourke <colleen@sentry.io>
Co-authored-by: Colleen O'Rourke <colleen@sentry.io>
Co-authored-by: Colleen O'Rourke <colleen@sentry.io>
@shayna-ch shayna-ch merged commit b63d68e into master Dec 11, 2025
67 checks passed
@shayna-ch shayna-ch deleted the shayna-ch/create-default-detector branch December 11, 2025 21:41
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants