diff --git a/pkg/loop/internal/pb/pipeline_runner.pb.go b/pkg/loop/internal/pb/pipeline_runner.pb.go index f1cd1bcd38..cd900a0a26 100644 --- a/pkg/loop/internal/pb/pipeline_runner.pb.go +++ b/pkg/loop/internal/pb/pipeline_runner.pb.go @@ -137,12 +137,13 @@ type TaskResult struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Value *structpb.Value `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` - HasError bool `protobuf:"varint,5,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` - Index int32 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Value *structpb.Value `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + HasError bool `protobuf:"varint,5,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + IsTerminal bool `protobuf:"varint,6,opt,name=is_terminal,json=isTerminal,proto3" json:"is_terminal,omitempty"` + Index int32 `protobuf:"varint,7,opt,name=index,proto3" json:"index,omitempty"` } func (x *TaskResult) Reset() { @@ -212,6 +213,13 @@ func (x *TaskResult) GetHasError() bool { return false } +func (x *TaskResult) GetIsTerminal() bool { + if x != nil { + return x.IsTerminal + } + return false +} + func (x *TaskResult) GetIndex() int32 { if x != nil { return x.Index @@ -287,7 +295,7 @@ var file_pipeline_runner_proto_rawDesc = []byte{ 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x76, 0x61, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, @@ -296,22 +304,24 @@ var file_pipeline_runner_proto_rawDesc = []byte{ 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x68, 0x61, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, - 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, - 0x39, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, - 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0x4a, 0x0a, 0x15, 0x50, 0x69, - 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x75, - 0x6e, 0x12, 0x10, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, - 0x63, 0x74, 0x6b, 0x69, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x08, 0x68, 0x61, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, + 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x69, 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x22, 0x39, 0x0a, 0x0b, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2a, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0x4a, 0x0a, 0x15, 0x50, + 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x0a, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, + 0x75, 0x6e, 0x12, 0x10, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x52, 0x75, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x6b, 0x69, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, + 0x2d, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/loop/internal/pb/pipeline_runner.proto b/pkg/loop/internal/pb/pipeline_runner.proto index 4ea245f478..2835e5e6e5 100644 --- a/pkg/loop/internal/pb/pipeline_runner.proto +++ b/pkg/loop/internal/pb/pipeline_runner.proto @@ -23,7 +23,8 @@ message TaskResult { google.protobuf.Value value = 3; string error = 4; bool has_error = 5; - int32 index = 6; + bool is_terminal = 6; + int32 index = 7; } message RunResponse { diff --git a/pkg/loop/internal/pb/reporting_plugin_service.pb.go b/pkg/loop/internal/pb/reporting_plugin_service.pb.go index 2b461f1243..647453dae4 100644 --- a/pkg/loop/internal/pb/reporting_plugin_service.pb.go +++ b/pkg/loop/internal/pb/reporting_plugin_service.pb.go @@ -25,10 +25,11 @@ type ReportingPluginServiceConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProviderType string `protobuf:"bytes,1,opt,name=providerType,proto3" json:"providerType,omitempty"` - Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` - PluginName string `protobuf:"bytes,3,opt,name=pluginName,proto3" json:"pluginName,omitempty"` - PluginConfig string `protobuf:"bytes,4,opt,name=pluginConfig,proto3" json:"pluginConfig,omitempty"` + ProviderType string `protobuf:"bytes,1,opt,name=providerType,proto3" json:"providerType,omitempty"` + Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` + PluginName string `protobuf:"bytes,3,opt,name=pluginName,proto3" json:"pluginName,omitempty"` + PluginConfig string `protobuf:"bytes,4,opt,name=pluginConfig,proto3" json:"pluginConfig,omitempty"` + TelemetryType string `protobuf:"bytes,5,opt,name=telemetryType,proto3" json:"telemetryType,omitempty"` } func (x *ReportingPluginServiceConfig) Reset() { @@ -91,6 +92,13 @@ func (x *ReportingPluginServiceConfig) GetPluginConfig() string { return "" } +func (x *ReportingPluginServiceConfig) GetTelemetryType() string { + if x != nil { + return x.TelemetryType + } + return "" +} + // NewReportingPluginFactoryRequest has arguments for [github.com/smartcontractkit/chainlink-relay/pkg/loop/reporting_plugins/LOOPPService.NewReportingPluginFactory]. type NewReportingPluginFactoryRequest struct { state protoimpl.MessageState @@ -224,7 +232,7 @@ var File_reporting_plugin_service_proto protoreflect.FileDescriptor var file_reporting_plugin_service_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x04, 0x6c, 0x6f, 0x6f, 0x70, 0x22, 0xa0, 0x01, 0x0a, 0x1c, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x12, 0x04, 0x6c, 0x6f, 0x6f, 0x70, 0x22, 0xc6, 0x01, 0x0a, 0x1c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, @@ -234,41 +242,43 @@ var file_reporting_plugin_service_proto_rawDesc = []byte{ 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x98, 0x02, 0x0a, 0x20, 0x4e, 0x65, - 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, - 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, - 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4c, 0x6f, 0x67, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4c, 0x6f, 0x67, 0x49, 0x44, 0x12, 0x2a, - 0x0a, 0x10, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, - 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, - 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0b, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x49, 0x44, 0x12, 0x66, 0x0a, 0x1c, + 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x65, 0x6c, + 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, + 0x98, 0x02, 0x0a, 0x20, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4c, 0x6f, 0x67, + 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4c, + 0x6f, 0x67, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x10, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, + 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x49, 0x44, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x49, 0x44, 0x12, 0x66, 0x0a, 0x1c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x1c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, - 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x22, 0x30, 0x0a, 0x1e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, - 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x02, 0x49, 0x44, 0x32, 0x85, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x6b, 0x0a, 0x19, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, - 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x26, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, - 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x1c, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x30, 0x0a, 0x1e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x42, - 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, 0x61, - 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, 0x74, 0x2f, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2f, 0x70, 0x6b, - 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x49, 0x44, 0x32, 0x85, 0x01, 0x0a, + 0x16, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6b, 0x0a, 0x19, 0x4e, 0x65, 0x77, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x12, 0x26, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x6b, 0x69, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/loop/internal/pb/reporting_plugin_service.proto b/pkg/loop/internal/pb/reporting_plugin_service.proto index 124d4b7f4d..6dd618a444 100644 --- a/pkg/loop/internal/pb/reporting_plugin_service.proto +++ b/pkg/loop/internal/pb/reporting_plugin_service.proto @@ -13,6 +13,7 @@ message ReportingPluginServiceConfig { string command = 2; string pluginName = 3; string pluginConfig = 4; + string telemetryType = 5; } // NewReportingPluginFactoryRequest has arguments for [github.com/smartcontractkit/chainlink-relay/pkg/loop/reporting_plugins/LOOPPService.NewReportingPluginFactory]. diff --git a/pkg/loop/internal/pipeline_runner.go b/pkg/loop/internal/pipeline_runner.go index 257ad3a862..ba3e08990d 100644 --- a/pkg/loop/internal/pipeline_runner.go +++ b/pkg/loop/internal/pipeline_runner.go @@ -23,7 +23,7 @@ func newPipelineRunnerClient(cc grpc.ClientConnInterface) *pipelineRunnerService return &pipelineRunnerServiceClient{grpc: pb.NewPipelineRunnerServiceClient(cc)} } -func (p pipelineRunnerServiceClient) ExecuteRun(ctx context.Context, spec string, vars types.Vars, options types.Options) ([]types.TaskResult, error) { +func (p pipelineRunnerServiceClient) ExecuteRun(ctx context.Context, spec string, vars types.Vars, options types.Options) (types.TaskResults, error) { varsStruct, err := structpb.NewStruct(vars.Vars) if err != nil { return nil, err @@ -49,10 +49,13 @@ func (p pipelineRunnerServiceClient) ExecuteRun(ctx context.Context, spec string err = errors.New(trr.Error) } trs[i] = types.TaskResult{ - ID: trr.Id, - Type: trr.Type, - Value: trr.Value.AsInterface(), - Error: err, + ID: trr.Id, + Type: trr.Type, + TaskValue: types.TaskValue{ + Value: trr.Value.AsInterface(), + Error: err, + IsTerminal: trr.IsTerminal, + }, Index: int(trr.Index), } } @@ -94,12 +97,13 @@ func (p *pipelineRunnerServiceServer) ExecuteRun(ctx context.Context, rr *pb.Run errs = trr.Error.Error() } taskResults[i] = &pb.TaskResult{ - Id: trr.ID, - Type: trr.Type, - Value: v, - Error: errs, - HasError: hasError, - Index: int32(trr.Index), + Id: trr.ID, + Type: trr.Type, + Value: v, + Error: errs, + HasError: hasError, + IsTerminal: trr.IsTerminal, + Index: int32(trr.Index), } } diff --git a/pkg/loop/internal/pipeline_runner_test.go b/pkg/loop/internal/pipeline_runner_test.go index 8dba342020..639bd4d044 100644 --- a/pkg/loop/internal/pipeline_runner_test.go +++ b/pkg/loop/internal/pipeline_runner_test.go @@ -23,7 +23,7 @@ type mockPipelineRunner struct { options types.Options } -func (m *mockPipelineRunner) ExecuteRun(ctx context.Context, spec string, vars types.Vars, options types.Options) ([]types.TaskResult, error) { +func (m *mockPipelineRunner) ExecuteRun(ctx context.Context, spec string, vars types.Vars, options types.Options) (types.TaskResults, error) { m.spec, m.vars, m.options = spec, vars, options return m.taskResults, m.err } @@ -39,13 +39,17 @@ func (c *clientAdapter) ExecuteRun(ctx context.Context, in *pb.RunRequest, opts func TestPipelineRunnerService(t *testing.T) { originalResults := []types.TaskResult{ { - ID: "1", - Value: float64(123), + ID: "1", + TaskValue: types.TaskValue{ + Value: float64(123), + }, Index: 0, }, { - ID: "2", - Error: errors.New("Error task"), + ID: "2", + TaskValue: types.TaskValue{ + Error: errors.New("Error task"), + }, Index: 1, }, } diff --git a/pkg/loop/internal/reporting_plugin_service.go b/pkg/loop/internal/reporting_plugin_service.go index 63d3bfceab..8393667b78 100644 --- a/pkg/loop/internal/reporting_plugin_service.go +++ b/pkg/loop/internal/reporting_plugin_service.go @@ -67,10 +67,11 @@ func (m *ReportingPluginServiceClient) NewReportingPluginFactory( reply, err := m.reportingPluginService.NewReportingPluginFactory(ctx, &pb.NewReportingPluginFactoryRequest{ ReportingPluginServiceConfig: &pb.ReportingPluginServiceConfig{ - ProviderType: config.ProviderType, - Command: config.Command, - PluginName: config.PluginName, - PluginConfig: config.PluginConfig, + ProviderType: config.ProviderType, + Command: config.Command, + PluginName: config.PluginName, + TelemetryType: config.TelemetryType, + PluginConfig: config.PluginConfig, }, ProviderID: providerID, ErrorLogID: errorLogID, @@ -135,10 +136,11 @@ func (m *reportingPluginServiceServer) NewReportingPluginFactory(ctx context.Con telemetry := NewTelemetryServiceClient(telemetryConn) config := types.ReportingPluginServiceConfig{ - ProviderType: request.ReportingPluginServiceConfig.ProviderType, - PluginConfig: request.ReportingPluginServiceConfig.PluginConfig, - PluginName: request.ReportingPluginServiceConfig.PluginName, - Command: request.ReportingPluginServiceConfig.Command, + ProviderType: request.ReportingPluginServiceConfig.ProviderType, + PluginConfig: request.ReportingPluginServiceConfig.PluginConfig, + PluginName: request.ReportingPluginServiceConfig.PluginName, + Command: request.ReportingPluginServiceConfig.Command, + TelemetryType: request.ReportingPluginServiceConfig.TelemetryType, } factory, err := m.impl.NewReportingPluginFactory(ctx, config, providerConn, pipelineRunner, telemetry, errorLog) diff --git a/pkg/loop/internal/test/pipeline_runner.go b/pkg/loop/internal/test/pipeline_runner.go index ba20ae18d2..8a065d3b25 100644 --- a/pkg/loop/internal/test/pipeline_runner.go +++ b/pkg/loop/internal/test/pipeline_runner.go @@ -12,7 +12,7 @@ var _ types.PipelineRunnerService = (*StaticPipelineRunnerService)(nil) type StaticPipelineRunnerService struct{} -func (pr *StaticPipelineRunnerService) ExecuteRun(ctx context.Context, s string, v types.Vars, o types.Options) ([]types.TaskResult, error) { +func (pr *StaticPipelineRunnerService) ExecuteRun(ctx context.Context, s string, v types.Vars, o types.Options) (types.TaskResults, error) { if s != spec { return nil, fmt.Errorf("expected %s but got %s", spec, s) } diff --git a/pkg/loop/internal/test/test.go b/pkg/loop/internal/test/test.go index a0557889f0..cafbc130dc 100644 --- a/pkg/loop/internal/test/test.go +++ b/pkg/loop/internal/test/test.go @@ -139,11 +139,13 @@ URL = 'https://test.url' options = types.Options{ MaxTaskDuration: 10 * time.Second, } - taskResults = []types.TaskResult{ + taskResults = types.TaskResults([]types.TaskResult{ { - Value: "hello", + TaskValue: types.TaskValue{ + Value: "hello", + }, Index: 0, }, - } + }) payload = []byte("oops") ) diff --git a/pkg/types/pipeline_runner.go b/pkg/types/pipeline_runner.go index da755ff223..a10fecf99a 100644 --- a/pkg/types/pipeline_runner.go +++ b/pkg/types/pipeline_runner.go @@ -2,6 +2,7 @@ package types import ( "context" + "sort" "time" ) @@ -13,14 +14,43 @@ type Options struct { MaxTaskDuration time.Duration } +type TaskValue struct { + Error error + Value interface{} + IsTerminal bool +} + type TaskResult struct { ID string Type string - Value interface{} - Error error Index int + + TaskValue +} + +type TaskResults []TaskResult + +func (tr TaskResults) FinalResults() []TaskValue { + sort.Slice(tr, func(i, j int) bool { + return tr[i].Index < tr[j].Index + }) + + var found bool + results := []TaskValue{} + for _, t := range tr { + if t.IsTerminal { + results = append(results, t.TaskValue) + found = true + } + } + + if !found { + panic("expected at least one final task") + } + + return results } type PipelineRunnerService interface { - ExecuteRun(ctx context.Context, spec string, vars Vars, options Options) ([]TaskResult, error) + ExecuteRun(ctx context.Context, spec string, vars Vars, options Options) (TaskResults, error) } diff --git a/pkg/types/reporting_plugin_service.go b/pkg/types/reporting_plugin_service.go index 920bc426ff..0d4535d89b 100644 --- a/pkg/types/reporting_plugin_service.go +++ b/pkg/types/reporting_plugin_service.go @@ -7,10 +7,11 @@ import ( ) type ReportingPluginServiceConfig struct { - ProviderType string - Command string - PluginName string - PluginConfig string + ProviderType string + Command string + PluginName string + TelemetryType string + PluginConfig string } // ReportingPluginClient is the client interface to a plugin running