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

feat(uptime): Tasks for automatic hostname detection and monitoring #73258

Merged
merged 3 commits into from
Jun 25, 2024

Conversation

wedamija
Copy link
Member

This implements most of the second half of automatic hostname detection and monitoring. It has a few components:

  • schedule_detections runs every minute. It looks at the last time it was run, and fires off tasks for each minute bucket.
  • process_detection_bucket runs for a specific datetime bucket. It just fetches all projects from this bucket and fires process_project_url_ranking for each of them. Note that each project will only belong to a single bucket.
  • process_project_url_ranking runs for a specific project. This is where the meat of the logic exists. We get the ranked list of urls collected from this project's event data and run it through various criteria to see whether we should attempt to monitor the url

There are a fair few todos around that I need to finish up, as well as building the logic to send subscriptions to the topic for our rust consumer.

@wedamija wedamija requested a review from a team June 25, 2024 06:08
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 25, 2024
delete_candidate_urls_for_project(project)


def check_url(project: Project, project_url_count: int, url: str, url_count: int) -> bool:
Copy link
Member Author

Choose a reason for hiding this comment

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

Tbh I'd prefer to break most of the logic out of tasks.py but just haven't gotten around to it yet.

This implements most of the second half of automatic hostname detection and monitoring. It has a few components:
 - `schedule_detections` runs every minute. It looks at the last time it was run, and fires off tasks for each minute bucket.
 - `process_detection_bucket` runs for a specific datetime bucket. It just fetches all projects from this bucket and fires `process_project_url_ranking` for each of them. Note that each project will only belong to a single bucket.
 - `process_project_url_ranking` runs for a specific project. This is where the meat of the logic exists. We get the ranked list of urls collected from this project's event data and run it through various criteria to see whether we should attempt to monitor the url

There are a fair few todos around that I need to finish up, as well as building the logic to send subscriptions to the topic for our rust consumer.
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

Attention: Patch coverage is 98.07692% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.02%. Comparing base (accca8f) to head (173a280).
Report is 2 commits behind head on master.

Current head 173a280 differs from pull request most recent head 8d50e89

Please upload reports for the commit 8d50e89 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #73258    +/-   ##
========================================
  Coverage   78.01%   78.02%            
========================================
  Files        6632     6633     +1     
  Lines      296124   296222    +98     
  Branches    50999    51014    +15     
========================================
+ Hits       231031   231137   +106     
+ Misses      58807    58799     -8     
  Partials     6286     6286            
Files Coverage Δ
src/sentry/conf/server.py 87.76% <ø> (ø)
src/sentry/uptime/detectors/ranking.py 100.00% <100.00%> (ø)
src/sentry/uptime/models.py 100.00% <ø> (ø)
src/sentry/uptime/detectors/tasks.py 97.36% <97.36%> (ø)

... and 6 files with indirect coverage changes

@wedamija wedamija enabled auto-merge (squash) June 25, 2024 23:00
@wedamija wedamija merged commit 4a1e00a into master Jun 25, 2024
48 checks passed
@wedamija wedamija deleted the danf/uptime-detector-tasks branch June 25, 2024 23:29
Copy link

sentry-io bot commented Jun 26, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ KeyError: 'Invalid cluster type, expected redis cluster' sentry.uptime.detectors.tasks.schedule_detections View Issue
  • ‼️ KeyError: 'Invalid cluster type, expected redis cluster' sentry.uptime.detectors.tasks.process_detection... View Issue

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2024
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.

2 participants