From 3dd801a1293346564d06deb484813765dae260ba Mon Sep 17 00:00:00 2001 From: lostbean Date: Tue, 5 Dec 2023 19:40:52 -0300 Subject: [PATCH] remaining golint errors --- .../http_rest/api_types/api_types.gen.go | 2 +- .../core_rest_api/api_container_server.gen.go | 142 +++++++++--------- .../websocket_api/websocket_server.gen.go | 58 +++---- api/openapi/specs/kurtosis_api.yaml | 1 - engine/server/engine/main.go | 4 +- .../engine/mapping/to_http/starlark_logs.go | 128 ++++++++++------ .../engine/server/enclave_rest_api_handler.go | 64 ++++++-- .../engine/server/websocket_api_handler.go | 46 ++++-- .../server/engine/streaming/service_logs.go | 5 +- .../server/engine/streaming/starlark_logs.go | 17 ++- engine/server/engine/utils/list.go | 28 +++- engine/server/engine/utils/pointer.go | 4 + 12 files changed, 310 insertions(+), 189 deletions(-) diff --git a/api/golang/http_rest/api_types/api_types.gen.go b/api/golang/http_rest/api_types/api_types.gen.go index bb2da1bd7a..1a31729aae 100644 --- a/api/golang/http_rest/api_types/api_types.gen.go +++ b/api/golang/http_rest/api_types/api_types.gen.go @@ -459,7 +459,7 @@ type StarlarkInstruction struct { ExecutableInstruction string `json:"executable_instruction"` InstructionName string `json:"instruction_name"` IsSkipped bool `json:"is_skipped"` - Position StarlarkInstructionPosition `json:"position"` + Position *StarlarkInstructionPosition `json:"position,omitempty"` } // StarlarkInstructionArgument defines model for StarlarkInstructionArgument. diff --git a/api/golang/http_rest/core_rest_api/api_container_server.gen.go b/api/golang/http_rest/core_rest_api/api_container_server.gen.go index c27e703b21..f7dad9cb8c 100644 --- a/api/golang/http_rest/core_rest_api/api_container_server.gen.go +++ b/api/golang/http_rest/core_rest_api/api_container_server.gen.go @@ -1547,80 +1547,80 @@ func (sh *strictHandler) PostEnclavesEnclaveIdentifierStarlarkScripts(ctx echo.C var swaggerSpec = []string{ "H4sIAAAAAAAC/+w8a2/bOLZ/hdC9QGcWatydXSwu+i1N09bY1jEcZ3MvJoVKS8c2tzSpJamkniL//YIv", - "PSxKlvP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IdEC1pgu72s0", + "LDrykc2ENrh/2Ii724hzx6WnsQzPpOuuLc5/tKrbLR9Y0+1TfDt0RRiMXE2s/qU0BKV867AirHBVbHF7", + "+/8BAAD//z+MtuXcZQAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/golang/http_rest/websocket_api/websocket_server.gen.go b/api/golang/http_rest/websocket_api/websocket_server.gen.go index 59527a4f3b..f5541f40a7 100644 --- a/api/golang/http_rest/websocket_api/websocket_server.gen.go +++ b/api/golang/http_rest/websocket_api/websocket_server.gen.go @@ -197,38 +197,38 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xaX2/juBH/KgRboC2gi9K9t7wFd969oNskcLzdA3YDHS2NbG4oUksOvesG/u4FJUrW", - "H9qW0wCLAn1KRM1/zvw4GvqZpqoolQSJhl4905JpVgCCrp5SJb9YmSLfQJJz0SxzSa/oVwt6SyMqWQH0", + "H4sIAAAAAAAC/+xaX2/juBH/KgRboC2gi9K9t7wFd969oNskcLzdA3YDHS2NbG4oUksOvesG/u4FJUqW", + "LFqW0wCLAn1KRM1/zvw4GvqZpqoolQSJhl4905JpVgCCrp5SJb9YmSLfQJJz0SxzSa/oVwt6SyMqWQH0", "KkgaUZOuoWAVD0JRMf9ZQ06v6J/iveK4JjPxe7V6zyW8rfjpLqK4LZ1wpjXb0t0uoiBTwTaQ8Awk8pyD", "djIzMKnmJXLlLPvw4ebXiJi10ggSMlI/K02cqUTlBNdAvCAa1d6UDNd7ZwJaIqrhq+UaMnqF2kLXN2+l", - "Qc3lqjIzV0Kob4lQq4MB65IEhC2VEsBkJU3awtElgks4KK9PFJDIJcLKhXXnfEGrZcKEOGrjkOyEnQb0", - "hqfHN2exBuLpyJ6u2ZVUSWRcgia4ZuiXioLJzO2nFRlZAoHvkFqEjHAZ3r6AHedtXyPAWp4lBvBQfEZ0", - "x9S0FTDQF8hyg0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9od19k2LSTke9H60TQm+68+drs", + "f6a2H+ZtN0YaBhqd3Yfuj6nJfeRZXWc3h6byDHH0DG39mp3K+JFpWafiVBNz5Vro/b4dtuWDiti0BD8G", + "AAf6x7KwicfAxm8nXkw3/5DhpAON6pDdi+5Apa35jCH8hLw6xgOzpgaWkKNw7/5hNSrDDZnPHha5FeT6", + "/oZGdAPa1KV3efH3i0unTpUgWcnpFf354vLikkbVMKyKQ+xnwu5hF+0f4zU3qPT2cPl5OEPeTaGJmUae", + "sxTNedSxUCkTP7kG50xGDYVCeAmn/2w38fNw4nqms/Fz8+9ry4gz9U0KxbJJwppp+KoeafQh+h0gKaxA", + "Xor2AqEZZhviWEmqpD9IxPaCLNbcEJBZqbhEkjJJDGpgRTWYreiXWwIc16CJQWe9XH2WjHyEpVHpE6CT", + "J6GCTPJXDakqCpAZZH8jShMBK5ZuyW+Lxb2Xy+XqgkZ+LMeVvMlqq2feZ//3pnX4fT3V7976HDli9iRx", + "4HbkGL52uAYTowk83TuSCeShO6gJbIe3HBNY+pctu8eDAfeby8tXG293B3KB6fZD2yeSxgRaEeXMf1aE", + "hLfWxvUsvhqJ26JgDsiqPPeb/BfTT3CHuMyVyCfaphytRk4nCquRMqkKW2DZp/95fGeA8iug2KiE2F9g", + "vYKkBklM/Fwqjb5L3cVsw7hgSy44voLLpzGwub9zhP8DIOcryPi/PxT9zuP6P/79MPzr5vjLQc+33dOK", + "0hPH/j7WvIwrfvb/JTzbnSeijutkvWj3pCsuIfaNt1tpZbbDewc24bvkE4jzcIAmKidM7u+x9/fb1U8G", + "voEGwiVHzhAyYg2XK/KHBtQcNv7GiZmtTP+4+CwXayDVg2/emCTL6kcIxhaQESXFliiZAmEyI/C95BoI", + "yxG0pynre3VN3pC1sto0LzVUmV5pOB8cyURs/Cyng+PgqscMVj5Ynr0IEY/9ROC/hoWz7isOByzD31WM", + "Y8dXCwZfBToCqTmGIrvdfwIAAP//rrgHHYUlAAA=", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/openapi/specs/kurtosis_api.yaml b/api/openapi/specs/kurtosis_api.yaml index 857fc3a308..29967046a3 100644 --- a/api/openapi/specs/kurtosis_api.yaml +++ b/api/openapi/specs/kurtosis_api.yaml @@ -1215,7 +1215,6 @@ components: is_skipped: type: boolean required: - - position - instruction_name - arguments - executable_instruction diff --git a/engine/server/engine/main.go b/engine/server/engine/main.go index 2193a81e57..5a734ad3ae 100644 --- a/engine/server/engine/main.go +++ b/engine/server/engine/main.go @@ -422,8 +422,8 @@ func restApiServer( // ============================== Engine Management API ====================================== enclaveRuntime, err := restApi.NewEnclaveRuntime(ctx, *enclave_manager, asyncStarlarkLogs, false) if err != nil { - stacktrace.Propagate(err, "Failed to initialize %T", enclaveRuntime) - return err + newErr := stacktrace.Propagate(err, "Failed to initialize %T", enclaveRuntime) + return newErr } enclaveApi.RegisterHandlers(echoRouter, enclaveApi.NewStrictHandler(enclaveRuntime, nil)) diff --git a/engine/server/engine/mapping/to_http/starlark_logs.go b/engine/server/engine/mapping/to_http/starlark_logs.go index 9449300023..e40eb7e79e 100644 --- a/engine/server/engine/mapping/to_http/starlark_logs.go +++ b/engine/server/engine/mapping/to_http/starlark_logs.go @@ -1,126 +1,156 @@ package to_http import ( - "reflect" - "github.com/kurtosis-tech/kurtosis/engine/server/engine/utils" - "github.com/sirupsen/logrus" + "github.com/kurtosis-tech/stacktrace" rpc_api "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" api_type "github.com/kurtosis-tech/kurtosis/api/golang/http_rest/api_types" ) -func ToHttpStarlarkRunResponseLine(rpc_value rpc_api.StarlarkRunResponseLine) *api_type.StarlarkRunResponseLine { +func ToHttpStarlarkRunResponseLine(rpc_value *rpc_api.StarlarkRunResponseLine) (*api_type.StarlarkRunResponseLine, error) { var http_type api_type.StarlarkRunResponseLine + if runError := rpc_value.GetError(); runError != nil { - if value := ToHttpStarlarkError(*runError); value != nil { - http_type.FromStarlarkError(*value) - return &http_type + value, err := ToHttpStarlarkError(runError) + if err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runError) } - return nil + if value != nil { + if err := http_type.FromStarlarkError(*value); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runError) + } + return &http_type, nil + } + return nil, nil } if runInfo := rpc_value.GetInfo(); runInfo != nil { - http_type.FromStarlarkInfo(ToHttpStarlarkInfo(*runInfo)) - return &http_type + if err := http_type.FromStarlarkInfo(ToHttpStarlarkInfo(runInfo)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runInfo) + } + return &http_type, nil } if runInstruction := rpc_value.GetInstruction(); runInstruction != nil { - http_type.FromStarlarkInstruction(ToHttpStarlarkInstruction(*runInstruction)) - return &http_type + if err := http_type.FromStarlarkInstruction(ToHttpStarlarkInstruction(runInstruction)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runInstruction) + } + return &http_type, nil } if runInstructionResult := rpc_value.GetInstructionResult(); runInstructionResult != nil { - http_type.FromStarlarkInstructionResult(ToHttpStarlarkInstructionResult(*runInstructionResult)) - return &http_type + if err := http_type.FromStarlarkInstructionResult(ToHttpStarlarkInstructionResult(runInstructionResult)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runInstructionResult) + } + return &http_type, nil } if runProgressInfo := rpc_value.GetProgressInfo(); runProgressInfo != nil { - http_type.FromStarlarkRunProgress(ToHttpStarlarkProgressInfo(*runProgressInfo)) - return &http_type + if err := http_type.FromStarlarkRunProgress(ToHttpStarlarkProgressInfo(runProgressInfo)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runProgressInfo) + } + return &http_type, nil } if runWarning := rpc_value.GetWarning(); runWarning != nil { - http_type.FromStarlarkWarning(ToHttpStarlarkWarning(*runWarning)) - return &http_type + if err := http_type.FromStarlarkWarning(ToHttpStarlarkWarning(runWarning)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runWarning) + } + return &http_type, nil } if runFinishedEvent := rpc_value.GetRunFinishedEvent(); runFinishedEvent != nil { - http_type.FromStarlarkRunFinishedEvent(ToHttpStarlarkRunFinishedEvent(*runFinishedEvent)) - return &http_type + if err := http_type.FromStarlarkRunFinishedEvent(ToHttpStarlarkRunFinishedEvent(runFinishedEvent)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runFinishedEvent) + } + return &http_type, nil } - logrus.WithFields(logrus.Fields{ - "type": reflect.TypeOf(rpc_value).Name(), - "value": rpc_value.String(), - }).Warnf("Unmatched gRPC to Http mapping, returning empty value") - return nil + err := stacktrace.NewError("Unmatched gRPC to Http mapping, source type: %T", rpc_value) + return nil, err } -func ToHttpStarlarkError(rpc_value rpc_api.StarlarkError) *api_type.StarlarkError { +func ToHttpStarlarkError(rpc_value *rpc_api.StarlarkError) (*api_type.StarlarkError, error) { var http_type api_type.StarlarkError if runError := rpc_value.GetExecutionError(); runError != nil { - http_type.Error.FromStarlarkExecutionError(ToHttpStarlarkExecutionError(*runError)) - return &http_type + if err := http_type.Error.FromStarlarkExecutionError(ToHttpStarlarkExecutionError(runError)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runError) + } + return &http_type, nil } if runError := rpc_value.GetInterpretationError(); runError != nil { - http_type.Error.FromStarlarkInterpretationError(ToHttpStarlarkInterpretationError(*runError)) - return &http_type + if err := http_type.Error.FromStarlarkInterpretationError(ToHttpStarlarkInterpretationError(runError)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runError) + } + return &http_type, nil } if runError := rpc_value.GetValidationError(); runError != nil { - http_type.Error.FromStarlarkValidationError(ToHttpStarlarkValidationError(*runError)) - return &http_type + if err := http_type.Error.FromStarlarkValidationError(ToHttpStarlarkValidationError(runError)); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", runError) + } + return &http_type, nil } - logrus.WithFields(logrus.Fields{ - "type": reflect.TypeOf(rpc_value).Name(), - "value": rpc_value.String(), - }).Warnf("Unmatched gRPC to Http mapping, returning empty value") - return nil + err := stacktrace.NewError("Unmatched gRPC to Http mapping, source type: %T", rpc_value) + return nil, err } -func ToHttpStarlarkExecutionError(rpc_value rpc_api.StarlarkExecutionError) api_type.StarlarkExecutionError { +func ToHttpStarlarkExecutionError(rpc_value *rpc_api.StarlarkExecutionError) api_type.StarlarkExecutionError { var http_type api_type.StarlarkExecutionError http_type.ExecutionError.ErrorMessage = rpc_value.ErrorMessage return http_type } -func ToHttpStarlarkInterpretationError(rpc_value rpc_api.StarlarkInterpretationError) api_type.StarlarkInterpretationError { +func ToHttpStarlarkInterpretationError(rpc_value *rpc_api.StarlarkInterpretationError) api_type.StarlarkInterpretationError { var http_type api_type.StarlarkInterpretationError http_type.InterpretationError.ErrorMessage = rpc_value.ErrorMessage return http_type } -func ToHttpStarlarkValidationError(rpc_value rpc_api.StarlarkValidationError) api_type.StarlarkValidationError { +func ToHttpStarlarkValidationError(rpc_value *rpc_api.StarlarkValidationError) api_type.StarlarkValidationError { var http_type api_type.StarlarkValidationError http_type.ValidationError.ErrorMessage = rpc_value.ErrorMessage return http_type } -func ToHttpStarlarkInfo(rpc_value rpc_api.StarlarkInfo) api_type.StarlarkInfo { +func ToHttpStarlarkInfo(rpc_value *rpc_api.StarlarkInfo) api_type.StarlarkInfo { var info api_type.StarlarkInfo - info.Info.Instruction.InfoMessage = "" + info.Info.Instruction.InfoMessage = rpc_value.InfoMessage return info } -func ToHttpStarlarkInstruction(rpc_value rpc_api.StarlarkInstruction) api_type.StarlarkInstruction { +func ToHttpStarlarkInstruction(rpc_value *rpc_api.StarlarkInstruction) api_type.StarlarkInstruction { + position := ToHttpStarlarkInstructionPosition(rpc_value.Position) return api_type.StarlarkInstruction{ + ExecutableInstruction: rpc_value.ExecutableInstruction, + IsSkipped: rpc_value.IsSkipped, + Position: &position, + InstructionName: rpc_value.InstructionName, Arguments: utils.MapList( - utils.FilterListNils(rpc_value.Arguments), + rpc_value.Arguments, ToHttpStarlarkInstructionArgument, ), } } -func ToHttpStarlarkInstructionResult(rpc_value rpc_api.StarlarkInstructionResult) api_type.StarlarkInstructionResult { +func ToHttpStarlarkInstructionPosition(rpc_value *rpc_api.StarlarkInstructionPosition) api_type.StarlarkInstructionPosition { + return api_type.StarlarkInstructionPosition{ + Column: rpc_value.Column, + Line: rpc_value.Line, + Filename: rpc_value.Filename, + } +} + +func ToHttpStarlarkInstructionResult(rpc_value *rpc_api.StarlarkInstructionResult) api_type.StarlarkInstructionResult { var instructionResult api_type.StarlarkInstructionResult instructionResult.InstructionResult.SerializedInstructionResult = rpc_value.SerializedInstructionResult return instructionResult } -func ToHttpStarlarkProgressInfo(rpc_value rpc_api.StarlarkRunProgress) api_type.StarlarkRunProgress { +func ToHttpStarlarkProgressInfo(rpc_value *rpc_api.StarlarkRunProgress) api_type.StarlarkRunProgress { var progress api_type.StarlarkRunProgress progress.ProgressInfo.CurrentStepInfo = rpc_value.CurrentStepInfo progress.ProgressInfo.CurrentStepNumber = int32(rpc_value.CurrentStepNumber) @@ -128,20 +158,20 @@ func ToHttpStarlarkProgressInfo(rpc_value rpc_api.StarlarkRunProgress) api_type. return progress } -func ToHttpStarlarkWarning(rpc_value rpc_api.StarlarkWarning) api_type.StarlarkWarning { +func ToHttpStarlarkWarning(rpc_value *rpc_api.StarlarkWarning) api_type.StarlarkWarning { var warning api_type.StarlarkWarning warning.Warning.WarningMessage = rpc_value.WarningMessage return warning } -func ToHttpStarlarkRunFinishedEvent(rpc_value rpc_api.StarlarkRunFinishedEvent) api_type.StarlarkRunFinishedEvent { +func ToHttpStarlarkRunFinishedEvent(rpc_value *rpc_api.StarlarkRunFinishedEvent) api_type.StarlarkRunFinishedEvent { var event api_type.StarlarkRunFinishedEvent event.RunFinishedEvent.IsRunSuccessful = rpc_value.IsRunSuccessful event.RunFinishedEvent.SerializedOutput = rpc_value.SerializedOutput return event } -func ToHttpStarlarkInstructionArgument(rpc_value rpc_api.StarlarkInstructionArg) api_type.StarlarkInstructionArgument { +func ToHttpStarlarkInstructionArgument(rpc_value *rpc_api.StarlarkInstructionArg) api_type.StarlarkInstructionArgument { return api_type.StarlarkInstructionArgument{ ArgName: rpc_value.ArgName, IsRepresentative: rpc_value.IsRepresentative, diff --git a/engine/server/engine/server/enclave_rest_api_handler.go b/engine/server/engine/server/enclave_rest_api_handler.go index 5e81cfd63f..a35f59a9ff 100644 --- a/engine/server/engine/server/enclave_rest_api_handler.go +++ b/engine/server/engine/server/enclave_rest_api_handler.go @@ -47,6 +47,7 @@ func NewEnclaveRuntime(ctx context.Context, manager enclave_manager.EnclaveManag connectOnHostMachine: connectOnHostMachine, ctx: ctx, asyncStarlarkLogs: asyncStarlarkLogs, + lock: sync.Mutex{}, } err := runtime.refreshEnclaveConnections() @@ -132,7 +133,9 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierArtifactsLocalFile(c Type: api_type.ERROR, Message: fmt.Sprintf("Failed to upload file: %s", filename), } - result.FileArtifactUploadResult.FromResponseInfo(response) + if err := result.FileArtifactUploadResult.FromResponseInfo(response); err != nil { + return nil, stacktrace.Propagate(err, "Failed to write to enum http type with %T", response) + } uploadedArtifacts[filename] = result continue } @@ -144,7 +147,9 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierArtifactsLocalFile(c Type: api_type.WARNING, Message: fmt.Sprintf("File %s has been already uploaded", filename), } - result.FileArtifactUploadResult.FromResponseInfo(response) + if err := result.FileArtifactUploadResult.FromResponseInfo(response); err != nil { + return nil, stacktrace.Propagate(err, "Failed to write to enum http type with %T", response) + } uploadedArtifacts[filename] = result continue } @@ -153,7 +158,10 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierArtifactsLocalFile(c Name: uploadResult.Name, Uuid: uploadResult.Uuid, } - result.FileArtifactUploadResult.FromFileArtifactReference(artifactResponse) + if err := result.FileArtifactUploadResult.FromFileArtifactReference(artifactResponse); err != nil { + return nil, stacktrace.Propagate(err, "Failed to write to enum http type with %T", artifactResponse) + } + uploadedArtifacts[filename] = result uploadedArtifacts[filename] = result } @@ -572,8 +580,7 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierStarlarkPackagesPack jsonParams := utils.DerefWith(request.Body.Params, map[string]interface{}{}) jsonBlob, err := json.Marshal(jsonParams) if err != nil { - stacktrace.Propagate(err, "I'm actually panicking here. Re-serializing a already deserialized JSON parameter should never fail.") - return nil, err + return nil, stacktrace.Propagate(err, "I'm actually panicking here. Re-serializing a already deserialized JSON parameter should never fail.") } jsonString := string(jsonBlob) @@ -610,13 +617,28 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierStarlarkPackagesPack var syncLogs api_type.StarlarkRunResponse_StarlarkExecutionLogs if !isAsyncRetrieval { - logs := utils.MapList(asyncLogs.WaitAndConsumeAll(), to_http.ToHttpStarlarkRunResponseLine) - syncLogs.FromStarlarkRunLogs(utils.FilterListNils(logs)) + allLogs, err := asyncLogs.WaitAndConsumeAll() + if err != nil { + cancelCtxFunc() + return nil, stacktrace.Propagate(err, "Failed to consume all logs with enclave %s", enclaveIdentifier) + } + httpLogs, err := utils.MapListWithRefStopOnError(allLogs, to_http.ToHttpStarlarkRunResponseLine) + if err != nil { + cancelCtxFunc() + return nil, stacktrace.Propagate(err, "Failed to convert values to http with enclave %s", enclaveIdentifier) + } + + logs := utils.FilterListNils(httpLogs) + if err := syncLogs.FromStarlarkRunLogs(logs); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", logs) + } } else { asyncUuid := manager.asyncStarlarkLogs.Add(&asyncLogs) var asyncLogs api_type.AsyncStarlarkExecutionLogs asyncLogs.AsyncStarlarkExecutionLogs.StarlarkExecutionUuid = string(asyncUuid) - syncLogs.FromAsyncStarlarkExecutionLogs(asyncLogs) + if err := syncLogs.FromAsyncStarlarkExecutionLogs(asyncLogs); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", asyncLogs) + } } response := api_type.StarlarkRunResponse{StarlarkExecutionLogs: &syncLogs} @@ -638,8 +660,7 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierStarlarkScripts(ctx return string(jsonBlob), err }) if err != nil { - stacktrace.Propagate(err, "I'm actually panicking here. Re-serializing a already deserialized JSON parameter should never fail.") - return nil, err + return nil, stacktrace.Propagate(err, "I'm actually panicking here. Re-serializing a already deserialized JSON parameter should never fail.") } runStarlarkScriptArgs := rpc_api.RunStarlarkScriptArgs{ @@ -665,9 +686,22 @@ func (manager *enclaveRuntime) PostEnclavesEnclaveIdentifierStarlarkScripts(ctx asyncLogs := streaming.NewAsyncStarlarkLogs(cancelCtxFunc) go asyncLogs.AttachStream(stream) - logs := utils.MapList(asyncLogs.WaitAndConsumeAll(), to_http.ToHttpStarlarkRunResponseLine) + allLogs, err := asyncLogs.WaitAndConsumeAll() + if err != nil { + cancelCtxFunc() + return nil, stacktrace.Propagate(err, "Failed to consume all logs with enclave %s", enclaveIdentifier) + } + httpLogs, err := utils.MapListWithRefStopOnError(allLogs, to_http.ToHttpStarlarkRunResponseLine) + if err != nil { + cancelCtxFunc() + return nil, stacktrace.Propagate(err, "Failed to convert values to http with enclave %s", enclaveIdentifier) + } + + logs := utils.FilterListNils(httpLogs) var syncLogs api_type.StarlarkRunResponse_StarlarkExecutionLogs - syncLogs.FromStarlarkRunLogs(utils.FilterListNils(logs)) + if err := syncLogs.FromStarlarkRunLogs(logs); err != nil { + return nil, stacktrace.Propagate(err, "failed to serialize %T", logs) + } response := api_type.StarlarkRunResponse{StarlarkExecutionLogs: &syncLogs} return api.PostEnclavesEnclaveIdentifierStarlarkScripts200JSONResponse(response), nil @@ -707,7 +741,7 @@ func getGrpcClientConn(enclaveInfo types.EnclaveInfo, connectOnHostMachine bool) return grpcConnection, nil } -func (manager enclaveRuntime) getApiClientOrResponseError(enclaveUuid string) (*rpc_api.ApiContainerServiceClient, *api_type.ResponseInfo) { +func (manager *enclaveRuntime) getApiClientOrResponseError(enclaveUuid string) (*rpc_api.ApiContainerServiceClient, *api_type.ResponseInfo) { client, err := manager.getGrpcClientForEnclaveUUID(enclaveUuid) if err != nil { return nil, &api_type.ResponseInfo{ @@ -726,7 +760,7 @@ func (manager enclaveRuntime) getApiClientOrResponseError(enclaveUuid string) (* return client, nil } -func (manager enclaveRuntime) getGrpcClientForEnclaveUUID(enclaveUuid string) (*rpc_api.ApiContainerServiceClient, error) { +func (manager *enclaveRuntime) getGrpcClientForEnclaveUUID(enclaveUuid string) (*rpc_api.ApiContainerServiceClient, error) { err := manager.refreshEnclaveConnections() if err != nil { return nil, err @@ -740,7 +774,7 @@ func (manager enclaveRuntime) getGrpcClientForEnclaveUUID(enclaveUuid string) (* return &client, nil } -func (runtime enclaveRuntime) refreshEnclaveConnections() error { +func (runtime *enclaveRuntime) refreshEnclaveConnections() error { runtime.lock.Lock() defer runtime.lock.Unlock() diff --git a/engine/server/engine/server/websocket_api_handler.go b/engine/server/engine/server/websocket_api_handler.go index 8bf550fe7b..085b0bc04e 100644 --- a/engine/server/engine/server/websocket_api_handler.go +++ b/engine/server/engine/server/websocket_api_handler.go @@ -13,6 +13,7 @@ import ( "github.com/kurtosis-tech/kurtosis/engine/server/engine/streaming" "github.com/kurtosis-tech/kurtosis/engine/server/engine/utils" "github.com/kurtosis-tech/kurtosis/metrics-library/golang/lib/metrics_client" + "github.com/kurtosis-tech/stacktrace" "github.com/labstack/echo/v4" "github.com/sirupsen/logrus" "golang.org/x/net/websocket" @@ -152,7 +153,7 @@ func writeResponseInfo(ctx echo.Context, response api_type.ResponseInfo) { ctx.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSON) enc := json.NewEncoder(ctx.Response()) ctx.Response().WriteHeader(int(response.Code)) - enc.Encode(response) + _ = enc.Encode(response) } func streamStarlarkLogsWithWebsocket[T any](ctx echo.Context, streamerPool streaming.StreamerPool[T], streamerUUID streaming.StreamerUUID) { @@ -170,15 +171,20 @@ func streamStarlarkLogsWithWebsocket[T any](ctx echo.Context, streamerPool strea websocket.Handler(func(ws *websocket.Conn) { defer ws.Close() found, err := streamerPool.Consume(streaming.StreamerUUID(streamerUUID), func(logline *rpc_api.StarlarkRunResponseLine) error { - err := websocket.JSON.Send(ws, utils.MapPointer(logline, to_http.ToHttpStarlarkRunResponseLine)) + response, err := to_http.ToHttpStarlarkRunResponseLine(logline) if err != nil { - return err + return stacktrace.Propagate(err, "Failed to convert value of type `%T` to http", logline) + } + if err := websocket.JSON.Send(ws, response); err != nil { + return stacktrace.Propagate(err, "Failed to send value of type `%T` via websocket", logline) } return nil }) if !found { - websocket.JSON.Send(ws, notFoundErr) + if err := websocket.JSON.Send(ws, notFoundErr); err != nil { + logrus.WithError(err).Errorf("Failed to send value via websocket") + } } if err != nil { @@ -191,7 +197,9 @@ func streamStarlarkLogsWithWebsocket[T any](ctx echo.Context, streamerPool strea Message: fmt.Sprintf("Log streaming '%s' failed while sending the data", streamerUUID), Code: http.StatusInternalServerError, } - websocket.JSON.Send(ws, streamingErr) + if err := websocket.JSON.Send(ws, streamingErr); err != nil { + logrus.WithError(err).Errorf("Failed to send value via websocket") + } } }).ServeHTTP(ctx.Response(), ctx.Request()) } @@ -212,15 +220,21 @@ func streamStarlarkLogsWithHTTP[T any](ctx echo.Context, streamerPool streaming. enc := json.NewEncoder(ctx.Response()) ctx.Response().WriteHeader(http.StatusOK) found, err := streamerPool.Consume(streaming.StreamerUUID(streamerUUID), func(logline *rpc_api.StarlarkRunResponseLine) error { - if err := enc.Encode(utils.MapPointer(logline, to_http.ToHttpStarlarkRunResponseLine)); err != nil { - return err + response, err := to_http.ToHttpStarlarkRunResponseLine(logline) + if err != nil { + return stacktrace.Propagate(err, "Failed to convert value of type `%T` to http", logline) + } + if err := enc.Encode(response); err != nil { + return stacktrace.Propagate(err, "Failed to send value of type `%T` via http streaming", logline) } ctx.Response().Flush() return nil }) if !found { - enc.Encode(notFoundErr) + if err := enc.Encode(notFoundErr); err != nil { + logrus.WithError(err).Errorf("Failed to send value via websocket") + } } if err != nil { @@ -233,7 +247,9 @@ func streamStarlarkLogsWithHTTP[T any](ctx echo.Context, streamerPool streaming. Message: fmt.Sprintf("Log streaming '%s' failed while sending the data", streamerUUID), Code: http.StatusInternalServerError, } - enc.Encode(streamingErr) + if err := enc.Encode(streamingErr); err != nil { + logrus.WithError(err).Errorf("Failed to send value via websocket") + } } } @@ -255,10 +271,12 @@ func streamServiceLogsWithWebsocket(ctx echo.Context, streamer streaming.Service }).Error("Failed to stream all data") streamingErr := api_type.ResponseInfo{ Type: api_type.ERROR, - Message: fmt.Sprintf("Log streaming failed while sending the data"), + Message: "Log streaming failed while sending the data", Code: http.StatusInternalServerError, } - websocket.JSON.Send(ws, streamingErr) + if err := websocket.JSON.Send(ws, streamingErr); err != nil { + logrus.WithError(err).Errorf("Failed to send value via websocket") + } } }).ServeHTTP(ctx.Response(), ctx.Request()) } @@ -282,9 +300,11 @@ func streamServiceLogsWithHTTP(ctx echo.Context, streamer streaming.ServiceLogSt }).Error("Failed to stream all data") streamingErr := api_type.ResponseInfo{ Type: api_type.ERROR, - Message: fmt.Sprintf("Log streaming failed while sending the data"), + Message: "Log streaming failed while sending the data", Code: http.StatusInternalServerError, } - enc.Encode(streamingErr) + if err := enc.Encode(streamingErr); err != nil { + logrus.WithError(err).Errorf("Failed to send value via websocket") + } } } diff --git a/engine/server/engine/streaming/service_logs.go b/engine/server/engine/streaming/service_logs.go index 11698a01d8..138a3b5751 100644 --- a/engine/server/engine/streaming/service_logs.go +++ b/engine/server/engine/streaming/service_logs.go @@ -19,7 +19,8 @@ import ( ) var ( - logRetentionFeatureReleaseTime = time.Date(2023, 9, 7, 13, 0, 0, 0, time.UTC) + logRetentionFeatureReleaseTime = time.Date(2023, 9, 7, 13, 0, 0, 0, time.UTC) + defaultNumberOfLogLines uint32 = 100 ) type ServiceLogStreamer struct { @@ -51,7 +52,7 @@ func NewServiceLogStreamer( requestedServiceUuids := make(map[user_service.ServiceUUID]bool, len(serviceUuidList)) shouldFollowLogs := utils.DerefWith(maybeShouldFollowLogs, false) shouldReturnAllLogs := utils.DerefWith(maybeShouldReturnAllLogs, false) - numLogLines := utils.DerefWith(maybeNumLogLines, 100) + numLogLines := utils.DerefWith(maybeNumLogLines, defaultNumberOfLogLines) filters := utils.DerefWith(maybeFilters, []api_type.LogLineFilter{}) for _, serviceUuidStr := range serviceUuidList { diff --git a/engine/server/engine/streaming/starlark_logs.go b/engine/server/engine/streaming/starlark_logs.go index c1057ba12e..00d6fae575 100644 --- a/engine/server/engine/streaming/starlark_logs.go +++ b/engine/server/engine/streaming/starlark_logs.go @@ -9,6 +9,7 @@ import ( rpc_api "github.com/kurtosis-tech/kurtosis/api/golang/core/kurtosis_core_rpc_api_bindings" "github.com/kurtosis-tech/kurtosis/engine/server/engine/utils" + "github.com/kurtosis-tech/stacktrace" ) type asyncStarlarkLogs struct { @@ -69,20 +70,28 @@ func (async *asyncStarlarkLogs) AttachStream(stream grpc.ClientStream) { } } -func (async *asyncStarlarkLogs) WaitAndConsumeAll() []rpc_api.StarlarkRunResponseLine { +func (async *asyncStarlarkLogs) WaitAndConsumeAll() ([]rpc_api.StarlarkRunResponseLine, error) { var logs []*rpc_api.StarlarkRunResponseLine - async.Consume(func(elem *rpc_api.StarlarkRunResponseLine) error { + err := async.Consume(func(elem *rpc_api.StarlarkRunResponseLine) error { if elem != nil { logs = append(logs, elem) } return nil }) - return utils.FilterListNils(logs) + notNilsLogs := utils.FilterListNils(logs) + + if err != nil { + return notNilsLogs, stacktrace.Propagate(err, "Failed to consume all logs, %d were consumed before the error", len(notNilsLogs)) + } + + return notNilsLogs, nil } func (async *asyncStarlarkLogs) Consume(consumer func(*rpc_api.StarlarkRunResponseLine) error) error { for elem := range async.starlarkRunResponseLineChan { - consumer(elem) + if err := consumer(elem); err != nil { + return stacktrace.Propagate(err, "Failed to consume element of type '%T'", elem) + } } return nil } diff --git a/engine/server/engine/utils/list.go b/engine/server/engine/utils/list.go index 250e8f12f5..8a31ef3e62 100644 --- a/engine/server/engine/utils/list.go +++ b/engine/server/engine/utils/list.go @@ -2,12 +2,36 @@ package utils func MapList[T, U any](data []T, function func(T) U) []U { res := make([]U, 0, len(data)) - for _, e := range data { - res = append(res, function(e)) + for _, elem := range data { + res = append(res, function(elem)) } return res } +func MapListWithRefStopOnError[T, U any](data []T, function func(*T) (U, error)) ([]U, error) { + res := make([]U, 0, len(data)) + for _, elem := range data { + value, err := function(&elem) + if err != nil { + return res, err + } + res = append(res, value) + } + return res, nil +} + +func MapListStopOnError[T, U any](data []T, function func(T) (U, error)) ([]U, error) { + res := make([]U, 0, len(data)) + for _, elem := range data { + value, err := function(elem) + if err != nil { + return res, err + } + res = append(res, value) + } + return res, nil +} + func FilterListNils[T any](data []*T) []T { filterList := make([]T, 0) for _, elem := range data { diff --git a/engine/server/engine/utils/pointer.go b/engine/server/engine/utils/pointer.go index 8ba51b116d..84cc2b7802 100644 --- a/engine/server/engine/utils/pointer.go +++ b/engine/server/engine/utils/pointer.go @@ -7,6 +7,10 @@ func DerefWith[T any](value *T, defaultValue T) T { return *value } +func MapWithRef[T any, U any](value T, function func(*T) U) U { + return function(&value) +} + func MapPointer[T any, U any](value *T, function func(T) U) *U { if value == nil { return nil