From 9b05e93788c25fbf1a7ec8f3f4319af1cf042617 Mon Sep 17 00:00:00 2001 From: okankoAMZ <107267850+okankoAMZ@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:36:57 -0400 Subject: [PATCH] Update util/common/traces/generate.go Co-authored-by: Jeffrey Chien --- mockserver/main.go | 3 ++- util/common/traces/generate.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mockserver/main.go b/mockserver/main.go index ea79cdde6..051112328 100644 --- a/mockserver/main.go +++ b/mockserver/main.go @@ -90,6 +90,7 @@ func (ts *transactionHttpServer) GetNumberOfTransactionsPerMinute(w http.Respons w.Header().Set("Content-Type", "application/json") if err := json.NewEncoder(w).Encode(TransactionPayload{tpm}); err != nil { + w.WriteHeader(http.StatusInternalServerError) io.WriteString(w, err.Error()) log.Printf("Unable to write response: %v", err) } @@ -128,7 +129,7 @@ func StartHttpServer() { if err := appServer.ListenAndServe(); err != nil { log.Printf("Verification server error: %v", err) err := appServer.Shutdown(context.TODO()) - log.Fatalf("Shuwdown server error: %v", err) + log.Fatalf("Shutdown server error: %v", err) } }(&store) wg.Wait() diff --git a/util/common/traces/generate.go b/util/common/traces/generate.go index 74fbc71d7..d60350dcd 100644 --- a/util/common/traces/generate.go +++ b/util/common/traces/generate.go @@ -1,6 +1,7 @@ package traces import ( + "fmt" "github.com/aws/amazon-cloudwatch-agent-test/util/common/traces/common" "github.com/aws/amazon-cloudwatch-agent-test/util/common/traces/xray" "time" @@ -34,9 +35,8 @@ func StartTraceGeneration(receiver string, agentConfigPath string, agentRuntime cfg.Generator = xray.NewLoadGenerator(&xrayGenCfg) cfg.Name = "xray-performance-test" case "otlp": - panic("Only supports xray for now.") default: - panic("Invalid trace receiver") + return fmt.Errorf("%s is not supported.", receiver) } err := common.GenerateTraces(cfg) return err