Skip to content

Commit

Permalink
Add logging to /analytics/log errors (#1337)
Browse files Browse the repository at this point in the history
Alternatively, we could use `withLogging()`, but I'm afraid of the number of logs if there are a lot of /analytics/log sent
  • Loading branch information
leszko authored Jul 23, 2024
1 parent 5eab596 commit 790de60
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions handlers/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (c *AnalyticsHandlersCollection) Log() httprouter.Handle {
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
log, err := parseAnalyticsLog(r, schema)
if log == nil {
glog.Warningf("error parsing analytics log request payload, err=%v", err)
cerrors.WriteHTTPBadRequest(w, "Invalid request payload", err)
return
}
Expand All @@ -127,6 +128,7 @@ func (c *AnalyticsHandlersCollection) Log() httprouter.Handle {
case dataCh <- ad:
// process data async
default:
glog.Warningf("error processing analytics log, too many requests")
cerrors.WriteHTTPInternalServerError(w, "error processing analytics log, too many requests", nil)
}
}
Expand Down

0 comments on commit 790de60

Please sign in to comment.