Merge pull request '[migration] track user actions in task logging' (#55) from feature/migration into master
This commit is contained in:
commit
11b9d8511a
|
@ -242,6 +242,10 @@ func (h *APIHandler) startDataMigration(w http.ResponseWriter, req *http.Request
|
|||
return
|
||||
}
|
||||
|
||||
writeLog(&obj, &task2.TaskResult{
|
||||
Success: true,
|
||||
}, "task status manually set to ready")
|
||||
|
||||
if obj.Metadata.Labels != nil && obj.Metadata.Labels["business_id"] == "index_migration" && len(obj.ParentId) > 0 {
|
||||
//update status of major task to running
|
||||
query := util.MapStr{
|
||||
|
@ -303,6 +307,9 @@ func (h *APIHandler) stopDataMigrationTask(w http.ResponseWriter, req *http.Requ
|
|||
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
writeLog(&obj, &task2.TaskResult{
|
||||
Success: true,
|
||||
}, "task status manually set to pending stop")
|
||||
|
||||
h.WriteJSON(w, util.MapStr{
|
||||
"success": true,
|
||||
|
|
|
@ -887,6 +887,11 @@ func (p *DispatcherProcessor) saveTaskAndWriteLog(taskItem *task2.Task, refresh
|
|||
log.Errorf("failed to update task, err: %v", err)
|
||||
}
|
||||
if message != "" {
|
||||
writeLog(taskItem, taskResult, message)
|
||||
}
|
||||
}
|
||||
|
||||
func writeLog(taskItem *task2.Task, taskResult *task2.TaskResult, message string) {
|
||||
event.SaveLog(event.Event{
|
||||
Metadata: event.EventMetadata{
|
||||
Category: "task",
|
||||
|
@ -910,7 +915,6 @@ func (p *DispatcherProcessor) saveTaskAndWriteLog(taskItem *task2.Task, refresh
|
|||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (p *DispatcherProcessor) splitMajorMigrationTask(taskItem *task2.Task) error {
|
||||
|
|
Loading…
Reference in New Issue