lib/ur: Implement crash (panic) reporting (fixes #959) (#5702)

* lib/ur: Implement crash (panic) reporting (fixes #959)

This implements a simple crash reporting method. It piggybacks on the
panic log files created by the monitor process, picking these up and
uploading them from the usage reporting routine.

A new config value points to the crash receiver base URL, which defaults
to "https://crash.syncthing.net/newcrash" (following the pattern of
"https://data.syncthing.net/newdata" for usage reports, but allowing us
to separate the service as required).
This commit is contained in:
Jakob Borg
2019-06-11 08:19:11 +02:00
committed by GitHub
parent 93e57bd357
commit 42ce6be9b9
19 changed files with 1925 additions and 19 deletions

View File

@@ -25,6 +25,7 @@ import (
// update the config version. The order of migrations doesn't matter here,
// put the newest on top for readability.
var migrations = migrationSet{
{29, migrateToConfigV29},
{28, migrateToConfigV28},
{27, migrateToConfigV27},
{26, nil}, // triggers database update
@@ -83,6 +84,19 @@ func (m migration) apply(cfg *Configuration) {
cfg.Version = m.targetVersion
}
func migrateToConfigV29(cfg *Configuration) {
// The new crash reporting option should follow the state of global
// discovery / usage reporting, and we should display an appropriate
// notification.
if cfg.Options.GlobalAnnEnabled || cfg.Options.URAccepted > 0 {
cfg.Options.CREnabled = true
cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs, "crAutoEnabled")
} else {
cfg.Options.CREnabled = false
cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs, "crAutoDisabled")
}
}
func migrateToConfigV28(cfg *Configuration) {
// Show a notification about enabling filesystem watching
cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs, "fsWatcherNotification")