From f64f85fb4fc2f08c089905ea04c226cd0160768d Mon Sep 17 00:00:00 2001 From: Eduwer Camacaro Date: Fri, 14 Feb 2025 17:33:55 -0500 Subject: [PATCH] repartition command: metrics --- schemas/internal/command.proto | 1 - schemas/internal/storage.proto | 1 + schemas/littlehorse/common_enums.proto | 11 + schemas/littlehorse/metrics.proto | 22 +- schemas/littlehorse/object_id.proto | 10 + sdk-go/lhproto/common_enums.pb.go | 120 ++- sdk-go/lhproto/metrics.pb.go | 383 +++----- sdk-go/lhproto/object_id.pb.go | 198 ++++- .../sdk/common/proto/CommonEnums.java | 9 +- .../sdk/common/proto/MeasurableObject.java | 4 +- .../sdk/common/proto/MetricId.java | 12 +- .../sdk/common/proto/MetricIdOrBuilder.java | 2 +- .../sdk/common/proto/MetricRun.java | 835 ++++++++++++++++++ .../sdk/common/proto/MetricRunId.java | 767 ++++++++++++++++ .../common/proto/MetricRunIdOrBuilder.java | 39 + .../sdk/common/proto/MetricRunOrBuilder.java | 45 + .../sdk/common/proto/MetricType.java | 4 +- .../littlehorse/sdk/common/proto/Metrics.java | 62 +- .../sdk/common/proto/ObjectId.java | 34 +- sdk-js/src/proto/common_enums.ts | 72 ++ sdk-js/src/proto/metrics.ts | 208 ++--- sdk-js/src/proto/object_id.ts | 136 ++- sdk-js/src/proto/service.ts | 16 +- .../littlehorse/model/common_enums_pb2.py | 6 +- .../littlehorse/model/common_enums_pb2.pyi | 16 + sdk-python/littlehorse/model/metrics_pb2.py | 22 +- sdk-python/littlehorse/model/metrics_pb2.pyi | 43 +- sdk-python/littlehorse/model/object_id_pb2.py | 6 +- .../littlehorse/model/object_id_pb2.pyi | 16 + sdk-python/littlehorse/model/service_pb2.pyi | 6 +- .../common/model/AbstractGetable.java | 8 + .../common/model/AggregateMetricsModel.java | 28 +- .../getable/core/metrics/MetricRunModel.java | 77 ++ .../metrics/PartitionWindowedMetricModel.java | 3 +- .../getable/objectId/MetricRunIdModel.java | 66 ++ .../RepartitionCommand.java | 14 + .../common/proto/CommandOuterClass.java | 360 ++++---- .../common/proto/GetableClassEnum.java | 9 + .../io/littlehorse/common/proto/Storage.java | 7 +- .../server/streams/ServerTopology.java | 16 + .../core/processors/CommandProcessor.java | 17 + 41 files changed, 3000 insertions(+), 711 deletions(-) create mode 100644 sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRun.java create mode 100644 sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunId.java create mode 100644 sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunIdOrBuilder.java create mode 100644 sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunOrBuilder.java create mode 100644 server/src/main/java/io/littlehorse/common/model/getable/core/metrics/MetricRunModel.java create mode 100644 server/src/main/java/io/littlehorse/common/model/getable/objectId/MetricRunIdModel.java diff --git a/schemas/internal/command.proto b/schemas/internal/command.proto index d08ebdd8e..3099dd448 100644 --- a/schemas/internal/command.proto +++ b/schemas/internal/command.proto @@ -14,7 +14,6 @@ import "variable.proto"; import "storage.proto"; import "acls.proto"; import "job.proto"; -import "metrics.proto"; // This is the schema of everything that flows through the Central Command topic. diff --git a/schemas/internal/storage.proto b/schemas/internal/storage.proto index 47e3f4a98..44975974a 100644 --- a/schemas/internal/storage.proto +++ b/schemas/internal/storage.proto @@ -50,6 +50,7 @@ enum GetableClassEnum { SCHEDULED_WF_RUN = 17; METRIC = 18; PARTITION_METRIC = 19; + METRIC_RUN = 20; } message AttributePb { diff --git a/schemas/littlehorse/common_enums.proto b/schemas/littlehorse/common_enums.proto index ec8ecf8fa..6d2438bcb 100644 --- a/schemas/littlehorse/common_enums.proto +++ b/schemas/littlehorse/common_enums.proto @@ -139,4 +139,15 @@ enum LHErrorType { // An unexpected LittleHorse Internal error occurred. This is not expected to happen. INTERNAL_ERROR = 8; +} + +enum MeasurableObject { + WORKFLOW = 0; + TASK = 1; +} + +enum MetricType { + COUNT = 0; + AVG = 1; + RATIO = 2; } \ No newline at end of file diff --git a/schemas/littlehorse/metrics.proto b/schemas/littlehorse/metrics.proto index ac15e221e..ae46f1999 100644 --- a/schemas/littlehorse/metrics.proto +++ b/schemas/littlehorse/metrics.proto @@ -18,22 +18,6 @@ message Metric { google.protobuf.Duration window_length = 3; } -message MetricId { - MeasurableObject measurable = 1; - MetricType type = 2; -} - -enum MeasurableObject { - WORKFLOW = 0; - TASK = 1; -} - -enum MetricType { - COUNT = 0; - AVG = 1; - RATIO = 2; -} - message PartitionMetric { PartitionMetricId id = 1; google.protobuf.Timestamp created_at = 2; @@ -49,4 +33,10 @@ message PartitionWindowedMetric { message PartitionMetricId { MetricId id = 1; TenantId tenant_id = 2; +} + +message MetricRun { + MetricRunId id = 1; + double value = 2; + google.protobuf.Timestamp created_at = 4; } \ No newline at end of file diff --git a/schemas/littlehorse/object_id.proto b/schemas/littlehorse/object_id.proto index 4b4e5a689..e55518b0b 100644 --- a/schemas/littlehorse/object_id.proto +++ b/schemas/littlehorse/object_id.proto @@ -192,4 +192,14 @@ message TenantId { // ID for a ScheduledWfRun message ScheduledWfRunId { string id = 1; +} + +message MetricId { + MeasurableObject measurable = 1; + MetricType type = 2; +} + +message MetricRunId { + MetricId metric_id = 1; + google.protobuf.Timestamp window_start = 2; } \ No newline at end of file diff --git a/sdk-go/lhproto/common_enums.pb.go b/sdk-go/lhproto/common_enums.pb.go index 50f738cc2..88ef1fdb6 100644 --- a/sdk-go/lhproto/common_enums.pb.go +++ b/sdk-go/lhproto/common_enums.pb.go @@ -433,6 +433,101 @@ func (LHErrorType) EnumDescriptor() ([]byte, []int) { return file_common_enums_proto_rawDescGZIP(), []int{5} } +type MeasurableObject int32 + +const ( + MeasurableObject_WORKFLOW MeasurableObject = 0 + MeasurableObject_TASK MeasurableObject = 1 +) + +// Enum value maps for MeasurableObject. +var ( + MeasurableObject_name = map[int32]string{ + 0: "WORKFLOW", + 1: "TASK", + } + MeasurableObject_value = map[string]int32{ + "WORKFLOW": 0, + "TASK": 1, + } +) + +func (x MeasurableObject) Enum() *MeasurableObject { + p := new(MeasurableObject) + *p = x + return p +} + +func (x MeasurableObject) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MeasurableObject) Descriptor() protoreflect.EnumDescriptor { + return file_common_enums_proto_enumTypes[6].Descriptor() +} + +func (MeasurableObject) Type() protoreflect.EnumType { + return &file_common_enums_proto_enumTypes[6] +} + +func (x MeasurableObject) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MeasurableObject.Descriptor instead. +func (MeasurableObject) EnumDescriptor() ([]byte, []int) { + return file_common_enums_proto_rawDescGZIP(), []int{6} +} + +type MetricType int32 + +const ( + MetricType_COUNT MetricType = 0 + MetricType_AVG MetricType = 1 + MetricType_RATIO MetricType = 2 +) + +// Enum value maps for MetricType. +var ( + MetricType_name = map[int32]string{ + 0: "COUNT", + 1: "AVG", + 2: "RATIO", + } + MetricType_value = map[string]int32{ + "COUNT": 0, + "AVG": 1, + "RATIO": 2, + } +) + +func (x MetricType) Enum() *MetricType { + p := new(MetricType) + *p = x + return p +} + +func (x MetricType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MetricType) Descriptor() protoreflect.EnumDescriptor { + return file_common_enums_proto_enumTypes[7].Descriptor() +} + +func (MetricType) Type() protoreflect.EnumType { + return &file_common_enums_proto_enumTypes[7] +} + +func (x MetricType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MetricType.Descriptor instead. +func (MetricType) EnumDescriptor() ([]byte, []int) { + return file_common_enums_proto_rawDescGZIP(), []int{7} +} + var File_common_enums_proto protoreflect.FileDescriptor var file_common_enums_proto_rawDesc = []byte{ @@ -482,13 +577,18 @@ var file_common_enums_proto_rawDesc = []byte{ 0x53, 0x4b, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x56, 0x41, 0x52, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x07, 0x12, 0x12, 0x0a, 0x0e, 0x49, - 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x08, 0x42, - 0x4d, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, - 0x65, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, - 0x02, 0x1c, 0x4c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x53, 0x64, - 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x08, 0x2a, + 0x2a, 0x0a, 0x10, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x12, 0x0c, 0x0a, 0x08, 0x57, 0x4f, 0x52, 0x4b, 0x46, 0x4c, 0x4f, 0x57, 0x10, + 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x41, 0x53, 0x4b, 0x10, 0x01, 0x2a, 0x2b, 0x0a, 0x0a, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x55, + 0x4e, 0x54, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x56, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, + 0x05, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x10, 0x02, 0x42, 0x4d, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6c, + 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x09, 0x2e, + 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, 0x02, 0x1c, 0x4c, 0x69, 0x74, 0x74, 0x6c, + 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x53, 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -503,7 +603,7 @@ func file_common_enums_proto_rawDescGZIP() []byte { return file_common_enums_proto_rawDescData } -var file_common_enums_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_common_enums_proto_enumTypes = make([]protoimpl.EnumInfo, 8) var file_common_enums_proto_goTypes = []interface{}{ (LHStatus)(0), // 0: littlehorse.LHStatus (MetadataStatus)(0), // 1: littlehorse.MetadataStatus @@ -511,6 +611,8 @@ var file_common_enums_proto_goTypes = []interface{}{ (MetricsWindowLength)(0), // 3: littlehorse.MetricsWindowLength (VariableType)(0), // 4: littlehorse.VariableType (LHErrorType)(0), // 5: littlehorse.LHErrorType + (MeasurableObject)(0), // 6: littlehorse.MeasurableObject + (MetricType)(0), // 7: littlehorse.MetricType } var file_common_enums_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -530,7 +632,7 @@ func file_common_enums_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_common_enums_proto_rawDesc, - NumEnums: 6, + NumEnums: 8, NumMessages: 0, NumExtensions: 0, NumServices: 0, diff --git a/sdk-go/lhproto/metrics.pb.go b/sdk-go/lhproto/metrics.pb.go index 4504d5c84..560b72100 100644 --- a/sdk-go/lhproto/metrics.pb.go +++ b/sdk-go/lhproto/metrics.pb.go @@ -22,101 +22,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type MeasurableObject int32 - -const ( - MeasurableObject_WORKFLOW MeasurableObject = 0 - MeasurableObject_TASK MeasurableObject = 1 -) - -// Enum value maps for MeasurableObject. -var ( - MeasurableObject_name = map[int32]string{ - 0: "WORKFLOW", - 1: "TASK", - } - MeasurableObject_value = map[string]int32{ - "WORKFLOW": 0, - "TASK": 1, - } -) - -func (x MeasurableObject) Enum() *MeasurableObject { - p := new(MeasurableObject) - *p = x - return p -} - -func (x MeasurableObject) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MeasurableObject) Descriptor() protoreflect.EnumDescriptor { - return file_metrics_proto_enumTypes[0].Descriptor() -} - -func (MeasurableObject) Type() protoreflect.EnumType { - return &file_metrics_proto_enumTypes[0] -} - -func (x MeasurableObject) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MeasurableObject.Descriptor instead. -func (MeasurableObject) EnumDescriptor() ([]byte, []int) { - return file_metrics_proto_rawDescGZIP(), []int{0} -} - -type MetricType int32 - -const ( - MetricType_COUNT MetricType = 0 - MetricType_AVG MetricType = 1 - MetricType_RATIO MetricType = 2 -) - -// Enum value maps for MetricType. -var ( - MetricType_name = map[int32]string{ - 0: "COUNT", - 1: "AVG", - 2: "RATIO", - } - MetricType_value = map[string]int32{ - "COUNT": 0, - "AVG": 1, - "RATIO": 2, - } -) - -func (x MetricType) Enum() *MetricType { - p := new(MetricType) - *p = x - return p -} - -func (x MetricType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MetricType) Descriptor() protoreflect.EnumDescriptor { - return file_metrics_proto_enumTypes[1].Descriptor() -} - -func (MetricType) Type() protoreflect.EnumType { - return &file_metrics_proto_enumTypes[1] -} - -func (x MetricType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MetricType.Descriptor instead. -func (MetricType) EnumDescriptor() ([]byte, []int) { - return file_metrics_proto_rawDescGZIP(), []int{1} -} - type Metric struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -180,61 +85,6 @@ func (x *Metric) GetWindowLength() *durationpb.Duration { return nil } -type MetricId struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Measurable MeasurableObject `protobuf:"varint,1,opt,name=measurable,proto3,enum=littlehorse.MeasurableObject" json:"measurable,omitempty"` - Type MetricType `protobuf:"varint,2,opt,name=type,proto3,enum=littlehorse.MetricType" json:"type,omitempty"` -} - -func (x *MetricId) Reset() { - *x = MetricId{} - if protoimpl.UnsafeEnabled { - mi := &file_metrics_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetricId) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetricId) ProtoMessage() {} - -func (x *MetricId) ProtoReflect() protoreflect.Message { - mi := &file_metrics_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MetricId.ProtoReflect.Descriptor instead. -func (*MetricId) Descriptor() ([]byte, []int) { - return file_metrics_proto_rawDescGZIP(), []int{1} -} - -func (x *MetricId) GetMeasurable() MeasurableObject { - if x != nil { - return x.Measurable - } - return MeasurableObject_WORKFLOW -} - -func (x *MetricId) GetType() MetricType { - if x != nil { - return x.Type - } - return MetricType_COUNT -} - type PartitionMetric struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -249,7 +99,7 @@ type PartitionMetric struct { func (x *PartitionMetric) Reset() { *x = PartitionMetric{} if protoimpl.UnsafeEnabled { - mi := &file_metrics_proto_msgTypes[2] + mi := &file_metrics_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +112,7 @@ func (x *PartitionMetric) String() string { func (*PartitionMetric) ProtoMessage() {} func (x *PartitionMetric) ProtoReflect() protoreflect.Message { - mi := &file_metrics_proto_msgTypes[2] + mi := &file_metrics_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +125,7 @@ func (x *PartitionMetric) ProtoReflect() protoreflect.Message { // Deprecated: Use PartitionMetric.ProtoReflect.Descriptor instead. func (*PartitionMetric) Descriptor() ([]byte, []int) { - return file_metrics_proto_rawDescGZIP(), []int{2} + return file_metrics_proto_rawDescGZIP(), []int{1} } func (x *PartitionMetric) GetId() *PartitionMetricId { @@ -318,7 +168,7 @@ type PartitionWindowedMetric struct { func (x *PartitionWindowedMetric) Reset() { *x = PartitionWindowedMetric{} if protoimpl.UnsafeEnabled { - mi := &file_metrics_proto_msgTypes[3] + mi := &file_metrics_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -331,7 +181,7 @@ func (x *PartitionWindowedMetric) String() string { func (*PartitionWindowedMetric) ProtoMessage() {} func (x *PartitionWindowedMetric) ProtoReflect() protoreflect.Message { - mi := &file_metrics_proto_msgTypes[3] + mi := &file_metrics_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -344,7 +194,7 @@ func (x *PartitionWindowedMetric) ProtoReflect() protoreflect.Message { // Deprecated: Use PartitionWindowedMetric.ProtoReflect.Descriptor instead. func (*PartitionWindowedMetric) Descriptor() ([]byte, []int) { - return file_metrics_proto_rawDescGZIP(), []int{3} + return file_metrics_proto_rawDescGZIP(), []int{2} } func (x *PartitionWindowedMetric) GetValue() float64 { @@ -373,7 +223,7 @@ type PartitionMetricId struct { func (x *PartitionMetricId) Reset() { *x = PartitionMetricId{} if protoimpl.UnsafeEnabled { - mi := &file_metrics_proto_msgTypes[4] + mi := &file_metrics_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -386,7 +236,7 @@ func (x *PartitionMetricId) String() string { func (*PartitionMetricId) ProtoMessage() {} func (x *PartitionMetricId) ProtoReflect() protoreflect.Message { - mi := &file_metrics_proto_msgTypes[4] + mi := &file_metrics_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -399,7 +249,7 @@ func (x *PartitionMetricId) ProtoReflect() protoreflect.Message { // Deprecated: Use PartitionMetricId.ProtoReflect.Descriptor instead. func (*PartitionMetricId) Descriptor() ([]byte, []int) { - return file_metrics_proto_rawDescGZIP(), []int{4} + return file_metrics_proto_rawDescGZIP(), []int{3} } func (x *PartitionMetricId) GetId() *MetricId { @@ -416,6 +266,69 @@ func (x *PartitionMetricId) GetTenantId() *TenantId { return nil } +type MetricRun struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *MetricRunId `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *MetricRun) Reset() { + *x = MetricRun{} + if protoimpl.UnsafeEnabled { + mi := &file_metrics_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetricRun) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetricRun) ProtoMessage() {} + +func (x *MetricRun) ProtoReflect() protoreflect.Message { + mi := &file_metrics_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetricRun.ProtoReflect.Descriptor instead. +func (*MetricRun) Descriptor() ([]byte, []int) { + return file_metrics_proto_rawDescGZIP(), []int{4} +} + +func (x *MetricRun) GetId() *MetricRunId { + if x != nil { + return x.Id + } + return nil +} + +func (x *MetricRun) GetValue() float64 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *MetricRun) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + var File_metrics_proto protoreflect.FileDescriptor var file_metrics_proto_rawDesc = []byte{ @@ -436,56 +349,52 @@ var file_metrics_proto_rawDesc = []byte{ 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x77, - 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x76, 0x0a, 0x08, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0a, 0x6d, 0x65, 0x61, 0x73, 0x75, - 0x72, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6c, 0x69, - 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, - 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0a, 0x6d, 0x65, 0x61, 0x73, - 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, - 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x22, 0x89, 0x02, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, - 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x41, 0x74, 0x12, 0x4b, 0x0a, 0x0e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x77, 0x69, 0x6e, - 0x64, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x74, - 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x12, - 0x3e, 0x0a, 0x0d, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x0c, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0x6e, 0x0a, 0x17, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x6e, 0x64, - 0x6f, 0x77, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x3d, 0x0a, 0x0c, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x0b, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x72, 0x74, 0x22, - 0x6e, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x32, 0x0a, 0x09, 0x74, - 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x54, 0x65, 0x6e, - 0x61, 0x6e, 0x74, 0x49, 0x64, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x2a, - 0x2a, 0x0a, 0x10, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x12, 0x0c, 0x0a, 0x08, 0x57, 0x4f, 0x52, 0x4b, 0x46, 0x4c, 0x4f, 0x57, 0x10, - 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x41, 0x53, 0x4b, 0x10, 0x01, 0x2a, 0x2b, 0x0a, 0x0a, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x55, - 0x4e, 0x54, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x56, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, - 0x05, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x10, 0x02, 0x42, 0x4d, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6c, - 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x09, 0x2e, - 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, 0x02, 0x1c, 0x4c, 0x69, 0x74, 0x74, 0x6c, - 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x53, 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x89, 0x02, 0x0a, 0x0f, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, + 0x2e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, + 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x4b, 0x0a, 0x0e, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, + 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, + 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x12, 0x3e, 0x0a, 0x0d, 0x77, 0x69, 0x6e, 0x64, 0x6f, + 0x77, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x77, 0x69, 0x6e, 0x64, 0x6f, + 0x77, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x6e, 0x0a, 0x17, 0x50, 0x61, 0x72, 0x74, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x77, 0x69, 0x6e, 0x64, + 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x77, 0x69, 0x6e, 0x64, + 0x6f, 0x77, 0x53, 0x74, 0x61, 0x72, 0x74, 0x22, 0x6e, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, + 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x32, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, + 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x52, 0x08, 0x74, + 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x86, 0x01, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x52, 0x75, 0x6e, 0x12, 0x28, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x75, 0x6e, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x42, 0x4d, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, + 0x73, 0x65, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0xaa, 0x02, 0x1c, 0x4c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x53, + 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -500,33 +409,32 @@ func file_metrics_proto_rawDescGZIP() []byte { return file_metrics_proto_rawDescData } -var file_metrics_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_metrics_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_metrics_proto_goTypes = []interface{}{ - (MeasurableObject)(0), // 0: littlehorse.MeasurableObject - (MetricType)(0), // 1: littlehorse.MetricType - (*Metric)(nil), // 2: littlehorse.Metric - (*MetricId)(nil), // 3: littlehorse.MetricId - (*PartitionMetric)(nil), // 4: littlehorse.PartitionMetric - (*PartitionWindowedMetric)(nil), // 5: littlehorse.PartitionWindowedMetric - (*PartitionMetricId)(nil), // 6: littlehorse.PartitionMetricId - (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 8: google.protobuf.Duration - (*TenantId)(nil), // 9: littlehorse.TenantId + (*Metric)(nil), // 0: littlehorse.Metric + (*PartitionMetric)(nil), // 1: littlehorse.PartitionMetric + (*PartitionWindowedMetric)(nil), // 2: littlehorse.PartitionWindowedMetric + (*PartitionMetricId)(nil), // 3: littlehorse.PartitionMetricId + (*MetricRun)(nil), // 4: littlehorse.MetricRun + (*MetricId)(nil), // 5: littlehorse.MetricId + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 7: google.protobuf.Duration + (*TenantId)(nil), // 8: littlehorse.TenantId + (*MetricRunId)(nil), // 9: littlehorse.MetricRunId } var file_metrics_proto_depIdxs = []int32{ - 3, // 0: littlehorse.Metric.id:type_name -> littlehorse.MetricId - 7, // 1: littlehorse.Metric.created_at:type_name -> google.protobuf.Timestamp - 8, // 2: littlehorse.Metric.window_length:type_name -> google.protobuf.Duration - 0, // 3: littlehorse.MetricId.measurable:type_name -> littlehorse.MeasurableObject - 1, // 4: littlehorse.MetricId.type:type_name -> littlehorse.MetricType - 6, // 5: littlehorse.PartitionMetric.id:type_name -> littlehorse.PartitionMetricId - 7, // 6: littlehorse.PartitionMetric.created_at:type_name -> google.protobuf.Timestamp - 5, // 7: littlehorse.PartitionMetric.active_windows:type_name -> littlehorse.PartitionWindowedMetric - 8, // 8: littlehorse.PartitionMetric.window_length:type_name -> google.protobuf.Duration - 7, // 9: littlehorse.PartitionWindowedMetric.window_start:type_name -> google.protobuf.Timestamp - 3, // 10: littlehorse.PartitionMetricId.id:type_name -> littlehorse.MetricId - 9, // 11: littlehorse.PartitionMetricId.tenant_id:type_name -> littlehorse.TenantId + 5, // 0: littlehorse.Metric.id:type_name -> littlehorse.MetricId + 6, // 1: littlehorse.Metric.created_at:type_name -> google.protobuf.Timestamp + 7, // 2: littlehorse.Metric.window_length:type_name -> google.protobuf.Duration + 3, // 3: littlehorse.PartitionMetric.id:type_name -> littlehorse.PartitionMetricId + 6, // 4: littlehorse.PartitionMetric.created_at:type_name -> google.protobuf.Timestamp + 2, // 5: littlehorse.PartitionMetric.active_windows:type_name -> littlehorse.PartitionWindowedMetric + 7, // 6: littlehorse.PartitionMetric.window_length:type_name -> google.protobuf.Duration + 6, // 7: littlehorse.PartitionWindowedMetric.window_start:type_name -> google.protobuf.Timestamp + 5, // 8: littlehorse.PartitionMetricId.id:type_name -> littlehorse.MetricId + 8, // 9: littlehorse.PartitionMetricId.tenant_id:type_name -> littlehorse.TenantId + 9, // 10: littlehorse.MetricRun.id:type_name -> littlehorse.MetricRunId + 6, // 11: littlehorse.MetricRun.created_at:type_name -> google.protobuf.Timestamp 12, // [12:12] is the sub-list for method output_type 12, // [12:12] is the sub-list for method input_type 12, // [12:12] is the sub-list for extension type_name @@ -554,7 +462,7 @@ func file_metrics_proto_init() { } } file_metrics_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetricId); i { + switch v := v.(*PartitionMetric); i { case 0: return &v.state case 1: @@ -566,7 +474,7 @@ func file_metrics_proto_init() { } } file_metrics_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PartitionMetric); i { + switch v := v.(*PartitionWindowedMetric); i { case 0: return &v.state case 1: @@ -578,7 +486,7 @@ func file_metrics_proto_init() { } } file_metrics_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PartitionWindowedMetric); i { + switch v := v.(*PartitionMetricId); i { case 0: return &v.state case 1: @@ -590,7 +498,7 @@ func file_metrics_proto_init() { } } file_metrics_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PartitionMetricId); i { + switch v := v.(*MetricRun); i { case 0: return &v.state case 1: @@ -607,14 +515,13 @@ func file_metrics_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_metrics_proto_rawDesc, - NumEnums: 2, + NumEnums: 0, NumMessages: 5, NumExtensions: 0, NumServices: 0, }, GoTypes: file_metrics_proto_goTypes, DependencyIndexes: file_metrics_proto_depIdxs, - EnumInfos: file_metrics_proto_enumTypes, MessageInfos: file_metrics_proto_msgTypes, }.Build() File_metrics_proto = out.File diff --git a/sdk-go/lhproto/object_id.pb.go b/sdk-go/lhproto/object_id.pb.go index 43208ea14..2f8e64d20 100644 --- a/sdk-go/lhproto/object_id.pb.go +++ b/sdk-go/lhproto/object_id.pb.go @@ -1088,6 +1088,116 @@ func (x *ScheduledWfRunId) GetId() string { return "" } +type MetricId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Measurable MeasurableObject `protobuf:"varint,1,opt,name=measurable,proto3,enum=littlehorse.MeasurableObject" json:"measurable,omitempty"` + Type MetricType `protobuf:"varint,2,opt,name=type,proto3,enum=littlehorse.MetricType" json:"type,omitempty"` +} + +func (x *MetricId) Reset() { + *x = MetricId{} + if protoimpl.UnsafeEnabled { + mi := &file_object_id_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetricId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetricId) ProtoMessage() {} + +func (x *MetricId) ProtoReflect() protoreflect.Message { + mi := &file_object_id_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetricId.ProtoReflect.Descriptor instead. +func (*MetricId) Descriptor() ([]byte, []int) { + return file_object_id_proto_rawDescGZIP(), []int{18} +} + +func (x *MetricId) GetMeasurable() MeasurableObject { + if x != nil { + return x.Measurable + } + return MeasurableObject_WORKFLOW +} + +func (x *MetricId) GetType() MetricType { + if x != nil { + return x.Type + } + return MetricType_COUNT +} + +type MetricRunId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MetricId *MetricId `protobuf:"bytes,1,opt,name=metric_id,json=metricId,proto3" json:"metric_id,omitempty"` + WindowStart *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=window_start,json=windowStart,proto3" json:"window_start,omitempty"` +} + +func (x *MetricRunId) Reset() { + *x = MetricRunId{} + if protoimpl.UnsafeEnabled { + mi := &file_object_id_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetricRunId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetricRunId) ProtoMessage() {} + +func (x *MetricRunId) ProtoReflect() protoreflect.Message { + mi := &file_object_id_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetricRunId.ProtoReflect.Descriptor instead. +func (*MetricRunId) Descriptor() ([]byte, []int) { + return file_object_id_proto_rawDescGZIP(), []int{19} +} + +func (x *MetricRunId) GetMetricId() *MetricId { + if x != nil { + return x.MetricId + } + return nil +} + +func (x *MetricRunId) GetWindowStart() *timestamppb.Timestamp { + if x != nil { + return x.WindowStart + } + return nil +} + var File_object_id_proto protoreflect.FileDescriptor var file_object_id_proto_rawDesc = []byte{ @@ -1207,13 +1317,29 @@ var file_object_id_proto_rawDesc = []byte{ 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x22, 0x0a, 0x10, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x57, 0x66, 0x52, 0x75, 0x6e, 0x49, 0x64, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, - 0x4d, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, - 0x65, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, - 0x02, 0x1c, 0x4c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x53, 0x64, - 0x6b, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x76, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0a, 0x6d, + 0x65, 0x61, 0x73, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4d, 0x65, + 0x61, 0x73, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x0a, + 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, + 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x80, 0x01, 0x0a, 0x0b, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x52, 0x75, 0x6e, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x74, + 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, + 0x64, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0c, 0x77, + 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x77, + 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x4d, 0x0a, 0x1f, 0x69, 0x6f, + 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x73, 0x64, 0x6b, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x09, 0x2e, 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, 0x02, 0x1c, 0x4c, 0x69, 0x74, + 0x74, 0x6c, 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x53, 0x64, 0x6b, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -1228,7 +1354,7 @@ func file_object_id_proto_rawDescGZIP() []byte { return file_object_id_proto_rawDescData } -var file_object_id_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_object_id_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_object_id_proto_goTypes = []interface{}{ (*WfSpecId)(nil), // 0: littlehorse.WfSpecId (*TaskDefId)(nil), // 1: littlehorse.TaskDefId @@ -1248,8 +1374,12 @@ var file_object_id_proto_goTypes = []interface{}{ (*PrincipalId)(nil), // 15: littlehorse.PrincipalId (*TenantId)(nil), // 16: littlehorse.TenantId (*ScheduledWfRunId)(nil), // 17: littlehorse.ScheduledWfRunId - (*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp - (MetricsWindowLength)(0), // 19: littlehorse.MetricsWindowLength + (*MetricId)(nil), // 18: littlehorse.MetricId + (*MetricRunId)(nil), // 19: littlehorse.MetricRunId + (*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp + (MetricsWindowLength)(0), // 21: littlehorse.MetricsWindowLength + (MeasurableObject)(0), // 22: littlehorse.MeasurableObject + (MetricType)(0), // 23: littlehorse.MetricType } var file_object_id_proto_depIdxs = []int32{ 1, // 0: littlehorse.TaskWorkerGroupId.task_def_id:type_name -> littlehorse.TaskDefId @@ -1262,17 +1392,21 @@ var file_object_id_proto_depIdxs = []int32{ 4, // 7: littlehorse.WorkflowEventId.workflow_event_def_id:type_name -> littlehorse.WorkflowEventDefId 8, // 8: littlehorse.TaskRunId.wf_run_id:type_name -> littlehorse.WfRunId 8, // 9: littlehorse.UserTaskRunId.wf_run_id:type_name -> littlehorse.WfRunId - 18, // 10: littlehorse.TaskDefMetricsId.window_start:type_name -> google.protobuf.Timestamp - 19, // 11: littlehorse.TaskDefMetricsId.window_type:type_name -> littlehorse.MetricsWindowLength + 20, // 10: littlehorse.TaskDefMetricsId.window_start:type_name -> google.protobuf.Timestamp + 21, // 11: littlehorse.TaskDefMetricsId.window_type:type_name -> littlehorse.MetricsWindowLength 1, // 12: littlehorse.TaskDefMetricsId.task_def_id:type_name -> littlehorse.TaskDefId - 18, // 13: littlehorse.WfSpecMetricsId.window_start:type_name -> google.protobuf.Timestamp - 19, // 14: littlehorse.WfSpecMetricsId.window_type:type_name -> littlehorse.MetricsWindowLength + 20, // 13: littlehorse.WfSpecMetricsId.window_start:type_name -> google.protobuf.Timestamp + 21, // 14: littlehorse.WfSpecMetricsId.window_type:type_name -> littlehorse.MetricsWindowLength 0, // 15: littlehorse.WfSpecMetricsId.wf_spec_id:type_name -> littlehorse.WfSpecId - 16, // [16:16] is the sub-list for method output_type - 16, // [16:16] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name + 22, // 16: littlehorse.MetricId.measurable:type_name -> littlehorse.MeasurableObject + 23, // 17: littlehorse.MetricId.type:type_name -> littlehorse.MetricType + 18, // 18: littlehorse.MetricRunId.metric_id:type_name -> littlehorse.MetricId + 20, // 19: littlehorse.MetricRunId.window_start:type_name -> google.protobuf.Timestamp + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_object_id_proto_init() } @@ -1498,6 +1632,30 @@ func file_object_id_proto_init() { return nil } } + file_object_id_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MetricId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_object_id_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MetricRunId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_object_id_proto_msgTypes[8].OneofWrappers = []interface{}{} type x struct{} @@ -1506,7 +1664,7 @@ func file_object_id_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_object_id_proto_rawDesc, NumEnums: 0, - NumMessages: 18, + NumMessages: 20, NumExtensions: 0, NumServices: 0, }, diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonEnums.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonEnums.java index 0596f6897..06c2e64ec 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonEnums.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonEnums.java @@ -41,9 +41,12 @@ public static void registerAllExtensions( "\000\022\021\n\rVAR_SUB_ERROR\020\001\022\026\n\022VAR_MUTATION_ERR" + "OR\020\002\022\027\n\023USER_TASK_CANCELLED\020\003\022\013\n\007TIMEOUT" + "\020\004\022\020\n\014TASK_FAILURE\020\005\022\r\n\tVAR_ERROR\020\006\022\016\n\nT" + - "ASK_ERROR\020\007\022\022\n\016INTERNAL_ERROR\020\010BM\n\037io.li" + - "ttlehorse.sdk.common.protoP\001Z\t.;lhproto\252" + - "\002\034LittleHorse.Sdk.Common.Protob\006proto3" + "ASK_ERROR\020\007\022\022\n\016INTERNAL_ERROR\020\010**\n\020Measu" + + "rableObject\022\014\n\010WORKFLOW\020\000\022\010\n\004TASK\020\001*+\n\nM" + + "etricType\022\t\n\005COUNT\020\000\022\007\n\003AVG\020\001\022\t\n\005RATIO\020\002" + + "BM\n\037io.littlehorse.sdk.common.protoP\001Z\t." + + ";lhproto\252\002\034LittleHorse.Sdk.Common.Protob" + + "\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MeasurableObject.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MeasurableObject.java index fbf998cc8..ccf8b04dc 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MeasurableObject.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MeasurableObject.java @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto +// source: common_enums.proto package io.littlehorse.sdk.common.proto; @@ -85,7 +85,7 @@ public MeasurableObject findValueByNumber(int number) { } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return io.littlehorse.sdk.common.proto.Metrics.getDescriptor().getEnumTypes().get(0); + return io.littlehorse.sdk.common.proto.CommonEnums.getDescriptor().getEnumTypes().get(6); } private static final MeasurableObject[] VALUES = values(); diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricId.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricId.java index bc8798db8..58802de51 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricId.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricId.java @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto +// source: object_id.proto package io.littlehorse.sdk.common.proto; @@ -29,13 +29,13 @@ protected java.lang.Object newInstance( public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricId_descriptor; + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricId_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricId_fieldAccessorTable + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricId_fieldAccessorTable .ensureFieldAccessorsInitialized( io.littlehorse.sdk.common.proto.MetricId.class, io.littlehorse.sdk.common.proto.MetricId.Builder.class); } @@ -251,13 +251,13 @@ public static final class Builder extends io.littlehorse.sdk.common.proto.MetricIdOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricId_descriptor; + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricId_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricId_fieldAccessorTable + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricId_fieldAccessorTable .ensureFieldAccessorsInitialized( io.littlehorse.sdk.common.proto.MetricId.class, io.littlehorse.sdk.common.proto.MetricId.Builder.class); } @@ -284,7 +284,7 @@ public Builder clear() { @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricId_descriptor; + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricId_descriptor; } @java.lang.Override diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricIdOrBuilder.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricIdOrBuilder.java index 9722d64a8..a8b50e6c5 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricIdOrBuilder.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricIdOrBuilder.java @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto +// source: object_id.proto package io.littlehorse.sdk.common.proto; diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRun.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRun.java new file mode 100644 index 000000000..bea3e2c90 --- /dev/null +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRun.java @@ -0,0 +1,835 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: metrics.proto + +package io.littlehorse.sdk.common.proto; + +/** + * Protobuf type {@code littlehorse.MetricRun} + */ +public final class MetricRun extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:littlehorse.MetricRun) + MetricRunOrBuilder { +private static final long serialVersionUID = 0L; + // Use MetricRun.newBuilder() to construct. + private MetricRun(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MetricRun() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MetricRun(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricRun_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricRun_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.littlehorse.sdk.common.proto.MetricRun.class, io.littlehorse.sdk.common.proto.MetricRun.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + private io.littlehorse.sdk.common.proto.MetricRunId id_; + /** + * .littlehorse.MetricRunId id = 1; + * @return Whether the id field is set. + */ + @java.lang.Override + public boolean hasId() { + return id_ != null; + } + /** + * .littlehorse.MetricRunId id = 1; + * @return The id. + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRunId getId() { + return id_ == null ? io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance() : id_; + } + /** + * .littlehorse.MetricRunId id = 1; + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder getIdOrBuilder() { + return id_ == null ? io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance() : id_; + } + + public static final int VALUE_FIELD_NUMBER = 2; + private double value_ = 0D; + /** + * double value = 2; + * @return The value. + */ + @java.lang.Override + public double getValue() { + return value_; + } + + public static final int CREATED_AT_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp createdAt_; + /** + * .google.protobuf.Timestamp created_at = 4; + * @return Whether the createdAt field is set. + */ + @java.lang.Override + public boolean hasCreatedAt() { + return createdAt_ != null; + } + /** + * .google.protobuf.Timestamp created_at = 4; + * @return The createdAt. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreatedAt() { + return createdAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_; + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder() { + return createdAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (id_ != null) { + output.writeMessage(1, getId()); + } + if (java.lang.Double.doubleToRawLongBits(value_) != 0) { + output.writeDouble(2, value_); + } + if (createdAt_ != null) { + output.writeMessage(4, getCreatedAt()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (id_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getId()); + } + if (java.lang.Double.doubleToRawLongBits(value_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(2, value_); + } + if (createdAt_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getCreatedAt()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.littlehorse.sdk.common.proto.MetricRun)) { + return super.equals(obj); + } + io.littlehorse.sdk.common.proto.MetricRun other = (io.littlehorse.sdk.common.proto.MetricRun) obj; + + if (hasId() != other.hasId()) return false; + if (hasId()) { + if (!getId() + .equals(other.getId())) return false; + } + if (java.lang.Double.doubleToLongBits(getValue()) + != java.lang.Double.doubleToLongBits( + other.getValue())) return false; + if (hasCreatedAt() != other.hasCreatedAt()) return false; + if (hasCreatedAt()) { + if (!getCreatedAt() + .equals(other.getCreatedAt())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasId()) { + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + } + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getValue())); + if (hasCreatedAt()) { + hash = (37 * hash) + CREATED_AT_FIELD_NUMBER; + hash = (53 * hash) + getCreatedAt().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static io.littlehorse.sdk.common.proto.MetricRun parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static io.littlehorse.sdk.common.proto.MetricRun parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.littlehorse.sdk.common.proto.MetricRun parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.littlehorse.sdk.common.proto.MetricRun prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code littlehorse.MetricRun} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:littlehorse.MetricRun) + io.littlehorse.sdk.common.proto.MetricRunOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricRun_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricRun_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.littlehorse.sdk.common.proto.MetricRun.class, io.littlehorse.sdk.common.proto.MetricRun.Builder.class); + } + + // Construct using io.littlehorse.sdk.common.proto.MetricRun.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = null; + if (idBuilder_ != null) { + idBuilder_.dispose(); + idBuilder_ = null; + } + value_ = 0D; + createdAt_ = null; + if (createdAtBuilder_ != null) { + createdAtBuilder_.dispose(); + createdAtBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.littlehorse.sdk.common.proto.Metrics.internal_static_littlehorse_MetricRun_descriptor; + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRun getDefaultInstanceForType() { + return io.littlehorse.sdk.common.proto.MetricRun.getDefaultInstance(); + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRun build() { + io.littlehorse.sdk.common.proto.MetricRun result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRun buildPartial() { + io.littlehorse.sdk.common.proto.MetricRun result = new io.littlehorse.sdk.common.proto.MetricRun(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(io.littlehorse.sdk.common.proto.MetricRun result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = idBuilder_ == null + ? id_ + : idBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.value_ = value_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.createdAt_ = createdAtBuilder_ == null + ? createdAt_ + : createdAtBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.littlehorse.sdk.common.proto.MetricRun) { + return mergeFrom((io.littlehorse.sdk.common.proto.MetricRun)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.littlehorse.sdk.common.proto.MetricRun other) { + if (other == io.littlehorse.sdk.common.proto.MetricRun.getDefaultInstance()) return this; + if (other.hasId()) { + mergeId(other.getId()); + } + if (other.getValue() != 0D) { + setValue(other.getValue()); + } + if (other.hasCreatedAt()) { + mergeCreatedAt(other.getCreatedAt()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getIdFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 17: { + value_ = input.readDouble(); + bitField0_ |= 0x00000002; + break; + } // case 17 + case 34: { + input.readMessage( + getCreatedAtFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private io.littlehorse.sdk.common.proto.MetricRunId id_; + private com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.MetricRunId, io.littlehorse.sdk.common.proto.MetricRunId.Builder, io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder> idBuilder_; + /** + * .littlehorse.MetricRunId id = 1; + * @return Whether the id field is set. + */ + public boolean hasId() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .littlehorse.MetricRunId id = 1; + * @return The id. + */ + public io.littlehorse.sdk.common.proto.MetricRunId getId() { + if (idBuilder_ == null) { + return id_ == null ? io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance() : id_; + } else { + return idBuilder_.getMessage(); + } + } + /** + * .littlehorse.MetricRunId id = 1; + */ + public Builder setId(io.littlehorse.sdk.common.proto.MetricRunId value) { + if (idBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + id_ = value; + } else { + idBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .littlehorse.MetricRunId id = 1; + */ + public Builder setId( + io.littlehorse.sdk.common.proto.MetricRunId.Builder builderForValue) { + if (idBuilder_ == null) { + id_ = builderForValue.build(); + } else { + idBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .littlehorse.MetricRunId id = 1; + */ + public Builder mergeId(io.littlehorse.sdk.common.proto.MetricRunId value) { + if (idBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + id_ != null && + id_ != io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance()) { + getIdBuilder().mergeFrom(value); + } else { + id_ = value; + } + } else { + idBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .littlehorse.MetricRunId id = 1; + */ + public Builder clearId() { + bitField0_ = (bitField0_ & ~0x00000001); + id_ = null; + if (idBuilder_ != null) { + idBuilder_.dispose(); + idBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .littlehorse.MetricRunId id = 1; + */ + public io.littlehorse.sdk.common.proto.MetricRunId.Builder getIdBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getIdFieldBuilder().getBuilder(); + } + /** + * .littlehorse.MetricRunId id = 1; + */ + public io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder getIdOrBuilder() { + if (idBuilder_ != null) { + return idBuilder_.getMessageOrBuilder(); + } else { + return id_ == null ? + io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance() : id_; + } + } + /** + * .littlehorse.MetricRunId id = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.MetricRunId, io.littlehorse.sdk.common.proto.MetricRunId.Builder, io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder> + getIdFieldBuilder() { + if (idBuilder_ == null) { + idBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.MetricRunId, io.littlehorse.sdk.common.proto.MetricRunId.Builder, io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder>( + getId(), + getParentForChildren(), + isClean()); + id_ = null; + } + return idBuilder_; + } + + private double value_ ; + /** + * double value = 2; + * @return The value. + */ + @java.lang.Override + public double getValue() { + return value_; + } + /** + * double value = 2; + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(double value) { + + value_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * double value = 2; + * @return This builder for chaining. + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000002); + value_ = 0D; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createdAt_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> createdAtBuilder_; + /** + * .google.protobuf.Timestamp created_at = 4; + * @return Whether the createdAt field is set. + */ + public boolean hasCreatedAt() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.protobuf.Timestamp created_at = 4; + * @return The createdAt. + */ + public com.google.protobuf.Timestamp getCreatedAt() { + if (createdAtBuilder_ == null) { + return createdAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_; + } else { + return createdAtBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + public Builder setCreatedAt(com.google.protobuf.Timestamp value) { + if (createdAtBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createdAt_ = value; + } else { + createdAtBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + public Builder setCreatedAt( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (createdAtBuilder_ == null) { + createdAt_ = builderForValue.build(); + } else { + createdAtBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + public Builder mergeCreatedAt(com.google.protobuf.Timestamp value) { + if (createdAtBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + createdAt_ != null && + createdAt_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCreatedAtBuilder().mergeFrom(value); + } else { + createdAt_ = value; + } + } else { + createdAtBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + public Builder clearCreatedAt() { + bitField0_ = (bitField0_ & ~0x00000004); + createdAt_ = null; + if (createdAtBuilder_ != null) { + createdAtBuilder_.dispose(); + createdAtBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + public com.google.protobuf.Timestamp.Builder getCreatedAtBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getCreatedAtFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + public com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder() { + if (createdAtBuilder_ != null) { + return createdAtBuilder_.getMessageOrBuilder(); + } else { + return createdAt_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_; + } + } + /** + * .google.protobuf.Timestamp created_at = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getCreatedAtFieldBuilder() { + if (createdAtBuilder_ == null) { + createdAtBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getCreatedAt(), + getParentForChildren(), + isClean()); + createdAt_ = null; + } + return createdAtBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:littlehorse.MetricRun) + } + + // @@protoc_insertion_point(class_scope:littlehorse.MetricRun) + private static final io.littlehorse.sdk.common.proto.MetricRun DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.littlehorse.sdk.common.proto.MetricRun(); + } + + public static io.littlehorse.sdk.common.proto.MetricRun getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MetricRun parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRun getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunId.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunId.java new file mode 100644 index 000000000..8c6a1cb46 --- /dev/null +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunId.java @@ -0,0 +1,767 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: object_id.proto + +package io.littlehorse.sdk.common.proto; + +/** + * Protobuf type {@code littlehorse.MetricRunId} + */ +public final class MetricRunId extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:littlehorse.MetricRunId) + MetricRunIdOrBuilder { +private static final long serialVersionUID = 0L; + // Use MetricRunId.newBuilder() to construct. + private MetricRunId(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MetricRunId() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new MetricRunId(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricRunId_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricRunId_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.littlehorse.sdk.common.proto.MetricRunId.class, io.littlehorse.sdk.common.proto.MetricRunId.Builder.class); + } + + public static final int METRIC_ID_FIELD_NUMBER = 1; + private io.littlehorse.sdk.common.proto.MetricId metricId_; + /** + * .littlehorse.MetricId metric_id = 1; + * @return Whether the metricId field is set. + */ + @java.lang.Override + public boolean hasMetricId() { + return metricId_ != null; + } + /** + * .littlehorse.MetricId metric_id = 1; + * @return The metricId. + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricId getMetricId() { + return metricId_ == null ? io.littlehorse.sdk.common.proto.MetricId.getDefaultInstance() : metricId_; + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricIdOrBuilder getMetricIdOrBuilder() { + return metricId_ == null ? io.littlehorse.sdk.common.proto.MetricId.getDefaultInstance() : metricId_; + } + + public static final int WINDOW_START_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp windowStart_; + /** + * .google.protobuf.Timestamp window_start = 2; + * @return Whether the windowStart field is set. + */ + @java.lang.Override + public boolean hasWindowStart() { + return windowStart_ != null; + } + /** + * .google.protobuf.Timestamp window_start = 2; + * @return The windowStart. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getWindowStart() { + return windowStart_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : windowStart_; + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getWindowStartOrBuilder() { + return windowStart_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : windowStart_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (metricId_ != null) { + output.writeMessage(1, getMetricId()); + } + if (windowStart_ != null) { + output.writeMessage(2, getWindowStart()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (metricId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getMetricId()); + } + if (windowStart_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getWindowStart()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof io.littlehorse.sdk.common.proto.MetricRunId)) { + return super.equals(obj); + } + io.littlehorse.sdk.common.proto.MetricRunId other = (io.littlehorse.sdk.common.proto.MetricRunId) obj; + + if (hasMetricId() != other.hasMetricId()) return false; + if (hasMetricId()) { + if (!getMetricId() + .equals(other.getMetricId())) return false; + } + if (hasWindowStart() != other.hasWindowStart()) return false; + if (hasWindowStart()) { + if (!getWindowStart() + .equals(other.getWindowStart())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasMetricId()) { + hash = (37 * hash) + METRIC_ID_FIELD_NUMBER; + hash = (53 * hash) + getMetricId().hashCode(); + } + if (hasWindowStart()) { + hash = (37 * hash) + WINDOW_START_FIELD_NUMBER; + hash = (53 * hash) + getWindowStart().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static io.littlehorse.sdk.common.proto.MetricRunId parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static io.littlehorse.sdk.common.proto.MetricRunId parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static io.littlehorse.sdk.common.proto.MetricRunId parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(io.littlehorse.sdk.common.proto.MetricRunId prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code littlehorse.MetricRunId} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:littlehorse.MetricRunId) + io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricRunId_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricRunId_fieldAccessorTable + .ensureFieldAccessorsInitialized( + io.littlehorse.sdk.common.proto.MetricRunId.class, io.littlehorse.sdk.common.proto.MetricRunId.Builder.class); + } + + // Construct using io.littlehorse.sdk.common.proto.MetricRunId.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + metricId_ = null; + if (metricIdBuilder_ != null) { + metricIdBuilder_.dispose(); + metricIdBuilder_ = null; + } + windowStart_ = null; + if (windowStartBuilder_ != null) { + windowStartBuilder_.dispose(); + windowStartBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return io.littlehorse.sdk.common.proto.ObjectId.internal_static_littlehorse_MetricRunId_descriptor; + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRunId getDefaultInstanceForType() { + return io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance(); + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRunId build() { + io.littlehorse.sdk.common.proto.MetricRunId result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRunId buildPartial() { + io.littlehorse.sdk.common.proto.MetricRunId result = new io.littlehorse.sdk.common.proto.MetricRunId(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(io.littlehorse.sdk.common.proto.MetricRunId result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.metricId_ = metricIdBuilder_ == null + ? metricId_ + : metricIdBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.windowStart_ = windowStartBuilder_ == null + ? windowStart_ + : windowStartBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof io.littlehorse.sdk.common.proto.MetricRunId) { + return mergeFrom((io.littlehorse.sdk.common.proto.MetricRunId)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(io.littlehorse.sdk.common.proto.MetricRunId other) { + if (other == io.littlehorse.sdk.common.proto.MetricRunId.getDefaultInstance()) return this; + if (other.hasMetricId()) { + mergeMetricId(other.getMetricId()); + } + if (other.hasWindowStart()) { + mergeWindowStart(other.getWindowStart()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getMetricIdFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + getWindowStartFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private io.littlehorse.sdk.common.proto.MetricId metricId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.MetricId, io.littlehorse.sdk.common.proto.MetricId.Builder, io.littlehorse.sdk.common.proto.MetricIdOrBuilder> metricIdBuilder_; + /** + * .littlehorse.MetricId metric_id = 1; + * @return Whether the metricId field is set. + */ + public boolean hasMetricId() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .littlehorse.MetricId metric_id = 1; + * @return The metricId. + */ + public io.littlehorse.sdk.common.proto.MetricId getMetricId() { + if (metricIdBuilder_ == null) { + return metricId_ == null ? io.littlehorse.sdk.common.proto.MetricId.getDefaultInstance() : metricId_; + } else { + return metricIdBuilder_.getMessage(); + } + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + public Builder setMetricId(io.littlehorse.sdk.common.proto.MetricId value) { + if (metricIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metricId_ = value; + } else { + metricIdBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + public Builder setMetricId( + io.littlehorse.sdk.common.proto.MetricId.Builder builderForValue) { + if (metricIdBuilder_ == null) { + metricId_ = builderForValue.build(); + } else { + metricIdBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + public Builder mergeMetricId(io.littlehorse.sdk.common.proto.MetricId value) { + if (metricIdBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + metricId_ != null && + metricId_ != io.littlehorse.sdk.common.proto.MetricId.getDefaultInstance()) { + getMetricIdBuilder().mergeFrom(value); + } else { + metricId_ = value; + } + } else { + metricIdBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + public Builder clearMetricId() { + bitField0_ = (bitField0_ & ~0x00000001); + metricId_ = null; + if (metricIdBuilder_ != null) { + metricIdBuilder_.dispose(); + metricIdBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + public io.littlehorse.sdk.common.proto.MetricId.Builder getMetricIdBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getMetricIdFieldBuilder().getBuilder(); + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + public io.littlehorse.sdk.common.proto.MetricIdOrBuilder getMetricIdOrBuilder() { + if (metricIdBuilder_ != null) { + return metricIdBuilder_.getMessageOrBuilder(); + } else { + return metricId_ == null ? + io.littlehorse.sdk.common.proto.MetricId.getDefaultInstance() : metricId_; + } + } + /** + * .littlehorse.MetricId metric_id = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.MetricId, io.littlehorse.sdk.common.proto.MetricId.Builder, io.littlehorse.sdk.common.proto.MetricIdOrBuilder> + getMetricIdFieldBuilder() { + if (metricIdBuilder_ == null) { + metricIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.MetricId, io.littlehorse.sdk.common.proto.MetricId.Builder, io.littlehorse.sdk.common.proto.MetricIdOrBuilder>( + getMetricId(), + getParentForChildren(), + isClean()); + metricId_ = null; + } + return metricIdBuilder_; + } + + private com.google.protobuf.Timestamp windowStart_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> windowStartBuilder_; + /** + * .google.protobuf.Timestamp window_start = 2; + * @return Whether the windowStart field is set. + */ + public boolean hasWindowStart() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .google.protobuf.Timestamp window_start = 2; + * @return The windowStart. + */ + public com.google.protobuf.Timestamp getWindowStart() { + if (windowStartBuilder_ == null) { + return windowStart_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : windowStart_; + } else { + return windowStartBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + public Builder setWindowStart(com.google.protobuf.Timestamp value) { + if (windowStartBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + windowStart_ = value; + } else { + windowStartBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + public Builder setWindowStart( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (windowStartBuilder_ == null) { + windowStart_ = builderForValue.build(); + } else { + windowStartBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + public Builder mergeWindowStart(com.google.protobuf.Timestamp value) { + if (windowStartBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + windowStart_ != null && + windowStart_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getWindowStartBuilder().mergeFrom(value); + } else { + windowStart_ = value; + } + } else { + windowStartBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + public Builder clearWindowStart() { + bitField0_ = (bitField0_ & ~0x00000002); + windowStart_ = null; + if (windowStartBuilder_ != null) { + windowStartBuilder_.dispose(); + windowStartBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + public com.google.protobuf.Timestamp.Builder getWindowStartBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getWindowStartFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + public com.google.protobuf.TimestampOrBuilder getWindowStartOrBuilder() { + if (windowStartBuilder_ != null) { + return windowStartBuilder_.getMessageOrBuilder(); + } else { + return windowStart_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : windowStart_; + } + } + /** + * .google.protobuf.Timestamp window_start = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getWindowStartFieldBuilder() { + if (windowStartBuilder_ == null) { + windowStartBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getWindowStart(), + getParentForChildren(), + isClean()); + windowStart_ = null; + } + return windowStartBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:littlehorse.MetricRunId) + } + + // @@protoc_insertion_point(class_scope:littlehorse.MetricRunId) + private static final io.littlehorse.sdk.common.proto.MetricRunId DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new io.littlehorse.sdk.common.proto.MetricRunId(); + } + + public static io.littlehorse.sdk.common.proto.MetricRunId getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MetricRunId parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public io.littlehorse.sdk.common.proto.MetricRunId getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunIdOrBuilder.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunIdOrBuilder.java new file mode 100644 index 000000000..6fa69c5fd --- /dev/null +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunIdOrBuilder.java @@ -0,0 +1,39 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: object_id.proto + +package io.littlehorse.sdk.common.proto; + +public interface MetricRunIdOrBuilder extends + // @@protoc_insertion_point(interface_extends:littlehorse.MetricRunId) + com.google.protobuf.MessageOrBuilder { + + /** + * .littlehorse.MetricId metric_id = 1; + * @return Whether the metricId field is set. + */ + boolean hasMetricId(); + /** + * .littlehorse.MetricId metric_id = 1; + * @return The metricId. + */ + io.littlehorse.sdk.common.proto.MetricId getMetricId(); + /** + * .littlehorse.MetricId metric_id = 1; + */ + io.littlehorse.sdk.common.proto.MetricIdOrBuilder getMetricIdOrBuilder(); + + /** + * .google.protobuf.Timestamp window_start = 2; + * @return Whether the windowStart field is set. + */ + boolean hasWindowStart(); + /** + * .google.protobuf.Timestamp window_start = 2; + * @return The windowStart. + */ + com.google.protobuf.Timestamp getWindowStart(); + /** + * .google.protobuf.Timestamp window_start = 2; + */ + com.google.protobuf.TimestampOrBuilder getWindowStartOrBuilder(); +} diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunOrBuilder.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunOrBuilder.java new file mode 100644 index 000000000..61c074332 --- /dev/null +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricRunOrBuilder.java @@ -0,0 +1,45 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: metrics.proto + +package io.littlehorse.sdk.common.proto; + +public interface MetricRunOrBuilder extends + // @@protoc_insertion_point(interface_extends:littlehorse.MetricRun) + com.google.protobuf.MessageOrBuilder { + + /** + * .littlehorse.MetricRunId id = 1; + * @return Whether the id field is set. + */ + boolean hasId(); + /** + * .littlehorse.MetricRunId id = 1; + * @return The id. + */ + io.littlehorse.sdk.common.proto.MetricRunId getId(); + /** + * .littlehorse.MetricRunId id = 1; + */ + io.littlehorse.sdk.common.proto.MetricRunIdOrBuilder getIdOrBuilder(); + + /** + * double value = 2; + * @return The value. + */ + double getValue(); + + /** + * .google.protobuf.Timestamp created_at = 4; + * @return Whether the createdAt field is set. + */ + boolean hasCreatedAt(); + /** + * .google.protobuf.Timestamp created_at = 4; + * @return The createdAt. + */ + com.google.protobuf.Timestamp getCreatedAt(); + /** + * .google.protobuf.Timestamp created_at = 4; + */ + com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder(); +} diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricType.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricType.java index 778123883..6c658ce7a 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricType.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/MetricType.java @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: metrics.proto +// source: common_enums.proto package io.littlehorse.sdk.common.proto; @@ -94,7 +94,7 @@ public MetricType findValueByNumber(int number) { } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return io.littlehorse.sdk.common.proto.Metrics.getDescriptor().getEnumTypes().get(1); + return io.littlehorse.sdk.common.proto.CommonEnums.getDescriptor().getEnumTypes().get(7); } private static final MetricType[] VALUES = values(); diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/Metrics.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/Metrics.java index 20c1c6244..ea9aebe2e 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/Metrics.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/Metrics.java @@ -19,11 +19,6 @@ public static void registerAllExtensions( static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_littlehorse_Metric_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_littlehorse_MetricId_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_littlehorse_MetricId_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_littlehorse_PartitionMetric_descriptor; static final @@ -39,6 +34,11 @@ public static void registerAllExtensions( static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_littlehorse_PartitionMetricId_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_littlehorse_MetricRun_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_littlehorse_MetricRun_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -54,24 +54,22 @@ public static void registerAllExtensions( "c\022!\n\002id\030\001 \001(\0132\025.littlehorse.MetricId\022.\n\n" + "created_at\030\002 \001(\0132\032.google.protobuf.Times" + "tamp\0220\n\rwindow_length\030\003 \001(\0132\031.google.pro" + - "tobuf.Duration\"d\n\010MetricId\0221\n\nmeasurable" + - "\030\001 \001(\0162\035.littlehorse.MeasurableObject\022%\n" + - "\004type\030\002 \001(\0162\027.littlehorse.MetricType\"\335\001\n" + - "\017PartitionMetric\022*\n\002id\030\001 \001(\0132\036.littlehor" + - "se.PartitionMetricId\022.\n\ncreated_at\030\002 \001(\013" + - "2\032.google.protobuf.Timestamp\022<\n\016active_w" + - "indows\030\003 \003(\0132$.littlehorse.PartitionWind" + - "owedMetric\0220\n\rwindow_length\030\004 \001(\0132\031.goog" + - "le.protobuf.Duration\"Z\n\027PartitionWindowe" + - "dMetric\022\r\n\005value\030\001 \001(\001\0220\n\014window_start\030\002" + - " \001(\0132\032.google.protobuf.Timestamp\"`\n\021Part" + - "itionMetricId\022!\n\002id\030\001 \001(\0132\025.littlehorse." + - "MetricId\022(\n\ttenant_id\030\002 \001(\0132\025.littlehors" + - "e.TenantId**\n\020MeasurableObject\022\014\n\010WORKFL" + - "OW\020\000\022\010\n\004TASK\020\001*+\n\nMetricType\022\t\n\005COUNT\020\000\022" + - "\007\n\003AVG\020\001\022\t\n\005RATIO\020\002BM\n\037io.littlehorse.sd" + - "k.common.protoP\001Z\t.;lhproto\252\002\034LittleHors" + - "e.Sdk.Common.Protob\006proto3" + "tobuf.Duration\"\335\001\n\017PartitionMetric\022*\n\002id" + + "\030\001 \001(\0132\036.littlehorse.PartitionMetricId\022." + + "\n\ncreated_at\030\002 \001(\0132\032.google.protobuf.Tim" + + "estamp\022<\n\016active_windows\030\003 \003(\0132$.littleh" + + "orse.PartitionWindowedMetric\0220\n\rwindow_l" + + "ength\030\004 \001(\0132\031.google.protobuf.Duration\"Z" + + "\n\027PartitionWindowedMetric\022\r\n\005value\030\001 \001(\001" + + "\0220\n\014window_start\030\002 \001(\0132\032.google.protobuf" + + ".Timestamp\"`\n\021PartitionMetricId\022!\n\002id\030\001 " + + "\001(\0132\025.littlehorse.MetricId\022(\n\ttenant_id\030" + + "\002 \001(\0132\025.littlehorse.TenantId\"p\n\tMetricRu" + + "n\022$\n\002id\030\001 \001(\0132\030.littlehorse.MetricRunId\022" + + "\r\n\005value\030\002 \001(\001\022.\n\ncreated_at\030\004 \001(\0132\032.goo" + + "gle.protobuf.TimestampBM\n\037io.littlehorse" + + ".sdk.common.protoP\001Z\t.;lhproto\252\002\034LittleH" + + "orse.Sdk.Common.Protob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -86,30 +84,30 @@ public static void registerAllExtensions( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_Metric_descriptor, new java.lang.String[] { "Id", "CreatedAt", "WindowLength", }); - internal_static_littlehorse_MetricId_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_littlehorse_MetricId_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_littlehorse_MetricId_descriptor, - new java.lang.String[] { "Measurable", "Type", }); internal_static_littlehorse_PartitionMetric_descriptor = - getDescriptor().getMessageTypes().get(2); + getDescriptor().getMessageTypes().get(1); internal_static_littlehorse_PartitionMetric_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_PartitionMetric_descriptor, new java.lang.String[] { "Id", "CreatedAt", "ActiveWindows", "WindowLength", }); internal_static_littlehorse_PartitionWindowedMetric_descriptor = - getDescriptor().getMessageTypes().get(3); + getDescriptor().getMessageTypes().get(2); internal_static_littlehorse_PartitionWindowedMetric_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_PartitionWindowedMetric_descriptor, new java.lang.String[] { "Value", "WindowStart", }); internal_static_littlehorse_PartitionMetricId_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(3); internal_static_littlehorse_PartitionMetricId_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_PartitionMetricId_descriptor, new java.lang.String[] { "Id", "TenantId", }); + internal_static_littlehorse_MetricRun_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_littlehorse_MetricRun_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_littlehorse_MetricRun_descriptor, + new java.lang.String[] { "Id", "Value", "CreatedAt", }); com.google.protobuf.TimestampProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); io.littlehorse.sdk.common.proto.ObjectId.getDescriptor(); diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/ObjectId.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/ObjectId.java index 7bd851f45..376b5a499 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/ObjectId.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/ObjectId.java @@ -104,6 +104,16 @@ public static void registerAllExtensions( static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_littlehorse_ScheduledWfRunId_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_littlehorse_MetricId_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_littlehorse_MetricId_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_littlehorse_MetricRunId_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_littlehorse_MetricRunId_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -150,9 +160,15 @@ public static void registerAllExtensions( "ehorse.MetricsWindowLength\022)\n\nwf_spec_id" + "\030\003 \001(\0132\025.littlehorse.WfSpecId\"\031\n\013Princip" + "alId\022\n\n\002id\030\001 \001(\t\"\026\n\010TenantId\022\n\n\002id\030\001 \001(\t" + - "\"\036\n\020ScheduledWfRunId\022\n\n\002id\030\001 \001(\tBM\n\037io.l" + - "ittlehorse.sdk.common.protoP\001Z\t.;lhproto" + - "\252\002\034LittleHorse.Sdk.Common.Protob\006proto3" + "\"\036\n\020ScheduledWfRunId\022\n\n\002id\030\001 \001(\t\"d\n\010Metr" + + "icId\0221\n\nmeasurable\030\001 \001(\0162\035.littlehorse.M" + + "easurableObject\022%\n\004type\030\002 \001(\0162\027.littleho" + + "rse.MetricType\"i\n\013MetricRunId\022(\n\tmetric_" + + "id\030\001 \001(\0132\025.littlehorse.MetricId\0220\n\014windo" + + "w_start\030\002 \001(\0132\032.google.protobuf.Timestam" + + "pBM\n\037io.littlehorse.sdk.common.protoP\001Z\t" + + ".;lhproto\252\002\034LittleHorse.Sdk.Common.Proto" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -268,6 +284,18 @@ public static void registerAllExtensions( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_ScheduledWfRunId_descriptor, new java.lang.String[] { "Id", }); + internal_static_littlehorse_MetricId_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_littlehorse_MetricId_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_littlehorse_MetricId_descriptor, + new java.lang.String[] { "Measurable", "Type", }); + internal_static_littlehorse_MetricRunId_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_littlehorse_MetricRunId_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_littlehorse_MetricRunId_descriptor, + new java.lang.String[] { "MetricId", "WindowStart", }); com.google.protobuf.TimestampProto.getDescriptor(); io.littlehorse.sdk.common.proto.CommonEnums.getDescriptor(); } diff --git a/sdk-js/src/proto/common_enums.ts b/sdk-js/src/proto/common_enums.ts index 9f1b14755..51dc3efeb 100644 --- a/sdk-js/src/proto/common_enums.ts +++ b/sdk-js/src/proto/common_enums.ts @@ -442,3 +442,75 @@ export function lHErrorTypeToNumber(object: LHErrorType): number { return -1; } } + +export enum MeasurableObject { + WORKFLOW = "WORKFLOW", + TASK = "TASK", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function measurableObjectFromJSON(object: any): MeasurableObject { + switch (object) { + case 0: + case "WORKFLOW": + return MeasurableObject.WORKFLOW; + case 1: + case "TASK": + return MeasurableObject.TASK; + case -1: + case "UNRECOGNIZED": + default: + return MeasurableObject.UNRECOGNIZED; + } +} + +export function measurableObjectToNumber(object: MeasurableObject): number { + switch (object) { + case MeasurableObject.WORKFLOW: + return 0; + case MeasurableObject.TASK: + return 1; + case MeasurableObject.UNRECOGNIZED: + default: + return -1; + } +} + +export enum MetricType { + COUNT = "COUNT", + AVG = "AVG", + RATIO = "RATIO", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function metricTypeFromJSON(object: any): MetricType { + switch (object) { + case 0: + case "COUNT": + return MetricType.COUNT; + case 1: + case "AVG": + return MetricType.AVG; + case 2: + case "RATIO": + return MetricType.RATIO; + case -1: + case "UNRECOGNIZED": + default: + return MetricType.UNRECOGNIZED; + } +} + +export function metricTypeToNumber(object: MetricType): number { + switch (object) { + case MetricType.COUNT: + return 0; + case MetricType.AVG: + return 1; + case MetricType.RATIO: + return 2; + case MetricType.UNRECOGNIZED: + default: + return -1; + } +} diff --git a/sdk-js/src/proto/metrics.ts b/sdk-js/src/proto/metrics.ts index 227aace23..a0a23c019 100644 --- a/sdk-js/src/proto/metrics.ts +++ b/sdk-js/src/proto/metrics.ts @@ -8,79 +8,7 @@ import _m0 from "protobufjs/minimal"; import { Duration } from "./google/protobuf/duration"; import { Timestamp } from "./google/protobuf/timestamp"; -import { TenantId } from "./object_id"; - -export enum MeasurableObject { - WORKFLOW = "WORKFLOW", - TASK = "TASK", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function measurableObjectFromJSON(object: any): MeasurableObject { - switch (object) { - case 0: - case "WORKFLOW": - return MeasurableObject.WORKFLOW; - case 1: - case "TASK": - return MeasurableObject.TASK; - case -1: - case "UNRECOGNIZED": - default: - return MeasurableObject.UNRECOGNIZED; - } -} - -export function measurableObjectToNumber(object: MeasurableObject): number { - switch (object) { - case MeasurableObject.WORKFLOW: - return 0; - case MeasurableObject.TASK: - return 1; - case MeasurableObject.UNRECOGNIZED: - default: - return -1; - } -} - -export enum MetricType { - COUNT = "COUNT", - AVG = "AVG", - RATIO = "RATIO", - UNRECOGNIZED = "UNRECOGNIZED", -} - -export function metricTypeFromJSON(object: any): MetricType { - switch (object) { - case 0: - case "COUNT": - return MetricType.COUNT; - case 1: - case "AVG": - return MetricType.AVG; - case 2: - case "RATIO": - return MetricType.RATIO; - case -1: - case "UNRECOGNIZED": - default: - return MetricType.UNRECOGNIZED; - } -} - -export function metricTypeToNumber(object: MetricType): number { - switch (object) { - case MetricType.COUNT: - return 0; - case MetricType.AVG: - return 1; - case MetricType.RATIO: - return 2; - case MetricType.UNRECOGNIZED: - default: - return -1; - } -} +import { MetricId, MetricRunId, TenantId } from "./object_id"; export interface Metric { id: MetricId | undefined; @@ -88,11 +16,6 @@ export interface Metric { windowLength: Duration | undefined; } -export interface MetricId { - measurable: MeasurableObject; - type: MetricType; -} - export interface PartitionMetric { id: PartitionMetricId | undefined; createdAt: string | undefined; @@ -110,6 +33,12 @@ export interface PartitionMetricId { tenantId: TenantId | undefined; } +export interface MetricRun { + id: MetricRunId | undefined; + value: number; + createdAt: string | undefined; +} + function createBaseMetric(): Metric { return { id: undefined, createdAt: undefined, windowLength: undefined }; } @@ -179,62 +108,6 @@ export const Metric = { }, }; -function createBaseMetricId(): MetricId { - return { measurable: MeasurableObject.WORKFLOW, type: MetricType.COUNT }; -} - -export const MetricId = { - encode(message: MetricId, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.measurable !== MeasurableObject.WORKFLOW) { - writer.uint32(8).int32(measurableObjectToNumber(message.measurable)); - } - if (message.type !== MetricType.COUNT) { - writer.uint32(16).int32(metricTypeToNumber(message.type)); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MetricId { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMetricId(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.measurable = measurableObjectFromJSON(reader.int32()); - continue; - case 2: - if (tag !== 16) { - break; - } - - message.type = metricTypeFromJSON(reader.int32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - - create(base?: DeepPartial): MetricId { - return MetricId.fromPartial(base ?? {}); - }, - fromPartial(object: DeepPartial): MetricId { - const message = createBaseMetricId(); - message.measurable = object.measurable ?? MeasurableObject.WORKFLOW; - message.type = object.type ?? MetricType.COUNT; - return message; - }, -}; - function createBasePartitionMetric(): PartitionMetric { return { id: undefined, createdAt: undefined, activeWindows: [], windowLength: undefined }; } @@ -429,6 +302,73 @@ export const PartitionMetricId = { }, }; +function createBaseMetricRun(): MetricRun { + return { id: undefined, value: 0, createdAt: undefined }; +} + +export const MetricRun = { + encode(message: MetricRun, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== undefined) { + MetricRunId.encode(message.id, writer.uint32(10).fork()).ldelim(); + } + if (message.value !== 0) { + writer.uint32(17).double(message.value); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MetricRun { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricRun(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = MetricRunId.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 17) { + break; + } + + message.value = reader.double(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MetricRun { + return MetricRun.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MetricRun { + const message = createBaseMetricRun(); + message.id = (object.id !== undefined && object.id !== null) ? MetricRunId.fromPartial(object.id) : undefined; + message.value = object.value ?? 0; + message.createdAt = object.createdAt ?? undefined; + return message; + }, +}; + type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial = T extends Builtin ? T diff --git a/sdk-js/src/proto/object_id.ts b/sdk-js/src/proto/object_id.ts index 8bab8fed4..78b1c9e2f 100644 --- a/sdk-js/src/proto/object_id.ts +++ b/sdk-js/src/proto/object_id.ts @@ -6,7 +6,17 @@ /* eslint-disable */ import _m0 from "protobufjs/minimal"; -import { MetricsWindowLength, metricsWindowLengthFromJSON, metricsWindowLengthToNumber } from "./common_enums"; +import { + MeasurableObject, + measurableObjectFromJSON, + measurableObjectToNumber, + MetricsWindowLength, + metricsWindowLengthFromJSON, + metricsWindowLengthToNumber, + MetricType, + metricTypeFromJSON, + metricTypeToNumber, +} from "./common_enums"; import { Timestamp } from "./google/protobuf/timestamp"; /** The ID of a WfSpec. */ @@ -218,6 +228,16 @@ export interface ScheduledWfRunId { id: string; } +export interface MetricId { + measurable: MeasurableObject; + type: MetricType; +} + +export interface MetricRunId { + metricId: MetricId | undefined; + windowStart: string | undefined; +} + function createBaseWfSpecId(): WfSpecId { return { name: "", majorVersion: 0, revision: 0 }; } @@ -1250,6 +1270,120 @@ export const ScheduledWfRunId = { }, }; +function createBaseMetricId(): MetricId { + return { measurable: MeasurableObject.WORKFLOW, type: MetricType.COUNT }; +} + +export const MetricId = { + encode(message: MetricId, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.measurable !== MeasurableObject.WORKFLOW) { + writer.uint32(8).int32(measurableObjectToNumber(message.measurable)); + } + if (message.type !== MetricType.COUNT) { + writer.uint32(16).int32(metricTypeToNumber(message.type)); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MetricId { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.measurable = measurableObjectFromJSON(reader.int32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = metricTypeFromJSON(reader.int32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MetricId { + return MetricId.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MetricId { + const message = createBaseMetricId(); + message.measurable = object.measurable ?? MeasurableObject.WORKFLOW; + message.type = object.type ?? MetricType.COUNT; + return message; + }, +}; + +function createBaseMetricRunId(): MetricRunId { + return { metricId: undefined, windowStart: undefined }; +} + +export const MetricRunId = { + encode(message: MetricRunId, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.metricId !== undefined) { + MetricId.encode(message.metricId, writer.uint32(10).fork()).ldelim(); + } + if (message.windowStart !== undefined) { + Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MetricRunId { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetricRunId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metricId = MetricId.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MetricRunId { + return MetricRunId.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MetricRunId { + const message = createBaseMetricRunId(); + message.metricId = (object.metricId !== undefined && object.metricId !== null) + ? MetricId.fromPartial(object.metricId) + : undefined; + message.windowStart = object.windowStart ?? undefined; + return message; + }, +}; + type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial = T extends Builtin ? T diff --git a/sdk-js/src/proto/service.ts b/sdk-js/src/proto/service.ts index 25f73d3a6..53a442550 100644 --- a/sdk-js/src/proto/service.ts +++ b/sdk-js/src/proto/service.ts @@ -13,9 +13,15 @@ import { LHStatus, lHStatusFromJSON, lHStatusToNumber, + MeasurableObject, + measurableObjectFromJSON, + measurableObjectToNumber, MetricsWindowLength, metricsWindowLengthFromJSON, metricsWindowLengthToNumber, + MetricType, + metricTypeFromJSON, + metricTypeToNumber, TaskStatus, taskStatusFromJSON, taskStatusToNumber, @@ -27,15 +33,7 @@ import { VariableDef } from "./common_wfspec"; import { ExternalEvent, ExternalEventDef, ExternalEventRetentionPolicy } from "./external_event"; import { Empty } from "./google/protobuf/empty"; import { Timestamp } from "./google/protobuf/timestamp"; -import { - MeasurableObject, - measurableObjectFromJSON, - measurableObjectToNumber, - Metric, - MetricType, - metricTypeFromJSON, - metricTypeToNumber, -} from "./metrics"; +import { Metric } from "./metrics"; import { NodeRun } from "./node_run"; import { ExternalEventDefId, diff --git a/sdk-python/littlehorse/model/common_enums_pb2.py b/sdk-python/littlehorse/model/common_enums_pb2.py index 39bf68c9b..f4f955da4 100644 --- a/sdk-python/littlehorse/model/common_enums_pb2.py +++ b/sdk-python/littlehorse/model/common_enums_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x63ommon_enums.proto\x12\x0blittlehorse*g\n\x08LHStatus\x12\x0c\n\x08STARTING\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tCOMPLETED\x10\x02\x12\x0b\n\x07HALTING\x10\x03\x12\n\n\x06HALTED\x10\x04\x12\t\n\x05\x45RROR\x10\x05\x12\r\n\tEXCEPTION\x10\x06*;\n\x0eMetadataStatus\x12\n\n\x06\x41\x43TIVE\x10\x00\x12\x0c\n\x08\x41RCHIVED\x10\x01\x12\x0f\n\x0bTERMINATING\x10\x02*\xce\x01\n\nTaskStatus\x12\x12\n\x0eTASK_SCHEDULED\x10\x00\x12\x10\n\x0cTASK_RUNNING\x10\x01\x12\x10\n\x0cTASK_SUCCESS\x10\x02\x12\x0f\n\x0bTASK_FAILED\x10\x03\x12\x10\n\x0cTASK_TIMEOUT\x10\x04\x12!\n\x1dTASK_OUTPUT_SERIALIZING_ERROR\x10\x05\x12\x1c\n\x18TASK_INPUT_VAR_SUB_ERROR\x10\x06\x12\x12\n\x0eTASK_EXCEPTION\x10\x08\x12\x10\n\x0cTASK_PENDING\x10\t*=\n\x13MetricsWindowLength\x12\r\n\tMINUTES_5\x10\x00\x12\x0b\n\x07HOURS_2\x10\x01\x12\n\n\x06\x44\x41YS_1\x10\x02*]\n\x0cVariableType\x12\x0c\n\x08JSON_OBJ\x10\x00\x12\x0c\n\x08JSON_ARR\x10\x01\x12\n\n\x06\x44OUBLE\x10\x02\x12\x08\n\x04\x42OOL\x10\x03\x12\x07\n\x03STR\x10\x04\x12\x07\n\x03INT\x10\x05\x12\t\n\x05\x42YTES\x10\x06*\xb6\x01\n\x0bLHErrorType\x12\x11\n\rCHILD_FAILURE\x10\x00\x12\x11\n\rVAR_SUB_ERROR\x10\x01\x12\x16\n\x12VAR_MUTATION_ERROR\x10\x02\x12\x17\n\x13USER_TASK_CANCELLED\x10\x03\x12\x0b\n\x07TIMEOUT\x10\x04\x12\x10\n\x0cTASK_FAILURE\x10\x05\x12\r\n\tVAR_ERROR\x10\x06\x12\x0e\n\nTASK_ERROR\x10\x07\x12\x12\n\x0eINTERNAL_ERROR\x10\x08\x42M\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x1cLittleHorse.Sdk.Common.Protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x63ommon_enums.proto\x12\x0blittlehorse*g\n\x08LHStatus\x12\x0c\n\x08STARTING\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tCOMPLETED\x10\x02\x12\x0b\n\x07HALTING\x10\x03\x12\n\n\x06HALTED\x10\x04\x12\t\n\x05\x45RROR\x10\x05\x12\r\n\tEXCEPTION\x10\x06*;\n\x0eMetadataStatus\x12\n\n\x06\x41\x43TIVE\x10\x00\x12\x0c\n\x08\x41RCHIVED\x10\x01\x12\x0f\n\x0bTERMINATING\x10\x02*\xce\x01\n\nTaskStatus\x12\x12\n\x0eTASK_SCHEDULED\x10\x00\x12\x10\n\x0cTASK_RUNNING\x10\x01\x12\x10\n\x0cTASK_SUCCESS\x10\x02\x12\x0f\n\x0bTASK_FAILED\x10\x03\x12\x10\n\x0cTASK_TIMEOUT\x10\x04\x12!\n\x1dTASK_OUTPUT_SERIALIZING_ERROR\x10\x05\x12\x1c\n\x18TASK_INPUT_VAR_SUB_ERROR\x10\x06\x12\x12\n\x0eTASK_EXCEPTION\x10\x08\x12\x10\n\x0cTASK_PENDING\x10\t*=\n\x13MetricsWindowLength\x12\r\n\tMINUTES_5\x10\x00\x12\x0b\n\x07HOURS_2\x10\x01\x12\n\n\x06\x44\x41YS_1\x10\x02*]\n\x0cVariableType\x12\x0c\n\x08JSON_OBJ\x10\x00\x12\x0c\n\x08JSON_ARR\x10\x01\x12\n\n\x06\x44OUBLE\x10\x02\x12\x08\n\x04\x42OOL\x10\x03\x12\x07\n\x03STR\x10\x04\x12\x07\n\x03INT\x10\x05\x12\t\n\x05\x42YTES\x10\x06*\xb6\x01\n\x0bLHErrorType\x12\x11\n\rCHILD_FAILURE\x10\x00\x12\x11\n\rVAR_SUB_ERROR\x10\x01\x12\x16\n\x12VAR_MUTATION_ERROR\x10\x02\x12\x17\n\x13USER_TASK_CANCELLED\x10\x03\x12\x0b\n\x07TIMEOUT\x10\x04\x12\x10\n\x0cTASK_FAILURE\x10\x05\x12\r\n\tVAR_ERROR\x10\x06\x12\x0e\n\nTASK_ERROR\x10\x07\x12\x12\n\x0eINTERNAL_ERROR\x10\x08**\n\x10MeasurableObject\x12\x0c\n\x08WORKFLOW\x10\x00\x12\x08\n\x04TASK\x10\x01*+\n\nMetricType\x12\t\n\x05\x43OUNT\x10\x00\x12\x07\n\x03\x41VG\x10\x01\x12\t\n\x05RATIO\x10\x02\x42M\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x1cLittleHorse.Sdk.Common.Protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -34,4 +34,8 @@ _globals['_VARIABLETYPE']._serialized_end=566 _globals['_LHERRORTYPE']._serialized_start=569 _globals['_LHERRORTYPE']._serialized_end=751 + _globals['_MEASURABLEOBJECT']._serialized_start=753 + _globals['_MEASURABLEOBJECT']._serialized_end=795 + _globals['_METRICTYPE']._serialized_start=797 + _globals['_METRICTYPE']._serialized_end=840 # @@protoc_insertion_point(module_scope) diff --git a/sdk-python/littlehorse/model/common_enums_pb2.pyi b/sdk-python/littlehorse/model/common_enums_pb2.pyi index 2cefcf387..31f38c3b3 100644 --- a/sdk-python/littlehorse/model/common_enums_pb2.pyi +++ b/sdk-python/littlehorse/model/common_enums_pb2.pyi @@ -59,6 +59,17 @@ class LHErrorType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): VAR_ERROR: _ClassVar[LHErrorType] TASK_ERROR: _ClassVar[LHErrorType] INTERNAL_ERROR: _ClassVar[LHErrorType] + +class MeasurableObject(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = [] + WORKFLOW: _ClassVar[MeasurableObject] + TASK: _ClassVar[MeasurableObject] + +class MetricType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = [] + COUNT: _ClassVar[MetricType] + AVG: _ClassVar[MetricType] + RATIO: _ClassVar[MetricType] STARTING: LHStatus RUNNING: LHStatus COMPLETED: LHStatus @@ -97,3 +108,8 @@ TASK_FAILURE: LHErrorType VAR_ERROR: LHErrorType TASK_ERROR: LHErrorType INTERNAL_ERROR: LHErrorType +WORKFLOW: MeasurableObject +TASK: MeasurableObject +COUNT: MetricType +AVG: MetricType +RATIO: MetricType diff --git a/sdk-python/littlehorse/model/metrics_pb2.py b/sdk-python/littlehorse/model/metrics_pb2.py index 25e85a775..ad58157f5 100644 --- a/sdk-python/littlehorse/model/metrics_pb2.py +++ b/sdk-python/littlehorse/model/metrics_pb2.py @@ -16,7 +16,7 @@ import littlehorse.model.object_id_pb2 as object__id__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rmetrics.proto\x12\x0blittlehorse\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x0fobject_id.proto\"\x8d\x01\n\x06Metric\x12!\n\x02id\x18\x01 \x01(\x0b\x32\x15.littlehorse.MetricId\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\rwindow_length\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\"d\n\x08MetricId\x12\x31\n\nmeasurable\x18\x01 \x01(\x0e\x32\x1d.littlehorse.MeasurableObject\x12%\n\x04type\x18\x02 \x01(\x0e\x32\x17.littlehorse.MetricType\"\xdd\x01\n\x0fPartitionMetric\x12*\n\x02id\x18\x01 \x01(\x0b\x32\x1e.littlehorse.PartitionMetricId\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12<\n\x0e\x61\x63tive_windows\x18\x03 \x03(\x0b\x32$.littlehorse.PartitionWindowedMetric\x12\x30\n\rwindow_length\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\"Z\n\x17PartitionWindowedMetric\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x30\n\x0cwindow_start\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"`\n\x11PartitionMetricId\x12!\n\x02id\x18\x01 \x01(\x0b\x32\x15.littlehorse.MetricId\x12(\n\ttenant_id\x18\x02 \x01(\x0b\x32\x15.littlehorse.TenantId**\n\x10MeasurableObject\x12\x0c\n\x08WORKFLOW\x10\x00\x12\x08\n\x04TASK\x10\x01*+\n\nMetricType\x12\t\n\x05\x43OUNT\x10\x00\x12\x07\n\x03\x41VG\x10\x01\x12\t\n\x05RATIO\x10\x02\x42M\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x1cLittleHorse.Sdk.Common.Protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rmetrics.proto\x12\x0blittlehorse\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x0fobject_id.proto\"\x8d\x01\n\x06Metric\x12!\n\x02id\x18\x01 \x01(\x0b\x32\x15.littlehorse.MetricId\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\rwindow_length\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\"\xdd\x01\n\x0fPartitionMetric\x12*\n\x02id\x18\x01 \x01(\x0b\x32\x1e.littlehorse.PartitionMetricId\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12<\n\x0e\x61\x63tive_windows\x18\x03 \x03(\x0b\x32$.littlehorse.PartitionWindowedMetric\x12\x30\n\rwindow_length\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\"Z\n\x17PartitionWindowedMetric\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x30\n\x0cwindow_start\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"`\n\x11PartitionMetricId\x12!\n\x02id\x18\x01 \x01(\x0b\x32\x15.littlehorse.MetricId\x12(\n\ttenant_id\x18\x02 \x01(\x0b\x32\x15.littlehorse.TenantId\"p\n\tMetricRun\x12$\n\x02id\x18\x01 \x01(\x0b\x32\x18.littlehorse.MetricRunId\x12\r\n\x05value\x18\x02 \x01(\x01\x12.\n\ncreated_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampBM\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x1cLittleHorse.Sdk.Common.Protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -25,18 +25,14 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\037io.littlehorse.sdk.common.protoP\001Z\t.;lhproto\252\002\034LittleHorse.Sdk.Common.Proto' - _globals['_MEASURABLEOBJECT']._serialized_start=772 - _globals['_MEASURABLEOBJECT']._serialized_end=814 - _globals['_METRICTYPE']._serialized_start=816 - _globals['_METRICTYPE']._serialized_end=859 _globals['_METRIC']._serialized_start=113 _globals['_METRIC']._serialized_end=254 - _globals['_METRICID']._serialized_start=256 - _globals['_METRICID']._serialized_end=356 - _globals['_PARTITIONMETRIC']._serialized_start=359 - _globals['_PARTITIONMETRIC']._serialized_end=580 - _globals['_PARTITIONWINDOWEDMETRIC']._serialized_start=582 - _globals['_PARTITIONWINDOWEDMETRIC']._serialized_end=672 - _globals['_PARTITIONMETRICID']._serialized_start=674 - _globals['_PARTITIONMETRICID']._serialized_end=770 + _globals['_PARTITIONMETRIC']._serialized_start=257 + _globals['_PARTITIONMETRIC']._serialized_end=478 + _globals['_PARTITIONWINDOWEDMETRIC']._serialized_start=480 + _globals['_PARTITIONWINDOWEDMETRIC']._serialized_end=570 + _globals['_PARTITIONMETRICID']._serialized_start=572 + _globals['_PARTITIONMETRICID']._serialized_end=668 + _globals['_METRICRUN']._serialized_start=670 + _globals['_METRICRUN']._serialized_end=782 # @@protoc_insertion_point(module_scope) diff --git a/sdk-python/littlehorse/model/metrics_pb2.pyi b/sdk-python/littlehorse/model/metrics_pb2.pyi index dfffb05fe..d32c1dafa 100644 --- a/sdk-python/littlehorse/model/metrics_pb2.pyi +++ b/sdk-python/littlehorse/model/metrics_pb2.pyi @@ -2,46 +2,21 @@ from google.protobuf import timestamp_pb2 as _timestamp_pb2 from google.protobuf import duration_pb2 as _duration_pb2 import littlehorse.model.object_id_pb2 as _object_id_pb2 from google.protobuf.internal import containers as _containers -from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor -class MeasurableObject(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): - __slots__ = [] - WORKFLOW: _ClassVar[MeasurableObject] - TASK: _ClassVar[MeasurableObject] - -class MetricType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): - __slots__ = [] - COUNT: _ClassVar[MetricType] - AVG: _ClassVar[MetricType] - RATIO: _ClassVar[MetricType] -WORKFLOW: MeasurableObject -TASK: MeasurableObject -COUNT: MetricType -AVG: MetricType -RATIO: MetricType - class Metric(_message.Message): __slots__ = ["id", "created_at", "window_length"] ID_FIELD_NUMBER: _ClassVar[int] CREATED_AT_FIELD_NUMBER: _ClassVar[int] WINDOW_LENGTH_FIELD_NUMBER: _ClassVar[int] - id: MetricId + id: _object_id_pb2.MetricId created_at: _timestamp_pb2.Timestamp window_length: _duration_pb2.Duration - def __init__(self, id: _Optional[_Union[MetricId, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., window_length: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ...) -> None: ... - -class MetricId(_message.Message): - __slots__ = ["measurable", "type"] - MEASURABLE_FIELD_NUMBER: _ClassVar[int] - TYPE_FIELD_NUMBER: _ClassVar[int] - measurable: MeasurableObject - type: MetricType - def __init__(self, measurable: _Optional[_Union[MeasurableObject, str]] = ..., type: _Optional[_Union[MetricType, str]] = ...) -> None: ... + def __init__(self, id: _Optional[_Union[_object_id_pb2.MetricId, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., window_length: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ...) -> None: ... class PartitionMetric(_message.Message): __slots__ = ["id", "created_at", "active_windows", "window_length"] @@ -67,6 +42,16 @@ class PartitionMetricId(_message.Message): __slots__ = ["id", "tenant_id"] ID_FIELD_NUMBER: _ClassVar[int] TENANT_ID_FIELD_NUMBER: _ClassVar[int] - id: MetricId + id: _object_id_pb2.MetricId tenant_id: _object_id_pb2.TenantId - def __init__(self, id: _Optional[_Union[MetricId, _Mapping]] = ..., tenant_id: _Optional[_Union[_object_id_pb2.TenantId, _Mapping]] = ...) -> None: ... + def __init__(self, id: _Optional[_Union[_object_id_pb2.MetricId, _Mapping]] = ..., tenant_id: _Optional[_Union[_object_id_pb2.TenantId, _Mapping]] = ...) -> None: ... + +class MetricRun(_message.Message): + __slots__ = ["id", "value", "created_at"] + ID_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + CREATED_AT_FIELD_NUMBER: _ClassVar[int] + id: _object_id_pb2.MetricRunId + value: float + created_at: _timestamp_pb2.Timestamp + def __init__(self, id: _Optional[_Union[_object_id_pb2.MetricRunId, _Mapping]] = ..., value: _Optional[float] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... diff --git a/sdk-python/littlehorse/model/object_id_pb2.py b/sdk-python/littlehorse/model/object_id_pb2.py index 56d6f2291..73e071111 100644 --- a/sdk-python/littlehorse/model/object_id_pb2.py +++ b/sdk-python/littlehorse/model/object_id_pb2.py @@ -15,7 +15,7 @@ import littlehorse.model.common_enums_pb2 as common__enums__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fobject_id.proto\x12\x0blittlehorse\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x12\x63ommon_enums.proto\"A\n\x08WfSpecId\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rmajor_version\x18\x02 \x01(\x05\x12\x10\n\x08revision\x18\x03 \x01(\x05\"\x19\n\tTaskDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\"\"\n\x12\x45xternalEventDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\".\n\rUserTaskDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x05\"\"\n\x12WorkflowEventDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\"@\n\x11TaskWorkerGroupId\x12+\n\x0btask_def_id\x18\x01 \x01(\x0b\x32\x16.littlehorse.TaskDefId\"^\n\nVariableId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x19\n\x11thread_run_number\x18\x02 \x01(\x05\x12\x0c\n\x04name\x18\x03 \x01(\t\"\x88\x01\n\x0f\x45xternalEventId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12>\n\x15\x65xternal_event_def_id\x18\x02 \x01(\x0b\x32\x1f.littlehorse.ExternalEventDefId\x12\x0c\n\x04guid\x18\x03 \x01(\t\"_\n\x07WfRunId\x12\n\n\x02id\x18\x01 \x01(\t\x12\x33\n\x10parent_wf_run_id\x18\x02 \x01(\x0b\x32\x14.littlehorse.WfRunIdH\x00\x88\x01\x01\x42\x13\n\x11_parent_wf_run_id\"a\n\tNodeRunId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x19\n\x11thread_run_number\x18\x02 \x01(\x05\x12\x10\n\x08position\x18\x03 \x01(\x05\"\x8a\x01\n\x0fWorkflowEventId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12>\n\x15workflow_event_def_id\x18\x02 \x01(\x0b\x32\x1f.littlehorse.WorkflowEventDefId\x12\x0e\n\x06number\x18\x03 \x01(\x05\"G\n\tTaskRunId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x11\n\ttask_guid\x18\x02 \x01(\t\"P\n\rUserTaskRunId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x16\n\x0euser_task_guid\x18\x02 \x01(\t\"\xa8\x01\n\x10TaskDefMetricsId\x12\x30\n\x0cwindow_start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x0bwindow_type\x18\x02 \x01(\x0e\x32 .littlehorse.MetricsWindowLength\x12+\n\x0btask_def_id\x18\x03 \x01(\x0b\x32\x16.littlehorse.TaskDefId\"\xa5\x01\n\x0fWfSpecMetricsId\x12\x30\n\x0cwindow_start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x0bwindow_type\x18\x02 \x01(\x0e\x32 .littlehorse.MetricsWindowLength\x12)\n\nwf_spec_id\x18\x03 \x01(\x0b\x32\x15.littlehorse.WfSpecId\"\x19\n\x0bPrincipalId\x12\n\n\x02id\x18\x01 \x01(\t\"\x16\n\x08TenantId\x12\n\n\x02id\x18\x01 \x01(\t\"\x1e\n\x10ScheduledWfRunId\x12\n\n\x02id\x18\x01 \x01(\tBM\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x1cLittleHorse.Sdk.Common.Protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fobject_id.proto\x12\x0blittlehorse\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x12\x63ommon_enums.proto\"A\n\x08WfSpecId\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x15\n\rmajor_version\x18\x02 \x01(\x05\x12\x10\n\x08revision\x18\x03 \x01(\x05\"\x19\n\tTaskDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\"\"\n\x12\x45xternalEventDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\".\n\rUserTaskDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x05\"\"\n\x12WorkflowEventDefId\x12\x0c\n\x04name\x18\x01 \x01(\t\"@\n\x11TaskWorkerGroupId\x12+\n\x0btask_def_id\x18\x01 \x01(\x0b\x32\x16.littlehorse.TaskDefId\"^\n\nVariableId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x19\n\x11thread_run_number\x18\x02 \x01(\x05\x12\x0c\n\x04name\x18\x03 \x01(\t\"\x88\x01\n\x0f\x45xternalEventId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12>\n\x15\x65xternal_event_def_id\x18\x02 \x01(\x0b\x32\x1f.littlehorse.ExternalEventDefId\x12\x0c\n\x04guid\x18\x03 \x01(\t\"_\n\x07WfRunId\x12\n\n\x02id\x18\x01 \x01(\t\x12\x33\n\x10parent_wf_run_id\x18\x02 \x01(\x0b\x32\x14.littlehorse.WfRunIdH\x00\x88\x01\x01\x42\x13\n\x11_parent_wf_run_id\"a\n\tNodeRunId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x19\n\x11thread_run_number\x18\x02 \x01(\x05\x12\x10\n\x08position\x18\x03 \x01(\x05\"\x8a\x01\n\x0fWorkflowEventId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12>\n\x15workflow_event_def_id\x18\x02 \x01(\x0b\x32\x1f.littlehorse.WorkflowEventDefId\x12\x0e\n\x06number\x18\x03 \x01(\x05\"G\n\tTaskRunId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x11\n\ttask_guid\x18\x02 \x01(\t\"P\n\rUserTaskRunId\x12\'\n\twf_run_id\x18\x01 \x01(\x0b\x32\x14.littlehorse.WfRunId\x12\x16\n\x0euser_task_guid\x18\x02 \x01(\t\"\xa8\x01\n\x10TaskDefMetricsId\x12\x30\n\x0cwindow_start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x0bwindow_type\x18\x02 \x01(\x0e\x32 .littlehorse.MetricsWindowLength\x12+\n\x0btask_def_id\x18\x03 \x01(\x0b\x32\x16.littlehorse.TaskDefId\"\xa5\x01\n\x0fWfSpecMetricsId\x12\x30\n\x0cwindow_start\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x0bwindow_type\x18\x02 \x01(\x0e\x32 .littlehorse.MetricsWindowLength\x12)\n\nwf_spec_id\x18\x03 \x01(\x0b\x32\x15.littlehorse.WfSpecId\"\x19\n\x0bPrincipalId\x12\n\n\x02id\x18\x01 \x01(\t\"\x16\n\x08TenantId\x12\n\n\x02id\x18\x01 \x01(\t\"\x1e\n\x10ScheduledWfRunId\x12\n\n\x02id\x18\x01 \x01(\t\"d\n\x08MetricId\x12\x31\n\nmeasurable\x18\x01 \x01(\x0e\x32\x1d.littlehorse.MeasurableObject\x12%\n\x04type\x18\x02 \x01(\x0e\x32\x17.littlehorse.MetricType\"i\n\x0bMetricRunId\x12(\n\tmetric_id\x18\x01 \x01(\x0b\x32\x15.littlehorse.MetricId\x12\x30\n\x0cwindow_start\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampBM\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x1cLittleHorse.Sdk.Common.Protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -60,4 +60,8 @@ _globals['_TENANTID']._serialized_end=1480 _globals['_SCHEDULEDWFRUNID']._serialized_start=1482 _globals['_SCHEDULEDWFRUNID']._serialized_end=1512 + _globals['_METRICID']._serialized_start=1514 + _globals['_METRICID']._serialized_end=1614 + _globals['_METRICRUNID']._serialized_start=1616 + _globals['_METRICRUNID']._serialized_end=1721 # @@protoc_insertion_point(module_scope) diff --git a/sdk-python/littlehorse/model/object_id_pb2.pyi b/sdk-python/littlehorse/model/object_id_pb2.pyi index 24b4f3775..2c5359905 100644 --- a/sdk-python/littlehorse/model/object_id_pb2.pyi +++ b/sdk-python/littlehorse/model/object_id_pb2.pyi @@ -149,3 +149,19 @@ class ScheduledWfRunId(_message.Message): ID_FIELD_NUMBER: _ClassVar[int] id: str def __init__(self, id: _Optional[str] = ...) -> None: ... + +class MetricId(_message.Message): + __slots__ = ["measurable", "type"] + MEASURABLE_FIELD_NUMBER: _ClassVar[int] + TYPE_FIELD_NUMBER: _ClassVar[int] + measurable: _common_enums_pb2.MeasurableObject + type: _common_enums_pb2.MetricType + def __init__(self, measurable: _Optional[_Union[_common_enums_pb2.MeasurableObject, str]] = ..., type: _Optional[_Union[_common_enums_pb2.MetricType, str]] = ...) -> None: ... + +class MetricRunId(_message.Message): + __slots__ = ["metric_id", "window_start"] + METRIC_ID_FIELD_NUMBER: _ClassVar[int] + WINDOW_START_FIELD_NUMBER: _ClassVar[int] + metric_id: MetricId + window_start: _timestamp_pb2.Timestamp + def __init__(self, metric_id: _Optional[_Union[MetricId, _Mapping]] = ..., window_start: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... diff --git a/sdk-python/littlehorse/model/service_pb2.pyi b/sdk-python/littlehorse/model/service_pb2.pyi index eb8e421b7..26a1f393a 100644 --- a/sdk-python/littlehorse/model/service_pb2.pyi +++ b/sdk-python/littlehorse/model/service_pb2.pyi @@ -65,9 +65,9 @@ class PutMetricRequest(_message.Message): __slots__ = ["measurable", "type"] MEASURABLE_FIELD_NUMBER: _ClassVar[int] TYPE_FIELD_NUMBER: _ClassVar[int] - measurable: _metrics_pb2.MeasurableObject - type: _metrics_pb2.MetricType - def __init__(self, measurable: _Optional[_Union[_metrics_pb2.MeasurableObject, str]] = ..., type: _Optional[_Union[_metrics_pb2.MetricType, str]] = ...) -> None: ... + measurable: _common_enums_pb2.MeasurableObject + type: _common_enums_pb2.MetricType + def __init__(self, measurable: _Optional[_Union[_common_enums_pb2.MeasurableObject, str]] = ..., type: _Optional[_Union[_common_enums_pb2.MetricType, str]] = ...) -> None: ... class PutTaskDefRequest(_message.Message): __slots__ = ["name", "input_vars", "output_schema"] diff --git a/server/src/main/java/io/littlehorse/common/model/AbstractGetable.java b/server/src/main/java/io/littlehorse/common/model/AbstractGetable.java index 36de7d425..1a64a40e9 100644 --- a/server/src/main/java/io/littlehorse/common/model/AbstractGetable.java +++ b/server/src/main/java/io/littlehorse/common/model/AbstractGetable.java @@ -5,6 +5,7 @@ import io.littlehorse.common.model.getable.ObjectIdModel; import io.littlehorse.common.model.getable.core.events.WorkflowEventModel; import io.littlehorse.common.model.getable.core.externalevent.ExternalEventModel; +import io.littlehorse.common.model.getable.core.metrics.MetricRunModel; import io.littlehorse.common.model.getable.core.noderun.NodeRunModel; import io.littlehorse.common.model.getable.core.taskrun.TaskRunModel; import io.littlehorse.common.model.getable.core.taskworkergroup.TaskWorkerGroupModel; @@ -24,6 +25,7 @@ import io.littlehorse.common.model.getable.objectId.ExternalEventDefIdModel; import io.littlehorse.common.model.getable.objectId.ExternalEventIdModel; import io.littlehorse.common.model.getable.objectId.MetricIdModel; +import io.littlehorse.common.model.getable.objectId.MetricRunIdModel; import io.littlehorse.common.model.getable.objectId.NodeRunIdModel; import io.littlehorse.common.model.getable.objectId.PartitionMetricIdModel; import io.littlehorse.common.model.getable.objectId.PrincipalIdModel; @@ -109,6 +111,8 @@ public static GetableClassEnum getTypeEnum(Class> c return GetableClassEnum.METRIC; } else if (cls.equals(PartitionMetricModel.class)) { return GetableClassEnum.PARTITION_METRIC; + } else if (cls.equals(MetricRunModel.class)) { + return GetableClassEnum.METRIC_RUN; } else { throw new IllegalArgumentException("Uh oh, unrecognized: " + cls.getName()); } @@ -156,6 +160,8 @@ public static Class> getCls(GetableClassEnum type) return MetricModel.class; case PARTITION_METRIC: return PartitionMetricModel.class; + case METRIC_RUN: + return MetricRunModel.class; case UNRECOGNIZED: // default: } @@ -204,6 +210,8 @@ public static Class> getCls(GetableClassEnum type) return MetricIdModel.class; case PARTITION_METRIC: return PartitionMetricIdModel.class; + case METRIC_RUN: + return MetricRunIdModel.class; case UNRECOGNIZED: } throw new IllegalArgumentException("Unrecognized/unimplemented GetableClassEnum"); diff --git a/server/src/main/java/io/littlehorse/common/model/AggregateMetricsModel.java b/server/src/main/java/io/littlehorse/common/model/AggregateMetricsModel.java index de5232bf4..c685feb0d 100644 --- a/server/src/main/java/io/littlehorse/common/model/AggregateMetricsModel.java +++ b/server/src/main/java/io/littlehorse/common/model/AggregateMetricsModel.java @@ -2,18 +2,24 @@ import com.google.protobuf.Message; import io.littlehorse.common.LHSerializable; +import io.littlehorse.common.model.getable.core.metrics.MetricRunModel; +import io.littlehorse.common.model.getable.objectId.MetricRunIdModel; import io.littlehorse.common.model.getable.objectId.TenantIdModel; import io.littlehorse.common.model.repartitioncommand.RepartitionSubCommand; import io.littlehorse.common.proto.AggregateMetrics; import io.littlehorse.common.proto.RepartitionWindowedMetric; import io.littlehorse.sdk.common.exception.LHSerdeError; +import io.littlehorse.sdk.common.proto.MetricRun; +import io.littlehorse.server.streams.store.StoredGetable; import io.littlehorse.server.streams.stores.TenantScopedStore; import io.littlehorse.server.streams.topology.core.ExecutionContext; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import lombok.extern.slf4j.Slf4j; import org.apache.kafka.streams.processor.api.ProcessorContext; +@Slf4j public class AggregateMetricsModel extends LHSerializable implements RepartitionSubCommand { private TenantIdModel tenantId; @@ -60,7 +66,27 @@ public Class getProtoBaseClass() { } @Override - public void process(TenantScopedStore repartitionedStore, ProcessorContext ctx) {} + public void process(TenantScopedStore repartitionedStore, ProcessorContext ctx) { + try { + for (RepartitionWindowedMetricModel windowedMetric : windowedMetrics) { + StoredGetable storedGetable = + (StoredGetable) repartitionedStore.get( + new MetricRunIdModel(windowedMetric.getMetricId(), windowedMetric.getWindowStart()) + .getStoreableKey(), + StoredGetable.class); + if (storedGetable == null) { + storedGetable = new StoredGetable<>(new MetricRunModel( + new MetricRunIdModel(windowedMetric.getMetricId(), windowedMetric.getWindowStart()))); + } + MetricRunModel metricRun = storedGetable.getStoredObject(); + metricRun.mergePartitionMetric(windowedMetric); + repartitionedStore.put(storedGetable); + log.info("Persisted metric run: {}", metricRun); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } @Override public String getPartitionKey() { diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/metrics/MetricRunModel.java b/server/src/main/java/io/littlehorse/common/model/getable/core/metrics/MetricRunModel.java new file mode 100644 index 000000000..e7e9cbf95 --- /dev/null +++ b/server/src/main/java/io/littlehorse/common/model/getable/core/metrics/MetricRunModel.java @@ -0,0 +1,77 @@ +package io.littlehorse.common.model.getable.core.metrics; + +import com.google.protobuf.Message; +import io.littlehorse.common.LHSerializable; +import io.littlehorse.common.model.AbstractGetable; +import io.littlehorse.common.model.RepartitionWindowedMetricModel; +import io.littlehorse.common.model.RepartitionedGetable; +import io.littlehorse.common.model.getable.objectId.MetricRunIdModel; +import io.littlehorse.common.proto.TagStorageType; +import io.littlehorse.common.util.LHUtil; +import io.littlehorse.sdk.common.exception.LHSerdeError; +import io.littlehorse.sdk.common.proto.MetricRun; +import io.littlehorse.server.streams.storeinternals.GetableIndex; +import io.littlehorse.server.streams.storeinternals.index.IndexedField; +import io.littlehorse.server.streams.topology.core.ExecutionContext; +import java.util.Date; +import java.util.List; +import java.util.Optional; + +public class MetricRunModel extends RepartitionedGetable { + + private MetricRunIdModel metricRunId; + private Date createdAt; + private double value; + + public MetricRunModel() {} + + public MetricRunModel(MetricRunIdModel metricRunId) { + this.metricRunId = metricRunId; + this.createdAt = new Date(); + } + + @Override + public void initFrom(Message proto, ExecutionContext context) throws LHSerdeError { + MetricRun p = (MetricRun) proto; + this.metricRunId = LHSerializable.fromProto(p.getId(), MetricRunIdModel.class, context); + this.createdAt = LHUtil.fromProtoTs(p.getCreatedAt()); + this.value = p.getValue(); + } + + @Override + public MetricRun.Builder toProto() { + return MetricRun.newBuilder() + .setId(metricRunId.toProto()) + .setCreatedAt(LHUtil.fromDate(createdAt)) + .setValue(value); + } + + @Override + public Class getProtoBaseClass() { + return MetricRun.class; + } + + @Override + public Date getCreatedAt() { + return createdAt; + } + + @Override + public List>> getIndexConfigurations() { + return List.of(); + } + + @Override + public MetricRunIdModel getObjectId() { + return metricRunId; + } + + @Override + public List getIndexValues(String key, Optional tagStorageType) { + return List.of(); + } + + public void mergePartitionMetric(RepartitionWindowedMetricModel repartitionMetric) { + value += repartitionMetric.getValue(); + } +} diff --git a/server/src/main/java/io/littlehorse/common/model/getable/global/metrics/PartitionWindowedMetricModel.java b/server/src/main/java/io/littlehorse/common/model/getable/global/metrics/PartitionWindowedMetricModel.java index 43c6c8ed2..a9de27ecb 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/global/metrics/PartitionWindowedMetricModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/global/metrics/PartitionWindowedMetricModel.java @@ -15,7 +15,6 @@ @Slf4j public class PartitionWindowedMetricModel extends LHSerializable implements Comparable { - private double value; private LocalDateTime windowStart; @@ -63,7 +62,7 @@ public void increment() { value++; } - double getValue() { + public double getValue() { return value; } diff --git a/server/src/main/java/io/littlehorse/common/model/getable/objectId/MetricRunIdModel.java b/server/src/main/java/io/littlehorse/common/model/getable/objectId/MetricRunIdModel.java new file mode 100644 index 000000000..dfceb58aa --- /dev/null +++ b/server/src/main/java/io/littlehorse/common/model/getable/objectId/MetricRunIdModel.java @@ -0,0 +1,66 @@ +package io.littlehorse.common.model.getable.objectId; + +import com.google.protobuf.Message; +import io.littlehorse.common.LHSerializable; +import io.littlehorse.common.model.getable.RepartitionedId; +import io.littlehorse.common.model.getable.core.metrics.MetricRunModel; +import io.littlehorse.common.proto.GetableClassEnum; +import io.littlehorse.common.util.LHUtil; +import io.littlehorse.sdk.common.exception.LHSerdeError; +import io.littlehorse.sdk.common.proto.MetricRun; +import io.littlehorse.sdk.common.proto.MetricRunId; +import io.littlehorse.server.streams.topology.core.ExecutionContext; +import java.util.Date; +import java.util.Optional; + +public class MetricRunIdModel extends RepartitionedId { + + private MetricIdModel metricId; + private Date windowStart; + + public MetricRunIdModel() {} + + public MetricRunIdModel(MetricIdModel metricId, Date windowStart) { + this.metricId = metricId; + this.windowStart = windowStart; + } + + @Override + public MetricRunId.Builder toProto() { + return MetricRunId.newBuilder().setMetricId(metricId.toProto()).setWindowStart(LHUtil.fromDate(windowStart)); + } + + @Override + public void initFrom(Message proto, ExecutionContext context) throws LHSerdeError { + MetricRunId p = (MetricRunId) proto; + this.metricId = LHSerializable.fromProto(p.getMetricId(), MetricIdModel.class, context); + this.windowStart = LHUtil.fromProtoTs(p.getWindowStart()); + } + + @Override + public Class getProtoBaseClass() { + return MetricRunId.class; + } + + @Override + public String toString() { + return LHUtil.getCompositeId(this.metricId.toString(), String.valueOf(windowStart.getTime())); + } + + @Override + public void initFromString(String storeKey) { + String[] parts = storeKey.split("/"); + this.metricId = (MetricIdModel) MetricIdModel.fromString(parts[0], MetricIdModel.class); + this.windowStart = new Date(Long.parseLong(parts[1])); + } + + @Override + public GetableClassEnum getType() { + return GetableClassEnum.METRIC_RUN; + } + + @Override + public Optional getPartitionKey() { + return this.metricId.getPartitionKey(); + } +} diff --git a/server/src/main/java/io/littlehorse/common/model/repartitioncommand/RepartitionCommand.java b/server/src/main/java/io/littlehorse/common/model/repartitioncommand/RepartitionCommand.java index 851dab17d..239df6ff2 100644 --- a/server/src/main/java/io/littlehorse/common/model/repartitioncommand/RepartitionCommand.java +++ b/server/src/main/java/io/littlehorse/common/model/repartitioncommand/RepartitionCommand.java @@ -2,6 +2,7 @@ import com.google.protobuf.Message; import io.littlehorse.common.LHSerializable; +import io.littlehorse.common.model.AggregateMetricsModel; import io.littlehorse.common.model.repartitioncommand.repartitionsubcommand.AggregateTaskMetricsModel; import io.littlehorse.common.model.repartitioncommand.repartitionsubcommand.AggregateWfMetricsModel; import io.littlehorse.common.model.repartitioncommand.repartitionsubcommand.CreateRemoteTag; @@ -28,6 +29,7 @@ public class RepartitionCommand extends LHSerializable { private RemoveRemoteTag removeRemoteTag; private AggregateWfMetricsModel aggregateWfMetrics; private AggregateTaskMetricsModel aggregateTaskMetrics; + private AggregateMetricsModel aggregateMetrics; public Class getProtoBaseClass() { return RepartitionCommandPb.class; @@ -54,6 +56,9 @@ public void setSubCommand(RepartitionSubCommand subCommand) { } else if (subCommand.getClass().equals(AggregateTaskMetricsModel.class)) { type = RepartitionCommandCase.AGGREGATE_TASK_METRICS; aggregateTaskMetrics = (AggregateTaskMetricsModel) subCommand; + } else if (subCommand.getClass().equals(AggregateMetricsModel.class)) { + type = RepartitionCommandCase.AGGREGATE_METRICS; + aggregateMetrics = (AggregateMetricsModel) subCommand; } else { throw new RuntimeException("Unknown class!"); } @@ -69,6 +74,8 @@ public RepartitionSubCommand getSubCommand() { return aggregateWfMetrics; case AGGREGATE_TASK_METRICS: return aggregateTaskMetrics; + case AGGREGATE_METRICS: + return aggregateMetrics; default: throw new RuntimeException("Unrecognized!"); } @@ -96,6 +103,9 @@ public RepartitionCommandPb.Builder toProto() { case AGGREGATE_TASK_METRICS: out.setAggregateTaskMetrics(aggregateTaskMetrics.toProto()); break; + case AGGREGATE_METRICS: + out.setAggregateMetrics(aggregateMetrics.toProto()); + break; case REPARTITIONCOMMAND_NOT_SET: throw new RuntimeException("Not possible"); } @@ -125,6 +135,10 @@ public void initFrom(Message proto, ExecutionContext context) { aggregateTaskMetrics = LHSerializable.fromProto(p.getAggregateTaskMetrics(), AggregateTaskMetricsModel.class, context); break; + case AGGREGATE_METRICS: + aggregateMetrics = + LHSerializable.fromProto(p.getAggregateMetrics(), AggregateMetricsModel.class, context); + break; case REPARTITIONCOMMAND_NOT_SET: throw new RuntimeException("Not possible"); } diff --git a/server/src/main/java/io/littlehorse/common/proto/CommandOuterClass.java b/server/src/main/java/io/littlehorse/common/proto/CommandOuterClass.java index 371959298..d60297dd7 100644 --- a/server/src/main/java/io/littlehorse/common/proto/CommandOuterClass.java +++ b/server/src/main/java/io/littlehorse/common/proto/CommandOuterClass.java @@ -173,185 +173,185 @@ public static void registerAllExtensions( "ject_id.proto\032\023common_wfspec.proto\032\020user" + "_tasks.proto\032\022common_enums.proto\032\016variab" + "le.proto\032\rstorage.proto\032\nacls.proto\032\tjob" + - ".proto\032\rmetrics.proto\"\221\r\n\007Command\022(\n\004tim" + - "e\030\001 \001(\0132\032.google.protobuf.Timestamp\022\027\n\nc" + - "ommand_id\030\002 \001(\tH\001\210\001\001\0225\n\017report_task_run\030" + - "\004 \001(\0132\032.littlehorse.ReportTaskRunH\000\0229\n\020t" + - "ask_claim_event\030\005 \001(\0132\035.littlehorse.Task" + - "ClaimEventPbH\000\022+\n\006run_wf\030\006 \001(\0132\031.littleh" + - "orse.RunWfRequestH\000\022B\n\022put_external_even" + - "t\030\007 \001(\0132$.littlehorse.PutExternalEventRe" + - "questH\000\0224\n\013stop_wf_run\030\010 \001(\0132\035.littlehor" + - "se.StopWfRunRequestH\000\0228\n\rresume_wf_run\030\t" + - " \001(\0132\037.littlehorse.ResumeWfRunRequestH\000\022" + - "=\n\022sleep_node_matured\030\n \001(\0132\037.littlehors" + - "e.SleepNodeMaturedPbH\000\0228\n\rdelete_wf_run\030" + - "\013 \001(\0132\037.littlehorse.DeleteWfRunRequestH\000" + - "\022I\n\026external_event_timeout\030\014 \001(\0132\'.littl" + - "ehorse.ExternalEventNodeTimeoutPbH\000\022I\n\026t" + - "ask_worker_heart_beat\030\r \001(\0132\'.littlehors" + - "e.TaskWorkerHeartBeatRequestH\000\022H\n\025delete" + - "_external_event\030\016 \001(\0132\'.littlehorse.Dele" + - "teExternalEventRequestH\000\022E\n\024assign_user_" + - "task_run\030\017 \001(\0132%.littlehorse.AssignUserT" + - "askRunRequestH\000\022I\n\026complete_user_task_ru" + - "n\030\020 \001(\0132\'.littlehorse.CompleteUserTaskRu" + - "nRequestH\000\022=\n\022triggered_task_run\030\021 \001(\0132\037" + - ".littlehorse.TriggeredTaskRunPbH\000\022E\n\024rea" + - "ssigned_user_task\030\022 \001(\0132%.littlehorse.De" + - "adlineReassignUserTaskH\000\022A\n\020cancel_user_" + - "task\030\023 \001(\0132%.littlehorse.CancelUserTaskR" + - "unRequestH\000\022.\n\010bulk_job\030\024 \001(\0132\032.littleho" + - "rse.BulkUpdateJobH\000\022F\n\030task_attempt_retr" + - "y_ready\030\025 \001(\0132\".littlehorse.TaskAttemptR" + - "etryReadyH\000\022@\n\021rescue_thread_run\030\026 \001(\0132#" + - ".littlehorse.RescueThreadRunRequestH\000\022M\n" + - "\030delete_task_worker_group\030\027 \001(\0132).little" + - "horse.DeleteTaskWorkerGroupRequestH\000\0225\n\017" + - "schedule_wf_run\030\030 \001(\0132\032.littlehorse.Sche" + - "duleWfRunH\000\022A\n\027schedule_wf_run_request\030\031" + - " \001(\0132\036.littlehorse.ScheduleWfRequestH\000\022K" + - "\n\027delete_scheduled_wf_run\030\032 \001(\0132(.little" + - "horse.DeleteScheduledWfRunRequestH\000\022R\n\033s" + - "ave_user_task_run_progress\030\033 \001(\0132+.littl" + - "ehorse.SaveUserTaskRunProgressRequestH\000B" + - "\t\n\007commandB\r\n\013_command_id\"\233\003\n\rScheduleWf" + - "Run\0223\n\014scheduled_id\030\001 \001(\0132\035.littlehorse." + - "ScheduledWfRunId\022\024\n\014wf_spec_name\030\002 \001(\t\022\032" + - "\n\rmajor_version\030\003 \001(\005H\000\210\001\001\022\025\n\010revision\030\004" + - " \001(\005H\001\210\001\001\022<\n\tvariables\030\005 \003(\0132).littlehor" + - "se.ScheduleWfRun.VariablesEntry\0223\n\020paren" + - "t_wf_run_id\030\006 \001(\0132\024.littlehorse.WfRunIdH" + - "\002\210\001\001\022\027\n\017cron_expression\030\007 \001(\t\032L\n\016Variabl" + - "esEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.li" + - "ttlehorse.VariableValue:\0028\001B\020\n\016_major_ve" + - "rsionB\013\n\t_revisionB\023\n\021_parent_wf_run_id\"" + - "\201\010\n\017MetadataCommand\022(\n\004time\030\001 \001(\0132\032.goog" + - "le.protobuf.Timestamp\022\027\n\ncommand_id\030\002 \001(" + - "\tH\001\210\001\001\0224\n\013put_wf_spec\030\004 \001(\0132\035.littlehors" + - "e.PutWfSpecRequestH\000\0226\n\014put_task_def\030\005 \001" + - "(\0132\036.littlehorse.PutTaskDefRequestH\000\022I\n\026" + - "put_external_event_def\030\006 \001(\0132\'.littlehor" + - "se.PutExternalEventDefRequestH\000\022:\n\016delet" + - "e_wf_spec\030\007 \001(\0132 .littlehorse.DeleteWfSp" + - "ecRequestH\000\022<\n\017delete_task_def\030\010 \001(\0132!.l" + - "ittlehorse.DeleteTaskDefRequestH\000\022O\n\031del" + - "ete_external_event_def\030\t \001(\0132*.littlehor" + - "se.DeleteExternalEventDefRequestH\000\022?\n\021pu" + - "t_user_task_def\030\n \001(\0132\".littlehorse.PutU" + - "serTaskDefRequestH\000\022E\n\024delete_user_task_" + - "def\030\013 \001(\0132%.littlehorse.DeleteUserTaskDe" + - "fRequestH\000\0229\n\rput_principal\030\014 \001(\0132 .litt" + - "lehorse.PutPrincipalRequestH\000\022?\n\020delete_" + - "principal\030\r \001(\0132#.littlehorse.DeletePrin" + - "cipalRequestH\000\0223\n\nput_tenant\030\016 \001(\0132\035.lit" + - "tlehorse.PutTenantRequestH\000\022E\n\022workflow_" + - "event_def\030\017 \001(\0132\'.littlehorse.PutWorkflo" + - "wEventDefRequestH\000\022O\n\031delete_workflow_ev" + - "ent_def\030\020 \001(\0132*.littlehorse.DeleteWorkfl" + - "owEventDefRequestH\000\0223\n\nput_metric\030\021 \001(\0132" + - "\035.littlehorse.PutMetricRequestH\000B\022\n\020meta" + - "data_commandB\r\n\013_command_id\"\236\001\n\022Aggregat" + - "eWfMetrics\022)\n\nwf_spec_id\030\001 \001(\0132\025.littleh" + - "orse.WfSpecId\022(\n\ttenant_id\030\002 \001(\0132\025.littl" + - "ehorse.TenantId\0223\n\016metric_updates\030\003 \003(\0132" + - "\033.littlehorse.WfMetricUpdate\"\244\001\n\024Aggrega" + - "teTaskMetrics\022+\n\013task_def_id\030\001 \001(\0132\026.lit" + - "tlehorse.TaskDefId\022(\n\ttenant_id\030\002 \001(\0132\025." + - "littlehorse.TenantId\0225\n\016metric_updates\030\003" + - " \003(\0132\035.littlehorse.TaskMetricUpdate\"~\n\020A" + - "ggregateMetrics\022@\n\020windowed_metrics\030\001 \003(" + - "\0132&.littlehorse.RepartitionWindowedMetri" + - "c\022(\n\ttenant_id\030\002 \001(\0132\025.littlehorse.Tenan" + - "tId\"\271\002\n\016WfMetricUpdate\0220\n\014window_start\030\001" + - " \001(\0132\032.google.protobuf.Timestamp\022.\n\004type" + - "\030\002 \001(\0162 .littlehorse.MetricsWindowLength" + - "\022)\n\nwf_spec_id\030\003 \001(\0132\025.littlehorse.WfSpe" + - "cId\022\023\n\013num_entries\030\004 \001(\003\022\035\n\025start_to_com" + - "plete_max\030\005 \001(\003\022\037\n\027start_to_complete_tot" + - "al\030\006 \001(\003\022\027\n\017total_completed\030\007 \001(\003\022\025\n\rtot" + - "al_errored\030\010 \001(\003\022\025\n\rtotal_started\030\t \001(\003\"" + - "K\n\020PartitionMetrics\0227\n\021metrics_by_tenant" + - "\030\001 \003(\0132\034.littlehorse.MetricsByTenant\"\205\003\n" + - "\017MetricsByTenant\022(\n\ttenant_id\030\001 \001(\0132\025.li" + - "ttlehorse.TenantId\022L\n\021lh_status_changes\030" + - "\002 \003(\01321.littlehorse.MetricsByTenant.LhSt" + - "atusChangesEntry\022P\n\023task_status_changes\030" + - "\003 \003(\01323.littlehorse.MetricsByTenant.Task" + - "StatusChangesEntry\032R\n\024LhStatusChangesEnt" + - "ry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.littleh" + - "orse.StatusChanges:\0028\001\032T\n\026TaskStatusChan" + - "gesEntry\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.l" + - "ittlehorse.StatusChanges:\0028\001\"<\n\rStatusCh" + - "anges\022+\n\007changes\030\001 \003(\0132\032.littlehorse.Sta" + - "tusChanged\"\320\001\n\rStatusChanged\022(\n\004time\030\001 \001" + - "(\0132\032.google.protobuf.Timestamp\0221\n\tlh_sta" + - "tus\030\002 \001(\0132\034.littlehorse.LHStatusChangedH" + - "\000\0225\n\013task_status\030\003 \001(\0132\036.littlehorse.Tas" + - "kStatusChangedH\000\022!\n\031first_event_to_last_" + - "delay\030\t \001(\003B\010\n\006status\"\205\001\n\017LHStatusChange" + - "d\0223\n\017previous_status\030\001 \001(\0162\025.littlehorse" + - ".LHStatusH\000\210\001\001\022)\n\nnew_status\030\002 \001(\0162\025.lit" + - "tlehorse.LHStatusB\022\n\020_previous_status\"\213\001" + - "\n\021TaskStatusChanged\0225\n\017previous_status\030\001" + - " \001(\0162\027.littlehorse.TaskStatusH\000\210\001\001\022+\n\nne" + - "w_status\030\002 \001(\0162\027.littlehorse.TaskStatusB" + - "\022\n\020_previous_status\"\273\003\n\024RepartitionComma" + - "ndPb\022(\n\004time\030\001 \001(\0132\032.google.protobuf.Tim" + - "estamp\022\027\n\ncommand_id\030\002 \001(\tH\001\210\001\001\022;\n\021creat" + - "e_remote_tag\030\005 \001(\0132\036.littlehorse.CreateR" + - "emoteTagPbH\000\022;\n\021remove_remote_tag\030\006 \001(\0132" + - "\036.littlehorse.RemoveRemoteTagPbH\000\022?\n\024agg" + - "regate_wf_metrics\030\007 \001(\0132\037.littlehorse.Ag" + - "gregateWfMetricsH\000\022C\n\026aggregate_task_met" + - "rics\030\010 \001(\0132!.littlehorse.AggregateTaskMe" + - "tricsH\000\022:\n\021aggregate_metrics\030\t \001(\0132\035.lit" + - "tlehorse.AggregateMetricsH\000B\025\n\023repartiti" + - "on_commandB\r\n\013_command_id\"\226\003\n\020TaskMetric" + - "Update\022+\n\013task_def_id\030\001 \001(\0132\026.littlehors" + - "e.TaskDefId\0220\n\014window_start\030\002 \001(\0132\032.goog" + - "le.protobuf.Timestamp\022.\n\004type\030\003 \001(\0162 .li" + - "ttlehorse.MetricsWindowLength\022\023\n\013num_ent" + - "ries\030\004 \001(\003\022\035\n\025schedule_to_start_max\030\005 \001(" + - "\003\022\037\n\027schedule_to_start_total\030\006 \001(\003\022\035\n\025st" + - "art_to_complete_max\030\007 \001(\003\022\037\n\027start_to_co" + - "mplete_total\030\010 \001(\003\022\027\n\017total_completed\030\t " + - "\001(\003\022\025\n\rtotal_errored\030\n \001(\003\022\025\n\rtotal_star" + - "ted\030\013 \001(\003\022\027\n\017total_scheduled\030\014 \001(\003\"4\n\021Cr" + - "eateRemoteTagPb\022\037\n\003tag\030\001 \001(\0132\022.littlehor" + - "se.TagPb\"=\n\021RemoveRemoteTagPb\022\021\n\tstore_k" + - "ey\030\001 \001(\t\022\025\n\rpartition_key\030\002 \001(\t\"\273\001\n\020Task" + - "ClaimEventPb\022+\n\013task_run_id\030\001 \001(\0132\026.litt" + - "lehorse.TaskRunId\022(\n\004time\030\002 \001(\0132\032.google" + - ".protobuf.Timestamp\022\026\n\016task_worker_id\030\003 " + - "\001(\t\022 \n\023task_worker_version\030\004 \001(\tH\000\210\001\001B\026\n" + - "\024_task_worker_version\"I\n\032ExternalEventNo" + - "deTimeoutPb\022+\n\013node_run_id\030\001 \001(\0132\026.littl" + - "ehorse.NodeRunId\"A\n\022SleepNodeMaturedPb\022+" + - "\n\013node_run_id\030\001 \001(\0132\026.littlehorse.NodeRu" + - "nId\"m\n\022TriggeredTaskRunPb\022/\n\020task_to_sch" + - "edule\030\001 \001(\0132\025.littlehorse.TaskNode\022&\n\006so" + - "urce\030\002 \001(\0132\026.littlehorse.NodeRunId\";\n\025Ta" + - "skAttemptRetryReady\022\"\n\002id\030\001 \001(\0132\026.little" + - "horse.TaskRunId\"\364\001\n\030DeadlineReassignUser" + - "Task\0229\n\013new_user_id\030\001 \001(\0132\037.littlehorse." + - "VariableAssignmentH\000\210\001\001\022<\n\016new_user_grou" + - "p\030\002 \001(\0132\037.littlehorse.VariableAssignment" + - "H\001\210\001\001\022-\n\tuser_task\030\004 \001(\0132\032.littlehorse.U" + - "serTaskRunId\022\r\n\005epoch\030\005 \001(\003B\016\n\014_new_user" + - "_idB\021\n\017_new_user_group\"\360\001\n\tLHTimerPb\0223\n\017" + - "maturation_time\030\001 \001(\0132\032.google.protobuf." + - "Timestamp\022\013\n\003key\030\002 \001(\t\022\r\n\005topic\030\003 \001(\t\022\017\n" + - "\007payload\030\004 \001(\014\022-\n\ttenant_id\030\005 \001(\0132\025.litt" + - "lehorse.TenantIdH\000\210\001\001\0223\n\014principal_id\030\006 " + - "\001(\0132\030.littlehorse.PrincipalIdH\001\210\001\001B\014\n\n_t" + - "enant_idB\017\n\r_principal_id\"B\n\034DeleteTaskW" + - "orkerGroupRequest\022\"\n\002id\030\001 \001(\0132\026.littleho" + - "rse.TaskDefId\"\206\001\n\031RepartitionWindowedMet" + - "ric\022(\n\tmetric_id\030\001 \001(\0132\025.littlehorse.Met" + - "ricId\022\r\n\005value\030\002 \001(\001\0220\n\014window_start\030\003 \001" + - "(\0132\032.google.protobuf.TimestampB\037\n\033io.lit" + - "tlehorse.common.protoP\001b\006proto3" + ".proto\"\221\r\n\007Command\022(\n\004time\030\001 \001(\0132\032.googl" + + "e.protobuf.Timestamp\022\027\n\ncommand_id\030\002 \001(\t" + + "H\001\210\001\001\0225\n\017report_task_run\030\004 \001(\0132\032.littleh" + + "orse.ReportTaskRunH\000\0229\n\020task_claim_event" + + "\030\005 \001(\0132\035.littlehorse.TaskClaimEventPbH\000\022" + + "+\n\006run_wf\030\006 \001(\0132\031.littlehorse.RunWfReque" + + "stH\000\022B\n\022put_external_event\030\007 \001(\0132$.littl" + + "ehorse.PutExternalEventRequestH\000\0224\n\013stop" + + "_wf_run\030\010 \001(\0132\035.littlehorse.StopWfRunReq" + + "uestH\000\0228\n\rresume_wf_run\030\t \001(\0132\037.littleho" + + "rse.ResumeWfRunRequestH\000\022=\n\022sleep_node_m" + + "atured\030\n \001(\0132\037.littlehorse.SleepNodeMatu" + + "redPbH\000\0228\n\rdelete_wf_run\030\013 \001(\0132\037.littleh" + + "orse.DeleteWfRunRequestH\000\022I\n\026external_ev" + + "ent_timeout\030\014 \001(\0132\'.littlehorse.External" + + "EventNodeTimeoutPbH\000\022I\n\026task_worker_hear" + + "t_beat\030\r \001(\0132\'.littlehorse.TaskWorkerHea" + + "rtBeatRequestH\000\022H\n\025delete_external_event" + + "\030\016 \001(\0132\'.littlehorse.DeleteExternalEvent" + + "RequestH\000\022E\n\024assign_user_task_run\030\017 \001(\0132" + + "%.littlehorse.AssignUserTaskRunRequestH\000" + + "\022I\n\026complete_user_task_run\030\020 \001(\0132\'.littl" + + "ehorse.CompleteUserTaskRunRequestH\000\022=\n\022t" + + "riggered_task_run\030\021 \001(\0132\037.littlehorse.Tr" + + "iggeredTaskRunPbH\000\022E\n\024reassigned_user_ta" + + "sk\030\022 \001(\0132%.littlehorse.DeadlineReassignU" + + "serTaskH\000\022A\n\020cancel_user_task\030\023 \001(\0132%.li" + + "ttlehorse.CancelUserTaskRunRequestH\000\022.\n\010" + + "bulk_job\030\024 \001(\0132\032.littlehorse.BulkUpdateJ" + + "obH\000\022F\n\030task_attempt_retry_ready\030\025 \001(\0132\"" + + ".littlehorse.TaskAttemptRetryReadyH\000\022@\n\021" + + "rescue_thread_run\030\026 \001(\0132#.littlehorse.Re" + + "scueThreadRunRequestH\000\022M\n\030delete_task_wo" + + "rker_group\030\027 \001(\0132).littlehorse.DeleteTas" + + "kWorkerGroupRequestH\000\0225\n\017schedule_wf_run" + + "\030\030 \001(\0132\032.littlehorse.ScheduleWfRunH\000\022A\n\027" + + "schedule_wf_run_request\030\031 \001(\0132\036.littleho" + + "rse.ScheduleWfRequestH\000\022K\n\027delete_schedu" + + "led_wf_run\030\032 \001(\0132(.littlehorse.DeleteSch" + + "eduledWfRunRequestH\000\022R\n\033save_user_task_r" + + "un_progress\030\033 \001(\0132+.littlehorse.SaveUser" + + "TaskRunProgressRequestH\000B\t\n\007commandB\r\n\013_" + + "command_id\"\233\003\n\rScheduleWfRun\0223\n\014schedule" + + "d_id\030\001 \001(\0132\035.littlehorse.ScheduledWfRunI" + + "d\022\024\n\014wf_spec_name\030\002 \001(\t\022\032\n\rmajor_version" + + "\030\003 \001(\005H\000\210\001\001\022\025\n\010revision\030\004 \001(\005H\001\210\001\001\022<\n\tva" + + "riables\030\005 \003(\0132).littlehorse.ScheduleWfRu" + + "n.VariablesEntry\0223\n\020parent_wf_run_id\030\006 \001" + + "(\0132\024.littlehorse.WfRunIdH\002\210\001\001\022\027\n\017cron_ex" + + "pression\030\007 \001(\t\032L\n\016VariablesEntry\022\013\n\003key\030" + + "\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.littlehorse.Varia" + + "bleValue:\0028\001B\020\n\016_major_versionB\013\n\t_revis" + + "ionB\023\n\021_parent_wf_run_id\"\201\010\n\017MetadataCom" + + "mand\022(\n\004time\030\001 \001(\0132\032.google.protobuf.Tim" + + "estamp\022\027\n\ncommand_id\030\002 \001(\tH\001\210\001\001\0224\n\013put_w" + + "f_spec\030\004 \001(\0132\035.littlehorse.PutWfSpecRequ" + + "estH\000\0226\n\014put_task_def\030\005 \001(\0132\036.littlehors" + + "e.PutTaskDefRequestH\000\022I\n\026put_external_ev" + + "ent_def\030\006 \001(\0132\'.littlehorse.PutExternalE" + + "ventDefRequestH\000\022:\n\016delete_wf_spec\030\007 \001(\013" + + "2 .littlehorse.DeleteWfSpecRequestH\000\022<\n\017" + + "delete_task_def\030\010 \001(\0132!.littlehorse.Dele" + + "teTaskDefRequestH\000\022O\n\031delete_external_ev" + + "ent_def\030\t \001(\0132*.littlehorse.DeleteExtern" + + "alEventDefRequestH\000\022?\n\021put_user_task_def" + + "\030\n \001(\0132\".littlehorse.PutUserTaskDefReque" + + "stH\000\022E\n\024delete_user_task_def\030\013 \001(\0132%.lit" + + "tlehorse.DeleteUserTaskDefRequestH\000\0229\n\rp" + + "ut_principal\030\014 \001(\0132 .littlehorse.PutPrin" + + "cipalRequestH\000\022?\n\020delete_principal\030\r \001(\013" + + "2#.littlehorse.DeletePrincipalRequestH\000\022" + + "3\n\nput_tenant\030\016 \001(\0132\035.littlehorse.PutTen" + + "antRequestH\000\022E\n\022workflow_event_def\030\017 \001(\013" + + "2\'.littlehorse.PutWorkflowEventDefReques" + + "tH\000\022O\n\031delete_workflow_event_def\030\020 \001(\0132*" + + ".littlehorse.DeleteWorkflowEventDefReque" + + "stH\000\0223\n\nput_metric\030\021 \001(\0132\035.littlehorse.P" + + "utMetricRequestH\000B\022\n\020metadata_commandB\r\n" + + "\013_command_id\"\236\001\n\022AggregateWfMetrics\022)\n\nw" + + "f_spec_id\030\001 \001(\0132\025.littlehorse.WfSpecId\022(" + + "\n\ttenant_id\030\002 \001(\0132\025.littlehorse.TenantId" + + "\0223\n\016metric_updates\030\003 \003(\0132\033.littlehorse.W" + + "fMetricUpdate\"\244\001\n\024AggregateTaskMetrics\022+" + + "\n\013task_def_id\030\001 \001(\0132\026.littlehorse.TaskDe" + + "fId\022(\n\ttenant_id\030\002 \001(\0132\025.littlehorse.Ten" + + "antId\0225\n\016metric_updates\030\003 \003(\0132\035.littleho" + + "rse.TaskMetricUpdate\"~\n\020AggregateMetrics" + + "\022@\n\020windowed_metrics\030\001 \003(\0132&.littlehorse" + + ".RepartitionWindowedMetric\022(\n\ttenant_id\030" + + "\002 \001(\0132\025.littlehorse.TenantId\"\271\002\n\016WfMetri" + + "cUpdate\0220\n\014window_start\030\001 \001(\0132\032.google.p" + + "rotobuf.Timestamp\022.\n\004type\030\002 \001(\0162 .little" + + "horse.MetricsWindowLength\022)\n\nwf_spec_id\030" + + "\003 \001(\0132\025.littlehorse.WfSpecId\022\023\n\013num_entr" + + "ies\030\004 \001(\003\022\035\n\025start_to_complete_max\030\005 \001(\003" + + "\022\037\n\027start_to_complete_total\030\006 \001(\003\022\027\n\017tot" + + "al_completed\030\007 \001(\003\022\025\n\rtotal_errored\030\010 \001(" + + "\003\022\025\n\rtotal_started\030\t \001(\003\"K\n\020PartitionMet" + + "rics\0227\n\021metrics_by_tenant\030\001 \003(\0132\034.little" + + "horse.MetricsByTenant\"\205\003\n\017MetricsByTenan" + + "t\022(\n\ttenant_id\030\001 \001(\0132\025.littlehorse.Tenan" + + "tId\022L\n\021lh_status_changes\030\002 \003(\01321.littleh" + + "orse.MetricsByTenant.LhStatusChangesEntr" + + "y\022P\n\023task_status_changes\030\003 \003(\01323.littleh" + + "orse.MetricsByTenant.TaskStatusChangesEn" + + "try\032R\n\024LhStatusChangesEntry\022\013\n\003key\030\001 \001(\t" + + "\022)\n\005value\030\002 \001(\0132\032.littlehorse.StatusChan" + + "ges:\0028\001\032T\n\026TaskStatusChangesEntry\022\013\n\003key" + + "\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.littlehorse.Stat" + + "usChanges:\0028\001\"<\n\rStatusChanges\022+\n\007change" + + "s\030\001 \003(\0132\032.littlehorse.StatusChanged\"\320\001\n\r" + + "StatusChanged\022(\n\004time\030\001 \001(\0132\032.google.pro" + + "tobuf.Timestamp\0221\n\tlh_status\030\002 \001(\0132\034.lit" + + "tlehorse.LHStatusChangedH\000\0225\n\013task_statu" + + "s\030\003 \001(\0132\036.littlehorse.TaskStatusChangedH" + + "\000\022!\n\031first_event_to_last_delay\030\t \001(\003B\010\n\006" + + "status\"\205\001\n\017LHStatusChanged\0223\n\017previous_s" + + "tatus\030\001 \001(\0162\025.littlehorse.LHStatusH\000\210\001\001\022" + + ")\n\nnew_status\030\002 \001(\0162\025.littlehorse.LHStat" + + "usB\022\n\020_previous_status\"\213\001\n\021TaskStatusCha" + + "nged\0225\n\017previous_status\030\001 \001(\0162\027.littleho" + + "rse.TaskStatusH\000\210\001\001\022+\n\nnew_status\030\002 \001(\0162" + + "\027.littlehorse.TaskStatusB\022\n\020_previous_st" + + "atus\"\273\003\n\024RepartitionCommandPb\022(\n\004time\030\001 " + + "\001(\0132\032.google.protobuf.Timestamp\022\027\n\ncomma" + + "nd_id\030\002 \001(\tH\001\210\001\001\022;\n\021create_remote_tag\030\005 " + + "\001(\0132\036.littlehorse.CreateRemoteTagPbH\000\022;\n" + + "\021remove_remote_tag\030\006 \001(\0132\036.littlehorse.R" + + "emoveRemoteTagPbH\000\022?\n\024aggregate_wf_metri" + + "cs\030\007 \001(\0132\037.littlehorse.AggregateWfMetric" + + "sH\000\022C\n\026aggregate_task_metrics\030\010 \001(\0132!.li" + + "ttlehorse.AggregateTaskMetricsH\000\022:\n\021aggr" + + "egate_metrics\030\t \001(\0132\035.littlehorse.Aggreg" + + "ateMetricsH\000B\025\n\023repartition_commandB\r\n\013_" + + "command_id\"\226\003\n\020TaskMetricUpdate\022+\n\013task_" + + "def_id\030\001 \001(\0132\026.littlehorse.TaskDefId\0220\n\014" + + "window_start\030\002 \001(\0132\032.google.protobuf.Tim" + + "estamp\022.\n\004type\030\003 \001(\0162 .littlehorse.Metri" + + "csWindowLength\022\023\n\013num_entries\030\004 \001(\003\022\035\n\025s" + + "chedule_to_start_max\030\005 \001(\003\022\037\n\027schedule_t" + + "o_start_total\030\006 \001(\003\022\035\n\025start_to_complete" + + "_max\030\007 \001(\003\022\037\n\027start_to_complete_total\030\010 " + + "\001(\003\022\027\n\017total_completed\030\t \001(\003\022\025\n\rtotal_er" + + "rored\030\n \001(\003\022\025\n\rtotal_started\030\013 \001(\003\022\027\n\017to" + + "tal_scheduled\030\014 \001(\003\"4\n\021CreateRemoteTagPb" + + "\022\037\n\003tag\030\001 \001(\0132\022.littlehorse.TagPb\"=\n\021Rem" + + "oveRemoteTagPb\022\021\n\tstore_key\030\001 \001(\t\022\025\n\rpar" + + "tition_key\030\002 \001(\t\"\273\001\n\020TaskClaimEventPb\022+\n" + + "\013task_run_id\030\001 \001(\0132\026.littlehorse.TaskRun" + + "Id\022(\n\004time\030\002 \001(\0132\032.google.protobuf.Times" + + "tamp\022\026\n\016task_worker_id\030\003 \001(\t\022 \n\023task_wor" + + "ker_version\030\004 \001(\tH\000\210\001\001B\026\n\024_task_worker_v" + + "ersion\"I\n\032ExternalEventNodeTimeoutPb\022+\n\013" + + "node_run_id\030\001 \001(\0132\026.littlehorse.NodeRunI" + + "d\"A\n\022SleepNodeMaturedPb\022+\n\013node_run_id\030\001" + + " \001(\0132\026.littlehorse.NodeRunId\"m\n\022Triggere" + + "dTaskRunPb\022/\n\020task_to_schedule\030\001 \001(\0132\025.l" + + "ittlehorse.TaskNode\022&\n\006source\030\002 \001(\0132\026.li" + + "ttlehorse.NodeRunId\";\n\025TaskAttemptRetryR" + + "eady\022\"\n\002id\030\001 \001(\0132\026.littlehorse.TaskRunId" + + "\"\364\001\n\030DeadlineReassignUserTask\0229\n\013new_use" + + "r_id\030\001 \001(\0132\037.littlehorse.VariableAssignm" + + "entH\000\210\001\001\022<\n\016new_user_group\030\002 \001(\0132\037.littl" + + "ehorse.VariableAssignmentH\001\210\001\001\022-\n\tuser_t" + + "ask\030\004 \001(\0132\032.littlehorse.UserTaskRunId\022\r\n" + + "\005epoch\030\005 \001(\003B\016\n\014_new_user_idB\021\n\017_new_use" + + "r_group\"\360\001\n\tLHTimerPb\0223\n\017maturation_time" + + "\030\001 \001(\0132\032.google.protobuf.Timestamp\022\013\n\003ke" + + "y\030\002 \001(\t\022\r\n\005topic\030\003 \001(\t\022\017\n\007payload\030\004 \001(\014\022" + + "-\n\ttenant_id\030\005 \001(\0132\025.littlehorse.TenantI" + + "dH\000\210\001\001\0223\n\014principal_id\030\006 \001(\0132\030.littlehor" + + "se.PrincipalIdH\001\210\001\001B\014\n\n_tenant_idB\017\n\r_pr" + + "incipal_id\"B\n\034DeleteTaskWorkerGroupReque" + + "st\022\"\n\002id\030\001 \001(\0132\026.littlehorse.TaskDefId\"\206" + + "\001\n\031RepartitionWindowedMetric\022(\n\tmetric_i" + + "d\030\001 \001(\0132\025.littlehorse.MetricId\022\r\n\005value\030" + + "\002 \001(\001\0220\n\014window_start\030\003 \001(\0132\032.google.pro" + + "tobuf.TimestampB\037\n\033io.littlehorse.common" + + ".protoP\001b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -366,7 +366,6 @@ public static void registerAllExtensions( io.littlehorse.common.proto.Storage.getDescriptor(), io.littlehorse.sdk.common.proto.Acls.getDescriptor(), io.littlehorse.common.proto.Job.getDescriptor(), - io.littlehorse.sdk.common.proto.Metrics.getDescriptor(), }); internal_static_littlehorse_Command_descriptor = getDescriptor().getMessageTypes().get(0); @@ -552,7 +551,6 @@ public static void registerAllExtensions( io.littlehorse.common.proto.Storage.getDescriptor(); io.littlehorse.sdk.common.proto.Acls.getDescriptor(); io.littlehorse.common.proto.Job.getDescriptor(); - io.littlehorse.sdk.common.proto.Metrics.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/server/src/main/java/io/littlehorse/common/proto/GetableClassEnum.java b/server/src/main/java/io/littlehorse/common/proto/GetableClassEnum.java index 4f5882568..14706ea27 100644 --- a/server/src/main/java/io/littlehorse/common/proto/GetableClassEnum.java +++ b/server/src/main/java/io/littlehorse/common/proto/GetableClassEnum.java @@ -88,6 +88,10 @@ public enum GetableClassEnum * PARTITION_METRIC = 19; */ PARTITION_METRIC(19), + /** + * METRIC_RUN = 20; + */ + METRIC_RUN(20), UNRECOGNIZED(-1), ; @@ -171,6 +175,10 @@ public enum GetableClassEnum * PARTITION_METRIC = 19; */ public static final int PARTITION_METRIC_VALUE = 19; + /** + * METRIC_RUN = 20; + */ + public static final int METRIC_RUN_VALUE = 20; public final int getNumber() { @@ -217,6 +225,7 @@ public static GetableClassEnum forNumber(int value) { case 17: return SCHEDULED_WF_RUN; case 18: return METRIC; case 19: return PARTITION_METRIC; + case 20: return METRIC_RUN; default: return null; } } diff --git a/server/src/main/java/io/littlehorse/common/proto/Storage.java b/server/src/main/java/io/littlehorse/common/proto/Storage.java index 384287683..482a64fcf 100644 --- a/server/src/main/java/io/littlehorse/common/proto/Storage.java +++ b/server/src/main/java/io/littlehorse/common/proto/Storage.java @@ -86,7 +86,7 @@ public static void registerAllExtensions( "LH_TIMER\020\004\022\007\n\003TAG\020\005\022\025\n\021PARTITION_METRICS" + "\020\006\022\021\n\rMETRIC_WINDOW\020\007\022\026\n\022INITIALIZATION_" + "LOG\020\010\022\032\n\026WFRUN_STORED_INVENTORY\020\t\022\036\n\032MET" + - "RIC_PARTITION_INVENTORY\020\n*\366\002\n\020GetableCla" + + "RIC_PARTITION_INVENTORY\020\n*\206\003\n\020GetableCla" + "ssEnum\022\014\n\010TASK_DEF\020\000\022\026\n\022EXTERNAL_EVENT_D" + "EF\020\001\022\013\n\007WF_SPEC\020\002\022\n\n\006WF_RUN\020\003\022\014\n\010NODE_RU" + "N\020\004\022\014\n\010VARIABLE\020\005\022\022\n\016EXTERNAL_EVENT\020\006\022\024\n" + @@ -96,8 +96,9 @@ public static void registerAllExtensions( "RINCIPAL\020\r\022\n\n\006TENANT\020\016\022\026\n\022WORKFLOW_EVENT" + "_DEF\020\017\022\022\n\016WORKFLOW_EVENT\020\020\022\024\n\020SCHEDULED_" + "WF_RUN\020\021\022\n\n\006METRIC\020\022\022\024\n\020PARTITION_METRIC" + - "\020\023*\033\n\016TagStorageType\022\t\n\005LOCAL\020\000B\037\n\033io.li" + - "ttlehorse.common.protoP\001b\006proto3" + "\020\023\022\016\n\nMETRIC_RUN\020\024*\033\n\016TagStorageType\022\t\n\005" + + "LOCAL\020\000B\037\n\033io.littlehorse.common.protoP\001" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/server/src/main/java/io/littlehorse/server/streams/ServerTopology.java b/server/src/main/java/io/littlehorse/server/streams/ServerTopology.java index f15af7336..554680fc6 100644 --- a/server/src/main/java/io/littlehorse/server/streams/ServerTopology.java +++ b/server/src/main/java/io/littlehorse/server/streams/ServerTopology.java @@ -2,8 +2,10 @@ import io.littlehorse.common.LHServerConfig; import io.littlehorse.common.model.LHTimer; +import io.littlehorse.common.model.repartitioncommand.RepartitionCommand; import io.littlehorse.common.proto.Command; import io.littlehorse.common.proto.MetadataCommand; +import io.littlehorse.common.util.serde.LHDeserializer; import io.littlehorse.common.util.serde.LHSerde; import io.littlehorse.common.util.serde.ProtobufDeserializer; import io.littlehorse.server.LHServer; @@ -12,6 +14,7 @@ import io.littlehorse.server.streams.topology.core.processors.CommandProcessor; import io.littlehorse.server.streams.topology.core.processors.MetadataGlobalStoreProcessor; import io.littlehorse.server.streams.topology.core.processors.MetadataProcessor; +import io.littlehorse.server.streams.topology.core.processors.RepartitionCommandProcessor; import io.littlehorse.server.streams.topology.timer.TimerProcessor; import io.littlehorse.server.streams.util.MetadataCache; import org.apache.kafka.common.serialization.Serde; @@ -150,6 +153,19 @@ public static Topology initCoreTopology( Stores.persistentKeyValueStore(GLOBAL_METADATA_STORE), Serdes.String(), Serdes.Bytes()) .withLoggingDisabled(); + topo.addSource( + CORE_REPARTITION_SOURCE, + Serdes.String().deserializer(), + new LHDeserializer<>(RepartitionCommand.class), + config.getRepartitionTopicName()); + topo.addProcessor( + CORE_REPARTITION_PROCESSOR, + () -> new RepartitionCommandProcessor(config, metadataCache), + CORE_REPARTITION_SOURCE); + StoreBuilder> repartitionedStoreBuilder = Stores.keyValueStoreBuilder( + Stores.persistentKeyValueStore(CORE_REPARTITION_STORE), Serdes.String(), Serdes.Bytes()); + topo.addStateStore(repartitionedStoreBuilder, CORE_REPARTITION_PROCESSOR); + String metadataStoreChangelog = LHServerConfig.getMetadataStoreChangelogTopic(config.getLHClusterId()); topo.addGlobalStore( globalStoreBuilder, diff --git a/server/src/main/java/io/littlehorse/server/streams/topology/core/processors/CommandProcessor.java b/server/src/main/java/io/littlehorse/server/streams/topology/core/processors/CommandProcessor.java index 72585106b..16a0056d2 100644 --- a/server/src/main/java/io/littlehorse/server/streams/topology/core/processors/CommandProcessor.java +++ b/server/src/main/java/io/littlehorse/server/streams/topology/core/processors/CommandProcessor.java @@ -39,10 +39,12 @@ import java.time.Duration; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.common.KafkaException; import org.apache.kafka.common.header.Headers; @@ -191,6 +193,21 @@ private void forwardMetricsUpdates(long timestamp) { current.addWindowedMetric(windowedMetrics); commandsPerTenant.putIfAbsent(partitionMetricId.getTenantId(), current); } + forwardRepartitionCommands(commandsPerTenant.values()); + } + } + + private void forwardRepartitionCommands(Collection repartitionSubCommands) { + String topicName = config.getRepartitionTopicName(); + for (RepartitionSubCommand repartitionSubCommand : repartitionSubCommands) { + String partitionKey = repartitionSubCommand.getPartitionKey(); + RepartitionCommand command = new RepartitionCommand( + repartitionSubCommand, new Date(), UUID.randomUUID().toString()); + CommandProcessorOutput output = new CommandProcessorOutput(topicName, command, partitionKey); + Record kafkaRecord = + new Record<>(partitionKey, output, System.currentTimeMillis()); + log.info("Forwarding repartition command: {}", partitionKey); + ctx.forward(kafkaRecord); } }