add corso error event
This commit is contained in:
parent
02db885c1e
commit
46a4cc0d53
@ -33,6 +33,7 @@ const (
|
|||||||
RepoConnect = "Repo Connect"
|
RepoConnect = "Repo Connect"
|
||||||
BackupStart = "Backup Start"
|
BackupStart = "Backup Start"
|
||||||
BackupEnd = "Backup End"
|
BackupEnd = "Backup End"
|
||||||
|
CorsoError = "Corso Error"
|
||||||
RestoreStart = "Restore Start"
|
RestoreStart = "Restore Start"
|
||||||
RestoreEnd = "Restore End"
|
RestoreEnd = "Restore End"
|
||||||
ExportStart = "Export Start"
|
ExportStart = "Export Start"
|
||||||
@ -50,11 +51,13 @@ const (
|
|||||||
ItemsRead = "items_read"
|
ItemsRead = "items_read"
|
||||||
ItemsWritten = "items_written"
|
ItemsWritten = "items_written"
|
||||||
Resources = "resources"
|
Resources = "resources"
|
||||||
|
ResourcesName = "resources_name"
|
||||||
RestoreID = "restore_id"
|
RestoreID = "restore_id"
|
||||||
ExportID = "export_id"
|
ExportID = "export_id"
|
||||||
Service = "service"
|
Service = "service"
|
||||||
StartTime = "start_time"
|
StartTime = "start_time"
|
||||||
Status = "status"
|
Status = "status"
|
||||||
|
Command = "command"
|
||||||
|
|
||||||
// default values for keys
|
// default values for keys
|
||||||
RepoIDNotFound = "not_found"
|
RepoIDNotFound = "not_found"
|
||||||
|
|||||||
@ -257,6 +257,21 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
if op.Errors.Failure() != nil {
|
||||||
|
op.bus.Event(
|
||||||
|
ctx,
|
||||||
|
events.CorsoError,
|
||||||
|
map[string]any{
|
||||||
|
events.Resources: op.ResourceOwner.ID(),
|
||||||
|
events.ResourcesName: op.ResourceOwner.Name(),
|
||||||
|
events.Service: op.Selectors.PathService().String(),
|
||||||
|
events.StartTime: dttm.Format(op.Results.StartedAt),
|
||||||
|
events.Status: op.Status.String(),
|
||||||
|
events.BackupID: op.Results.BackupID,
|
||||||
|
events.Command: "Backup",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
op.bus.Event(
|
op.bus.Event(
|
||||||
ctx,
|
ctx,
|
||||||
events.BackupEnd,
|
events.BackupEnd,
|
||||||
|
|||||||
@ -141,6 +141,19 @@ func (op *ExportOperation) Run(ctx context.Context) (
|
|||||||
"service", op.Selectors.Service)
|
"service", op.Selectors.Service)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
if op.Errors.Failure() != nil {
|
||||||
|
op.bus.Event(
|
||||||
|
ctx,
|
||||||
|
events.CorsoError,
|
||||||
|
map[string]any{
|
||||||
|
events.Service: op.Selectors.PathService().String(),
|
||||||
|
events.StartTime: dttm.Format(op.Results.StartedAt),
|
||||||
|
events.Status: op.Status.String(),
|
||||||
|
events.BackupID: op.BackupID,
|
||||||
|
events.Command: "Export",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
op.bus.Event(
|
op.bus.Event(
|
||||||
ctx,
|
ctx,
|
||||||
events.ExportEnd,
|
events.ExportEnd,
|
||||||
|
|||||||
@ -65,6 +65,18 @@ func (op *MaintenanceOperation) Run(ctx context.Context) (err error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
if op.Errors.Failure() != nil {
|
||||||
|
op.bus.Event(
|
||||||
|
ctx,
|
||||||
|
events.CorsoError,
|
||||||
|
map[string]any{
|
||||||
|
events.Resources: op.mOpts.Type.String(),
|
||||||
|
events.StartTime: dttm.Format(op.Results.StartedAt),
|
||||||
|
events.Status: op.Status.String(),
|
||||||
|
events.Command: "Maintenance",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
op.bus.Event(
|
op.bus.Event(
|
||||||
ctx,
|
ctx,
|
||||||
events.MaintenanceEnd,
|
events.MaintenanceEnd,
|
||||||
|
|||||||
@ -146,6 +146,19 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De
|
|||||||
"destination_container", clues.Hide(op.RestoreCfg.Location))
|
"destination_container", clues.Hide(op.RestoreCfg.Location))
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
if op.Errors.Failure() != nil {
|
||||||
|
op.bus.Event(
|
||||||
|
ctx,
|
||||||
|
events.CorsoError,
|
||||||
|
map[string]any{
|
||||||
|
events.Service: op.Selectors.PathService().String(),
|
||||||
|
events.StartTime: dttm.Format(op.Results.StartedAt),
|
||||||
|
events.Status: op.Status.String(),
|
||||||
|
events.BackupID: op.BackupID,
|
||||||
|
events.Command: "Restore",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
op.bus.Event(
|
op.bus.Event(
|
||||||
ctx,
|
ctx,
|
||||||
events.RestoreEnd,
|
events.RestoreEnd,
|
||||||
|
|||||||
@ -368,5 +368,6 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run_errorNoBackup() {
|
|||||||
assert.Zero(t, ro.Results.BytesRead, "bytes read")
|
assert.Zero(t, ro.Results.BytesRead, "bytes read")
|
||||||
// no restore start, because we'd need to find the backup first.
|
// no restore start, because we'd need to find the backup first.
|
||||||
assert.Equal(t, 0, mb.TimesCalled[events.RestoreStart], "restore-start events")
|
assert.Equal(t, 0, mb.TimesCalled[events.RestoreStart], "restore-start events")
|
||||||
|
assert.Equal(t, 1, mb.TimesCalled[events.CorsoError], "corso-error events")
|
||||||
assert.Equal(t, 1, mb.TimesCalled[events.RestoreEnd], "restore-end events")
|
assert.Equal(t, 1, mb.TimesCalled[events.RestoreEnd], "restore-end events")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,6 +227,7 @@ func (suite *ExchangeBackupIntgSuite) TestBackup_Run_exchange() {
|
|||||||
assert.NoError(t, incBO.Errors.Failure(), "incremental non-recoverable error", clues.ToCore(bo.Errors.Failure()))
|
assert.NoError(t, incBO.Errors.Failure(), "incremental non-recoverable error", clues.ToCore(bo.Errors.Failure()))
|
||||||
assert.Empty(t, incBO.Errors.Recovered(), "count incremental recoverable/iteration errors")
|
assert.Empty(t, incBO.Errors.Recovered(), "count incremental recoverable/iteration errors")
|
||||||
assert.Equal(t, 1, incMB.TimesCalled[events.BackupStart], "incremental backup-start events")
|
assert.Equal(t, 1, incMB.TimesCalled[events.BackupStart], "incremental backup-start events")
|
||||||
|
assert.Equal(t, 0, incMB.TimesCalled[events.CorsoError], "corso error events")
|
||||||
assert.Equal(t, 1, incMB.TimesCalled[events.BackupEnd], "incremental backup-end events")
|
assert.Equal(t, 1, incMB.TimesCalled[events.BackupEnd], "incremental backup-end events")
|
||||||
assert.Equal(t,
|
assert.Equal(t,
|
||||||
incMB.CalledWith[events.BackupStart][0][events.BackupID],
|
incMB.CalledWith[events.BackupStart][0][events.BackupID],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user