Parsing the created_at timestamp from Argo workflow.

This commit is contained in:
Aleksandr Melnikov
2020-04-14 14:03:24 -07:00
parent ac8c3e39b1
commit 1e594eb63f

View File

@@ -118,10 +118,18 @@ func (s *WorkflowServer) AddWorkflowExecutionStatistics(ctx context.Context, req
if request.Statistics.WorkflowStatus == "Success" {
workflowOutcomeIsSuccess = true
}
//todo createdAt parse
err := client.AddWorkflowExecutionStatistic(request.Namespace, request.Name, request.Statistics.WorkflowTemplateId, time.Now(), workflowOutcomeIsSuccess)
/*
The format from Argo will be:
Workflow creation timestamp formatted in RFC 3339 (e.g. 2018-08-23T05:42:49Z)
*/
createdAt, err := time.Parse(time.RFC3339, request.Statistics.CreatedAt)
if err != nil {
return nil, err
return &empty.Empty{}, err
}
err = client.AddWorkflowExecutionStatistic(request.Namespace, request.Name,
request.Statistics.WorkflowTemplateId, createdAt, workflowOutcomeIsSuccess)
if err != nil {
return &empty.Empty{}, err
}
return &empty.Empty{}, nil
}