Skip to content

Conversation

@jkowalski
Copy link
Contributor

@jkowalski jkowalski commented Nov 5, 2024

Notifications will be sent to all configured notification profiles according to their severity levels.

The following events will trigger notifications:

  • Snapshot is created (CLI only, severity >= report)
  • Server Maintenance error occurs (CLI, server and UI, severity >= error)
  • Any other CLI error occurs (CLI only, severity >= error).

A flag --no-error-notifications can be used to disable error notifications.

For #1958

Examples:

Pushover error notification:

Kopia has encountered an error during snapshot create on MacBookPro.home.lan

Operation: snapshot create
Started:   2024-11-04 22:37:14 -0800 PST
Finished:  2024-11-04 22:38:40 -0800 PST (1m26s)

example error
github.com/kopia/kopia/cli.(*App).repositoryWriterAction.(*App).maybeRepositoryAction.func2
	/Users/jarek/Projects/Kopia/cli/app.go:586
<stack trace>

Pushover snapshot report

Kopia created 11 snapshots on MacBookPro.home.lan

Path: /Users/jarek/Desktop
Status: ok
Start: 2024-11-04 22:38:14 -0800 PST Duration: 12.939ms
Size: 2 GB, 118 files, 14 directories.


Path: /Users/jarek/Documents
Status: ok
Start: 2024-11-04 22:38:38 -0800 PST Duration: 24.95ms
Size: 1.4 GB, 257 files, 42 directories.

<more sources follow>

Email error notification

image

Email snapshot report

image

Notifications will be sent to all configured notification profiles
according to their severity levels.

The following events will trigger notifications:

- Snapshot is created (CLI only, severity >= report)
- Server Maintenance error occurs (CLI, server and UI, severity >= error)
- Any other CLI error occurs (CLI only, severity >= error).

A flag `--no-error-notifications` can be used to disable error notifications.
@codecov
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 70.51282% with 23 lines in your changes missing coverage. Please review.

Project coverage is 76.08%. Comparing base (cb455c6) to head (2b4aada).
Report is 339 commits behind head on master.

Files with missing lines Patch % Lines
cli/command_snapshot_create.go 70.58% 5 Missing and 5 partials ⚠️
internal/server/server_maintenance.go 25.00% 8 Missing and 1 partial ⚠️
internal/server/server.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4233      +/-   ##
==========================================
+ Coverage   75.86%   76.08%   +0.21%     
==========================================
  Files         470      506      +36     
  Lines       37301    38884    +1583     
==========================================
+ Hits        28299    29584    +1285     
- Misses       7071     7339     +268     
- Partials     1931     1961      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jkowalski jkowalski merged commit afb85cb into kopia:master Nov 12, 2024
mcamou pushed a commit to mcamou/kopia that referenced this pull request Nov 18, 2024
* feat(cli): send error notifications and snapshot reports

Notifications will be sent to all configured notification profiles
according to their severity levels.

The following events will trigger notifications:

- Snapshot is created (CLI only, severity >= report)
- Server Maintenance error occurs (CLI, server and UI, severity >= error)
- Any other CLI error occurs (CLI only, severity >= error).

A flag `--no-error-notifications` can be used to disable error notifications.

* added template tests

* improved time formatting in templates

* plumb through notifytemplate.Options

* more testing for formatting options

* fixed default date format to RFC1123
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