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

Alert sentry when no attachments found for approved minutes #34

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

xmedr
Copy link
Collaborator

@xmedr xmedr commented Nov 15, 2024

Overview

This pr will alert sentry when an approved minutes matter is missing any attachments, provide details to examine it within legistar, and continue the scrape without failing outright

Testing Instructions

  • Check the following test alert in sentry (or trigger your own, read on for details) and confirm that it gives enough details on the situation to be actionable
  • To trigger your own alert:
    • pull down this branch, and insert a breakpoint after line 596 of events.py (after the capture_exception command)
    • after line 553, reassign the attachments var to an empty list
    • Run a big enough scrape to get a matter with potential attachments. I ran docker-compose run --rm scrapers pupa update lametro events window=200 --rpm=0
    • Once you hit the breakpoint, check sentry for the new alert

@xmedr xmedr requested a review from antidipyramid November 18, 2024 14:20
n_minutes += 1
try:
if len(attachments) == 0:
raise MissingAttachmentsException(matter["MatterId"], attachment_url)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Multiple indentation levels can make code more difficult to read. What do you think about doing something like:

for matter in result:
...
    try:
        if len(attachments) == 0:
            raise MissingAttachmentsException(matter["MatterId"], attachment_url)
    except MissingAttachmentsException as e:
        capture_exception(e)
        continue

    if len(attachments) == 1:
    ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I see what you mean, you're totally right!

@xmedr xmedr requested a review from antidipyramid December 2, 2024 19:41
@xmedr xmedr merged commit fa42520 into main Jan 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants