dolce icon indicating copy to clipboard operation
dolce copied to clipboard

Feature Request: Blackout Window for Notifications

Open SixFive7 opened this issue 1 year ago • 5 comments

Feature Description

It would be nice to have a blackout window in Dolce, where notifications are suppressed during a specified time frame. After the window ends, a notification should only be sent if there is a change in the system state compared to its state before the blackout window. All events during the window should be ignored unless the final state is different.

Use Case

For setups that have multiple Docker containers updated every night (e.g., using Watchtower), Dolce always sends lots or large (with backoff) notifications, almost all of which are unnecessary. This nightly notification spam makes it difficult to track important notifications. With a blackout window, only relevant (if any) notifications would be sent after the window, reducing noise and highlighting important updates.

Suggested Implementation

  1. Configurable Blackout Window via Environment Variables:

    • Users can specify a time window during which all notifications are paused.
    • Example environment variables:
      DOLCE_BLACKOUT_WINDOW_START: "02:00"
      DOLCE_BLACKOUT_WINDOW_END: "03:00"
      
  2. Post-Window Notification:

    • If the system state remains unchanged after the blackout window, no notification should be sent. Only notify if there are actual changes. So successful updates during the window are ignored. But updated containers that have failed to start by the end of the window are reported.

Benefits

  • Prevents unnecessary notifications during high-activity periods.
  • Ensures only meaningful updates are sent, improving clarity and reducing noise.

Looking forward to your thoughts on such a feature! I would have written a PR if only I had dabbled in typescript before.

Kind regards

SixFive7 avatar Sep 15 '24 22:09 SixFive7

Hi, thanks for the great idea, the use case seems very plausible although I did not yet encounter it myself.

I just released v3.0.1 which has the new DOLCE_BLACKOUT_WINDOWS option.

I opted for a single option instead of 2 separate options which you suggested so you are now able to configure multiple windows.

Feel free to update your container and test the function. Please close the issue if all your requirements are met of feel free to give me some feedback.

dangrie158 avatar Sep 20 '24 18:09 dangrie158

Hi,

Thank you so much for picking up the feature request and for implementing it so swiftly! I'll be testing out the new DOLCE_BLACKOUT_WINDOWS option tonight during the watchtower upgrade window.

I am curious about one thing regarding the system state before and after the blackout window. Let’s consider two scenarios:

Scenario 1: State changes during the blackout window but results in the same state after the window.

  • Let’s say several containers are updated or restarted during the blackout window, but by the time the window ends, the system has returned to the exact same state it was in prior to the window (e.g., all containers are up (and updated) and running smoothly both before and after the blackout). In this case, am I correct in understanding that no notification would be sent post-window, since the final state matches the state before the window?

Scenario 2: State changes during the blackout window, and the final state differs.

  • Now, imagine some containers are updated during the blackout, and while most recover, one (or more) containers fail to start properly by the end of the window. Here, I believe a notification would be sent at the end of the blackout window, since the state has changed (failed containers), even though the issue occurred within the blackout window. Is that accurate? If so, that would be extremely useful as I will now only ever receive notifications if there is actually something unexpected happening. Exactly what Dolce is used for in my case!

Again, thank you for implementing this! I'll definitely report back after testing and let you know how it goes. 😊 By the way, do you have any way I can donate a small token of my appreciation?

Kind regards

SixFive7 avatar Sep 20 '24 22:09 SixFive7

Hi,

scenario 2 is not yet implemented as I first need to introduce a way to keep track of the state and want to also handle shutdowns and restarts of the dolce container in a proper way.

The feature is still planned but I wanted to ship this state first as I’m not sure if I can manage to implement this within the next week or so. I’ll keep you updated

there is a „buy me a coffee“ link in the readme I think. Feel free but not obliged to test it out (I would mainly be curious if and how this system works 😄) however be sure that anything you do is greatly appreciated

dangrie158 avatar Sep 21 '24 05:09 dangrie158

Hi, I just had the time to test this a little and I think this is working sufficiently well now for you to test :). When a blackout window ends, the states of the container are now compared to the last known state before the blackout window and if they don't match a notification should be triggered.

Check out version v3.2.0 and see the documentation at https://dangrie158.github.io/dolce/latest/configuration/#blackout-times

dangrie158 avatar Oct 05 '24 08:10 dangrie158

Wow excellent! I will test it tonight and let you know how it ends.

SixFive7 avatar Oct 07 '24 17:10 SixFive7

Hi, sorry for the late reply; this somehow fell through the cracks in my to‑do list. But yes, everything is working perfectly! Thank you so much and enjoy the coffee ;-)

SixFive7 avatar Apr 21 '25 15:04 SixFive7