Renamed WorkflowStatistics to just Stats.

Changed value types so they come back as integers in JSON.
This commit is contained in:
Aleksandr Melnikov
2020-04-15 15:16:45 -07:00
parent 72df98834c
commit 01bbca6c73
6 changed files with 48 additions and 52 deletions

View File

@@ -2487,23 +2487,23 @@
"type": "object",
"properties": {
"total": {
"type": "string",
"format": "uint64"
"type": "integer",
"format": "int32"
},
"lastExecuted": {
"type": "string"
},
"running": {
"type": "string",
"format": "uint64"
"type": "integer",
"format": "int32"
},
"completed": {
"type": "string",
"format": "uint64"
"type": "integer",
"format": "int32"
},
"failed": {
"type": "string",
"format": "uint64"
"type": "integer",
"format": "int32"
}
}
},
@@ -2534,7 +2534,7 @@
"type": "boolean",
"format": "boolean"
},
"workflowExecutionStatisticReport": {
"stats": {
"$ref": "#/definitions/WorkflowExecutionStatisticReport"
}
}

View File

@@ -588,11 +588,11 @@ type WorkflowExecutionStatisticReport struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
LastExecuted string `protobuf:"bytes,2,opt,name=lastExecuted,proto3" json:"lastExecuted,omitempty"`
Running uint64 `protobuf:"varint,3,opt,name=running,proto3" json:"running,omitempty"`
Completed uint64 `protobuf:"varint,4,opt,name=completed,proto3" json:"completed,omitempty"`
Failed uint64 `protobuf:"varint,5,opt,name=failed,proto3" json:"failed,omitempty"`
Running int32 `protobuf:"varint,3,opt,name=running,proto3" json:"running,omitempty"`
Completed int32 `protobuf:"varint,4,opt,name=completed,proto3" json:"completed,omitempty"`
Failed int32 `protobuf:"varint,5,opt,name=failed,proto3" json:"failed,omitempty"`
}
func (x *WorkflowExecutionStatisticReport) Reset() {
@@ -627,7 +627,7 @@ func (*WorkflowExecutionStatisticReport) Descriptor() ([]byte, []int) {
return file_workflow_template_proto_rawDescGZIP(), []int{10}
}
func (x *WorkflowExecutionStatisticReport) GetTotal() uint64 {
func (x *WorkflowExecutionStatisticReport) GetTotal() int32 {
if x != nil {
return x.Total
}
@@ -641,21 +641,21 @@ func (x *WorkflowExecutionStatisticReport) GetLastExecuted() string {
return ""
}
func (x *WorkflowExecutionStatisticReport) GetRunning() uint64 {
func (x *WorkflowExecutionStatisticReport) GetRunning() int32 {
if x != nil {
return x.Running
}
return 0
}
func (x *WorkflowExecutionStatisticReport) GetCompleted() uint64 {
func (x *WorkflowExecutionStatisticReport) GetCompleted() int32 {
if x != nil {
return x.Completed
}
return 0
}
func (x *WorkflowExecutionStatisticReport) GetFailed() uint64 {
func (x *WorkflowExecutionStatisticReport) GetFailed() int32 {
if x != nil {
return x.Failed
}
@@ -674,7 +674,7 @@ type WorkflowTemplate struct {
Manifest string `protobuf:"bytes,5,opt,name=manifest,proto3" json:"manifest,omitempty"`
IsLatest bool `protobuf:"varint,6,opt,name=isLatest,proto3" json:"isLatest,omitempty"`
IsArchived bool `protobuf:"varint,7,opt,name=isArchived,proto3" json:"isArchived,omitempty"`
WorkflowExecutionStatisticReport *WorkflowExecutionStatisticReport `protobuf:"bytes,8,opt,name=workflowExecutionStatisticReport,proto3" json:"workflowExecutionStatisticReport,omitempty"`
Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,8,opt,name=stats,proto3" json:"stats,omitempty"`
}
func (x *WorkflowTemplate) Reset() {
@@ -758,9 +758,9 @@ func (x *WorkflowTemplate) GetIsArchived() bool {
return false
}
func (x *WorkflowTemplate) GetWorkflowExecutionStatisticReport() *WorkflowExecutionStatisticReport {
func (x *WorkflowTemplate) GetStats() *WorkflowExecutionStatisticReport {
if x != nil {
return x.WorkflowExecutionStatisticReport
return x.Stats
}
return nil
}
@@ -841,14 +841,14 @@ var file_workflow_template_proto_rawDesc = []byte{
0x01, 0x0a, 0x20, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75,
0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01,
0x28, 0x04, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x6c, 0x61, 0x73,
0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x6c, 0x61, 0x73,
0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0c, 0x6c, 0x61, 0x73, 0x74, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07,
0x07, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6c,
0x65, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70,
0x65, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18,
0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0xbb, 0x02,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x22, 0x85, 0x02,
0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
@@ -861,15 +861,11 @@ var file_workflow_template_proto_rawDesc = []byte{
0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41, 0x72,
0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73,
0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x20, 0x77, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73,
0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x05,
0x73, 0x74, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -905,7 +901,7 @@ var file_workflow_template_proto_depIdxs = []int32{
11, // 2: api.ListWorkflowTemplateVersionsResponse.workflowTemplates:type_name -> api.WorkflowTemplate
11, // 3: api.ListWorkflowTemplatesResponse.workflowTemplates:type_name -> api.WorkflowTemplate
11, // 4: api.ArchiveWorkflowTemplateResponse.workflowTemplate:type_name -> api.WorkflowTemplate
10, // 5: api.WorkflowTemplate.workflowExecutionStatisticReport:type_name -> api.WorkflowExecutionStatisticReport
10, // 5: api.WorkflowTemplate.stats:type_name -> api.WorkflowExecutionStatisticReport
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name

View File

@@ -54,11 +54,11 @@ message ArchiveWorkflowTemplateResponse {
}
message WorkflowExecutionStatisticReport {
uint64 total = 1;
int32 total = 1;
string lastExecuted = 2;
uint64 running = 3;
uint64 completed = 4;
uint64 failed = 5;
int32 running = 3;
int32 completed = 4;
int32 failed = 5;
}
message WorkflowTemplate {
@@ -69,5 +69,5 @@ message WorkflowTemplate {
string manifest = 5;
bool isLatest = 6;
bool isArchived = 7;
WorkflowExecutionStatisticReport workflowExecutionStatisticReport = 8;
WorkflowExecutionStatisticReport stats = 8;
}

View File

@@ -64,11 +64,11 @@ type WorkflowTemplate struct {
}
type WorkflowExecutionStatisticReport struct {
Total uint64
Total int32
LastExecuted time.Time
Running uint64
Completed uint64
Failed uint64
Running int32
Completed int32
Failed int32
}
type WorkflowExecutionStatistic struct {

View File

@@ -1118,7 +1118,7 @@ func (c *Client) GetWorkflowExecutionStatisticsForTemplate(workflowTemplate *Wor
}
//Calculate and set the values
workflowTemplate.WorkflowExecutionStatisticReport.Total = uint64(len(workflowExecStats))
workflowTemplate.WorkflowExecutionStatisticReport.Total = int32(len(workflowExecStats))
createdAtTime, ok := (workflowExecStats[0].CreatedAt).(time.Time)
if !ok {
return errors.New("Unable to get time of created_at")

View File

@@ -67,7 +67,7 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate {
Manifest: wft.Manifest,
IsLatest: wft.IsLatest,
IsArchived: wft.IsArchived,
WorkflowExecutionStatisticReport: &api.WorkflowExecutionStatisticReport{
Stats: &api.WorkflowExecutionStatisticReport{
Total: wft.WorkflowExecutionStatisticReport.Total,
LastExecuted: wft.WorkflowExecutionStatisticReport.LastExecuted.String(),
Running: wft.WorkflowExecutionStatisticReport.Running,