diff --git a/lib/RequestHandler.go b/lib/RequestHandler.go index 5a50ae4..0d4adf2 100644 --- a/lib/RequestHandler.go +++ b/lib/RequestHandler.go @@ -66,7 +66,10 @@ func (wp *WorkerPool) processRequest(request RequestObject) { var result map[string]interface{} if err := json.Unmarshal(messageBytes, &result); err != nil { - wp.logger.Error("Failed to unmarshal JSON", zap.Error(err)) + wp.logger.Error("Failed to unmarshal JSON", + zap.Error(err), + zap.String("messageBytes", string(messageBytes)), + zap.Int("bytesLength", len(messageBytes))) return } diff --git a/server/handlers.go b/server/handlers.go index 4231c43..bb7fbe3 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -70,7 +70,12 @@ func eventsHandlerJson(workerPool *lib.WorkerPool) http.HandlerFunc { body, err := ioutil.ReadAll(reader) // todo Limit to 1MB if err != nil { - logger.Error("Error reading request body", zap.Error(err)) + logger.Error("Error reading request body", + zap.Error(err), + zap.String("remote_addr", r.RemoteAddr), + zap.String("user_agent", r.UserAgent()), + zap.Int64("content_length", r.ContentLength), + ) http.Error(w, "Request body invalid", http.StatusBadRequest) metrics.EventHandlerTimeHist.WithLabelValues(JSON, ERROR).Observe(float64(utils.NanosToMillis(time.Now().UnixNano()) - eventHandlerStartTime)) return