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

View File

@@ -588,11 +588,11 @@ type WorkflowExecutionStatisticReport struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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"` LastExecuted string `protobuf:"bytes,2,opt,name=lastExecuted,proto3" json:"lastExecuted,omitempty"`
Running uint64 `protobuf:"varint,3,opt,name=running,proto3" json:"running,omitempty"` Running int32 `protobuf:"varint,3,opt,name=running,proto3" json:"running,omitempty"`
Completed uint64 `protobuf:"varint,4,opt,name=completed,proto3" json:"completed,omitempty"` Completed int32 `protobuf:"varint,4,opt,name=completed,proto3" json:"completed,omitempty"`
Failed uint64 `protobuf:"varint,5,opt,name=failed,proto3" json:"failed,omitempty"` Failed int32 `protobuf:"varint,5,opt,name=failed,proto3" json:"failed,omitempty"`
} }
func (x *WorkflowExecutionStatisticReport) Reset() { func (x *WorkflowExecutionStatisticReport) Reset() {
@@ -627,7 +627,7 @@ func (*WorkflowExecutionStatisticReport) Descriptor() ([]byte, []int) {
return file_workflow_template_proto_rawDescGZIP(), []int{10} return file_workflow_template_proto_rawDescGZIP(), []int{10}
} }
func (x *WorkflowExecutionStatisticReport) GetTotal() uint64 { func (x *WorkflowExecutionStatisticReport) GetTotal() int32 {
if x != nil { if x != nil {
return x.Total return x.Total
} }
@@ -641,21 +641,21 @@ func (x *WorkflowExecutionStatisticReport) GetLastExecuted() string {
return "" return ""
} }
func (x *WorkflowExecutionStatisticReport) GetRunning() uint64 { func (x *WorkflowExecutionStatisticReport) GetRunning() int32 {
if x != nil { if x != nil {
return x.Running return x.Running
} }
return 0 return 0
} }
func (x *WorkflowExecutionStatisticReport) GetCompleted() uint64 { func (x *WorkflowExecutionStatisticReport) GetCompleted() int32 {
if x != nil { if x != nil {
return x.Completed return x.Completed
} }
return 0 return 0
} }
func (x *WorkflowExecutionStatisticReport) GetFailed() uint64 { func (x *WorkflowExecutionStatisticReport) GetFailed() int32 {
if x != nil { if x != nil {
return x.Failed return x.Failed
} }
@@ -667,14 +667,14 @@ type WorkflowTemplate struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
CreatedAt string `protobuf:"bytes,1,opt,name=createdAt,proto3" json:"createdAt,omitempty"` CreatedAt string `protobuf:"bytes,1,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Version int32 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` Version int32 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
Manifest string `protobuf:"bytes,5,opt,name=manifest,proto3" json:"manifest,omitempty"` Manifest string `protobuf:"bytes,5,opt,name=manifest,proto3" json:"manifest,omitempty"`
IsLatest bool `protobuf:"varint,6,opt,name=isLatest,proto3" json:"isLatest,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"` 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() { func (x *WorkflowTemplate) Reset() {
@@ -758,9 +758,9 @@ func (x *WorkflowTemplate) GetIsArchived() bool {
return false return false
} }
func (x *WorkflowTemplate) GetWorkflowExecutionStatisticReport() *WorkflowExecutionStatisticReport { func (x *WorkflowTemplate) GetStats() *WorkflowExecutionStatisticReport {
if x != nil { if x != nil {
return x.WorkflowExecutionStatisticReport return x.Stats
} }
return nil 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41, 0x72, 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, 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, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x12, 0x3b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f,
0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x05,
0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x73, 0x74, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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,
} }
var ( var (
@@ -905,7 +901,7 @@ var file_workflow_template_proto_depIdxs = []int32{
11, // 2: api.ListWorkflowTemplateVersionsResponse.workflowTemplates:type_name -> api.WorkflowTemplate 11, // 2: api.ListWorkflowTemplateVersionsResponse.workflowTemplates:type_name -> api.WorkflowTemplate
11, // 3: api.ListWorkflowTemplatesResponse.workflowTemplates:type_name -> api.WorkflowTemplate 11, // 3: api.ListWorkflowTemplatesResponse.workflowTemplates:type_name -> api.WorkflowTemplate
11, // 4: api.ArchiveWorkflowTemplateResponse.workflowTemplate: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 output_type
6, // [6:6] is the sub-list for method input_type 6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name 6, // [6:6] is the sub-list for extension type_name

View File

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

View File

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

View File

@@ -1118,7 +1118,7 @@ func (c *Client) GetWorkflowExecutionStatisticsForTemplate(workflowTemplate *Wor
} }
//Calculate and set the values //Calculate and set the values
workflowTemplate.WorkflowExecutionStatisticReport.Total = uint64(len(workflowExecStats)) workflowTemplate.WorkflowExecutionStatisticReport.Total = int32(len(workflowExecStats))
createdAtTime, ok := (workflowExecStats[0].CreatedAt).(time.Time) createdAtTime, ok := (workflowExecStats[0].CreatedAt).(time.Time)
if !ok { if !ok {
return errors.New("Unable to get time of created_at") 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, Manifest: wft.Manifest,
IsLatest: wft.IsLatest, IsLatest: wft.IsLatest,
IsArchived: wft.IsArchived, IsArchived: wft.IsArchived,
WorkflowExecutionStatisticReport: &api.WorkflowExecutionStatisticReport{ Stats: &api.WorkflowExecutionStatisticReport{
Total: wft.WorkflowExecutionStatisticReport.Total, Total: wft.WorkflowExecutionStatisticReport.Total,
LastExecuted: wft.WorkflowExecutionStatisticReport.LastExecuted.String(), LastExecuted: wft.WorkflowExecutionStatisticReport.LastExecuted.String(),
Running: wft.WorkflowExecutionStatisticReport.Running, Running: wft.WorkflowExecutionStatisticReport.Running,