Skip to content

Improve reporting from account purger cronjob#30959

Merged
islemaster merged 5 commits into
stagingfrom
edap-reporting
Oct 23, 2019
Merged

Improve reporting from account purger cronjob#30959
islemaster merged 5 commits into
stagingfrom
edap-reporting

Conversation

@islemaster
Copy link
Copy Markdown
Contributor

@islemaster islemaster commented Sep 25, 2019

I recently added support for auto-retrying certain Queued Account Purges because we were seeing quite a bit of noise from intermittent Pardot API failures. However, our daily reporting in Slack wasn't updated to accurately communicate when no developer intervention was needed:

image

Here, I'm making some changes to make this daily reporting more accurate, and to help the right people notice and respond when action is required.

  • The message now lists the actual number of accounts requiring manual review.
  • When manual review is actually required, the cronjob will also notify #user-accounts and color-code the message yellow.
  • When an unexpected error occurs, the cronjob will also notify #user-accounts and color-code the message red.
  • The message formatting has been updated with a link to the relevant code (similar to our The Daily Zendesk notifications) and a link to the Cloudwatch dashboard has been added to the linked file, to make it easier for developers to track down relevant documentation when this (hopefully) rare event occurs.

Testing

Unit tests updated to check that appropriate logs are generated in different scenarios (this shares a lot of code with the Slack notifications).

islemaster added a commit that referenced this pull request Oct 3, 2019
Due to an increase in intermittent Pardot errors, we recently [made some
QueuedAccountPurges
autoretryable](#30909).
(See also [this change to reporting from this
task](#30959).) To our
surprise, the queue depth still continued to increase.

It turns out the auto-retry was working, but the `QueuedAccountPurge`
records associated with the retried accounts were not being cleared.

This change adds a step right at the end of the nightly task to clean up
any resolved `QueuedAccountPurge` records.  One benefit of this design
is that it will retroactively clean up our queue on production next time
it runs, so no manual correction to the production database is required.
@islemaster islemaster requested review from Hamms and removed request for dju90 and joshlory October 22, 2019 17:07
Copy link
Copy Markdown
Contributor

@Hamms Hamms left a comment

Choose a reason for hiding this comment

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

Couple of nits, but otherwise this looks great! Love the testing, too

end

def report_results
review_queue_depth = manual_review_queue_depth
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this method no longer needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, thanks.

end

# Send warning messages to #cron-daily and #user-accounts
def notify(message)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be something like "warn"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 Yeah, that's what it looks like.

@islemaster islemaster merged commit 12f89ca into staging Oct 23, 2019
@islemaster islemaster deleted the edap-reporting branch October 23, 2019 22:01
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