From a5ea0bd0b72f4505bd478771a6c3aad4f28bf39e Mon Sep 17 00:00:00 2001 From: Flynn Date: Tue, 29 Oct 2024 16:57:57 -0400 Subject: [PATCH 1/2] Clean up logging in the face workload Signed-off-by: Flynn --- pkg/faces/faceserver.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/faces/faceserver.go b/pkg/faces/faceserver.go index 5d94db1..9de1c87 100644 --- a/pkg/faces/faceserver.go +++ b/pkg/faces/faceserver.go @@ -85,8 +85,8 @@ func (srv *FaceServer) SetupFromEnvironment() { } } - fmt.Printf("%s %s: smileyService %v\n", time.Now().Format(time.RFC3339), srv.Name, srv.smileyService) - fmt.Printf("%s %s: colorService %v\n", time.Now().Format(time.RFC3339), srv.Name, srv.colorService) + fmt.Printf("%s %s: smileyService http://%s\n", time.Now().Format(time.RFC3339), srv.Name, srv.smileyService) + fmt.Printf("%s %s: colorService grpc://%s\n", time.Now().Format(time.RFC3339), srv.Name, srv.colorService) } func (srv *FaceServer) makeRequest(user string, userAgent string, service string, keyword string, subrequest string, row int, col int) *FaceResponse { @@ -204,7 +204,9 @@ func (srv *FaceServer) faceGetHandler(r *http.Request, rstat *BaseRequestStatus) StatusCode: http.StatusOK, } - fmt.Printf("%s %s: request path: %s, query string: %s\n", time.Now().Format(time.RFC3339), srv.Name, r.URL.Path, r.URL.RawQuery) + if srv.debugEnabled { + fmt.Printf("%s %s: request path: %s, query string: %s\n", time.Now().Format(time.RFC3339), srv.Name, r.URL.Path, r.URL.RawQuery) + } // Our request URL should start with /center/ or /edge/, and we want to // propagate that to our smiley and color services. From e908a990ab59d4aa3aa2421b16dad915a9bc5192 Mon Sep 17 00:00:00 2001 From: Flynn Date: Tue, 29 Oct 2024 16:58:29 -0400 Subject: [PATCH 2/2] Support DELAY_BUCKETS in the color workload Signed-off-by: Flynn --- pkg/faces/color_provider.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/faces/color_provider.go b/pkg/faces/color_provider.go index da52ff7..2b34f18 100644 --- a/pkg/faces/color_provider.go +++ b/pkg/faces/color_provider.go @@ -56,6 +56,8 @@ func (cprv *ColorProvider) Get(row, col int) ProviderResponse { cprv.CheckUnlatch(start) rstat := cprv.CheckRequestStatus() + cprv.DelayIfNeeded() + if rstat.IsRateLimited() { cprv.Warnf("RATELIMIT(%d, %d) => %s\n", row, col, rstat.Message())