Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: notifications: report failed workspace builds#14571

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 126 commits intomainfrom40-failure-summary
Sep 18, 2024

Conversation

@mtojek
Copy link
Member

@mtojekmtojek commentedSep 5, 2024
edited
Loading

Fixes:coder/internal#40

This PR introduces support for email reports, including a report with failed workspace builds. A report generator runs periodically to see if users expect a new report. Once the report is successfully generated and spread, a record (or records) are logged in the database table.

In the multi-instance setup, report generators use an exclusive locking mechanism to ensure only one instance is running.

@mtojekmtojek self-assigned thisSep 5, 2024
@mtojek
Copy link
MemberAuthor

Alright, I addressed most of the feedback. Important changes:

  • I decided to stick with the concept of email per template. Template admins should not receive emails if there are no failed workspace builds.
  • Don't need to remove old entries in thenotification_report_generator_log as right now there will be one record fornotifications.TemplateWorkspaceBuildsFailedReport. We will see more if there are more report type defined.
  • Reports are sent to template admins at the same time. If somebody disables notifications, they will receive the report in the next week. Actually, it simplified the tracking logic.

Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

LGTM

Approving to unblock, but I really feel we should try add some testing aroundNewReportGenerator. I'm happy to land this first and have a follow-up PR which just focuses on that, since it could get complicated.

Excited to see this in action!

delay = 15 * time.Minute
)

func NewReportGenerator(ctx context.Context, logger slog.Logger, db database.Store, enqueuer notifications.Enqueuer, clk quartz.Clock) io.Closer {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is not tested using the current approach is exclusive locking, and this will be hard.

What makes this particularly hard (asking for real, not rhetorically)? To me it seems like we'd need to invokeNewReportGenerator in two separate goroutines and just ensure that we only get what we're expecting, which you've implemented in other tests.

I think it's quite risky to have functionality which should be guarding against pathological behaviour which is not covered by a test.

@mtojekmtojek merged commit6de5937 intomainSep 18, 2024
@mtojekmtojek deleted the 40-failure-summary branchSeptember 18, 2024 07:11
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 18, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@mafredrimafredrimafredri approved these changes

@dannykoppingdannykoppingdannykopping approved these changes

@johnstcnjohnstcnAwaiting requested review from johnstcn

Assignees

@mtojekmtojek

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

feat: Email reports/summaries

5 participants

@mtojek@dannykopping@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp