-
Notifications
You must be signed in to change notification settings - Fork 901
feat(coderd): notify when workspace is marked as dormant #13868
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, left a few thoughts
@dannykopping, since the last changes are quite significant, I would recommend reviewing using the commits instead of the full diff. |
coderd/database/migrations/000223_dormancy_notification_template.up.sql
Outdated
Show resolved
Hide resolved
coderd/database/migrations/000226_dormancy_notification_template.up.sql
Outdated
Show resolved
Hide resolved
Signed-off-by: Danny Kopping <danny@coder.com>
@BrunoQuaresma I tried to move this along while you were out, but I didn't have much time. I think we should pass the enqueuer during the instantiation phase of the various areas, rather than passing the enqueuer/logger at the last moment of responsibility like you were doing before. I fixed the migration and added some detail to the notification. |
Co-authored-by: Danny Kopping <danny@coder.com>
ba7fbd9
to
299cd7f
Compare
@BrunoQuaresma is it still a draft PR or a regular one? |
I made it draft so that we don't merge accidentally before testing it fully, since it has approvals already. |
…nt-notifications
…nt-notifications
@dannykopping @mtojek The biggest changes since the last review:
|
coderd/database/migrations/000229_dormancy_notification_template.up.sql
Outdated
Show resolved
Hide resolved
coderd/database/migrations/000230_marked_for_deletion_notification_template.up sql
Outdated
Show resolved
Hide resolved
coderd/database/migrations/000230_marked_for_deletion_notification_template.up sql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seconded a few Danny's comments.
@BrunoQuaresma If you feel a need to clarify some comments, please sync with @dannykopping. Let's not elongate this task anymore, it is already a leftover from the last sprint.
'0ea69165-ec14-4314-91f1-69566ac3c5a0', | ||
'Workspace Marked as Dormant', | ||
E'Workspace "{{.Labels.name}}" marked as dormant', | ||
E'Hi {{.UserName}}\n\n' || E'Your workspace **{{.Labels.name}}** has been marked as **dormant**.\n' || E'The specified reason was "**{{.Labels.reason}} (initiated by: {{ .Labels.initiator }}){{end}}**\n\n' || E'Dormancy refers to a workspace being unused for a defined length of time, and after it exceeds {{.Labels.dormancyHours}} hours of dormancy might be deleted.\n' || E'To activate your workspace again, simply use it as normal.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording is a little weird here. Can we change it and add a link to the dormancy docs:
I don't think we need to include the initiator, just improve the reasons (see end of message).
Hi
{user-name}
, your workspace{ws-name}
has been marked dormant because of{reason}
.
Append if dormancy cleanup is enabled and dormancy_hours
< 24:
Dormant workspaces are automatically deleted after
{dormancy_hours}
hours of inactivity.
Append if dormancy cleanup is enabled, and dormancy_hours
> 24:
Dormant workspaces are automatically deleted after
{dormancy_hours // 24}
days of inactivity.
To prevent deletion, use your workspace with the link below.
The reasons also fit into differing grammatic context:
- Lifecycle executor: "breached the template's threshold for inactivity"
- API: "requested by user"
- Template: "template updated to new dormancy policy"
If we use these, they'd fit the above messages better.
- Lifcycle: "prolonged inactivity, exceeding the dormancy threshold"
- API: "a user request"
- Template: "an update to the template's dormancy"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to refactor the templates in the next PR to avoid further postponement.
Related to coder/internal#7