From d05b303bcb119c485ede56f55be58668d970da82 Mon Sep 17 00:00:00 2001 From: NateAtNodeKit Date: Tue, 4 Mar 2025 15:22:14 -0500 Subject: [PATCH] log fixes --- services/api/resolutions.go | 7 ++++++- services/api/service.go | 14 ++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/services/api/resolutions.go b/services/api/resolutions.go index 2eaa504e..02867ed5 100644 --- a/services/api/resolutions.go +++ b/services/api/resolutions.go @@ -10,7 +10,12 @@ import ( ) func (api *ArcadiaAPI) RespondError(w http.ResponseWriter, code int, message string) { - api.Respond(w, code, HTTPErrorResp{code, message}) + if code == http.StatusNoContent { + // status 204 cannot be sent with payload + api.Respond(w, code, nil) + } else { + api.Respond(w, code, HTTPErrorResp{code, message}) + } } func (api *ArcadiaAPI) RespondOK(w http.ResponseWriter, response any) { diff --git a/services/api/service.go b/services/api/service.go index 8b8c5e71..401302d7 100644 --- a/services/api/service.go +++ b/services/api/service.go @@ -1066,7 +1066,7 @@ func (api *ArcadiaAPI) handleGetPayload(w http.ResponseWriter, req *http.Request log.WithFields(logrus.Fields{ "timestampRequestFin": time.Now().UTC().UnixMilli(), "requestDurationUSecs": requestDurationUSecs, - }).Info("request finished") + }).Info("request getPayload finished") if requestWasSuccess { getPayloadLatency.Observe(float64(requestDurationUSecs)) @@ -1233,7 +1233,7 @@ func (api *ArcadiaAPI) handleAuctionBid(w http.ResponseWriter, req *http.Request "method": "auctionBid", "timestampRequestFin": time.Now().UTC().UnixMilli(), "requestDurationUSecs": requestDurationUSecs, - }).Info("request finished") + }).Info("request auctionBid finished") if requestWasSuccess { auctionBidLatency.Observe(float64(requestDurationUSecs)) @@ -1551,7 +1551,7 @@ func (api *ArcadiaAPI) handleSubmitNewBlockRequest(w http.ResponseWriter, req *h log.WithFields(logrus.Fields{ "timestampRequestFin": time.Now().UTC().UnixMilli(), "requestDurationUSecs": requestDurationUSecs, - }).Info("request finished") + }).Info("request submitNewBlock finished") if requestWasSuccess { submitNewBlockLatency.Observe(float64(requestDurationUSecs)) @@ -2373,7 +2373,9 @@ func (api *ArcadiaAPI) handleGetBundleStatus(w http.ResponseWriter, req *http.Re } if status == nil || *status == "" { - api.RespondError(w, http.StatusNoContent, fmt.Sprintf("bundle status not found for bundle: %s", bundleStatusReq.BundleHash)) + logMsg := fmt.Sprintf("bundle status not found for bundle: %s", bundleStatusReq.BundleHash) + log.WithField("status", status).Warn(logMsg) + api.RespondError(w, http.StatusNoContent, logMsg) return } @@ -2405,7 +2407,7 @@ func (api *ArcadiaAPI) handleGetArcadiaBlock(w http.ResponseWriter, req *http.Re "method": "arcadiaBlock", "timestampRequestFin": time.Now().UTC().UnixMilli(), "requestDurationUSecs": requestDurationUSecs, - }).Info("request finished") + }).Info("request getArcadiaBlock finished") if requestWasSuccess { getArcadiaBlockLatency.Observe(float64(requestDurationUSecs)) @@ -2727,7 +2729,7 @@ func (api *ArcadiaAPI) handleRecvPreconf(w http.ResponseWriter, req *http.Reques "method": "recvPreconf", "timestampRequestFin": time.Now().UTC().UnixMilli(), "requestDurationUSecs": requestDurationUSecs, - }).Info("request finished") + }).Info("request recvPreconf finished") if requestWasSuccess { recvPreconfsLatency.Observe(float64(requestDurationUSecs))