Avoid dumping request headers in router (#2122)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -705,16 +705,17 @@ func (fh functionHandler) getProxyErrorHandler(start time.Time, rrt *RetryingRou
|
||||
// Reference: https://httpstatuses.com/499
|
||||
status = 499
|
||||
msg = "client closes the connection"
|
||||
fh.logger.Debug(msg, zap.Any("function", fh.function), zap.Any("request_header", req.Header))
|
||||
fh.logger.Debug(msg, zap.Any("function", fh.function), zap.String("status", "Client Closed Request"))
|
||||
case context.DeadlineExceeded:
|
||||
status = http.StatusGatewayTimeout
|
||||
msg := "function not responses before the timeout"
|
||||
fh.logger.Error(msg, zap.Any("function", fh.function), zap.Any("request_header", req.Header))
|
||||
msg := "no response from function before timeout"
|
||||
fh.logger.Error(msg, zap.Any("function", fh.function), zap.String("status", http.StatusText(status)))
|
||||
default:
|
||||
code, _ := ferror.GetHTTPError(err)
|
||||
status = code
|
||||
msg = "error sending request to function"
|
||||
fh.logger.Error(msg, zap.Error(err), zap.Any("function", fh.function), zap.Any("request_header", req.Header), zap.Any("code", code))
|
||||
fh.logger.Error(msg, zap.Error(err), zap.Any("function", fh.function),
|
||||
zap.Any("status", http.StatusText(status)), zap.Int("code", code))
|
||||
}
|
||||
|
||||
go fh.collectFunctionMetric(start, rrt, req, &http.Response{
|
||||
@@ -730,7 +731,6 @@ func (fh functionHandler) getProxyErrorHandler(start time.Time, rrt *RetryingRou
|
||||
"error writing HTTP response",
|
||||
zap.Error(err),
|
||||
zap.Any("function", fh.function),
|
||||
zap.Any("request_header", req.Header),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -93,8 +94,11 @@ func serve(ctx context.Context, logger *zap.Logger, port int, tracingSamplingRat
|
||||
}
|
||||
}
|
||||
if displayAccessLog {
|
||||
logger.Info("path", zap.String("path", r.URL.Path),
|
||||
zap.String("method", r.Method), zap.Any("header", r.Header))
|
||||
reqMsg, err := httputil.DumpRequest(r, false)
|
||||
if err != nil {
|
||||
logger.Error("error dumping request", zap.Error(err))
|
||||
}
|
||||
logger.Info("request dump", zap.String("request", string(reqMsg)))
|
||||
}
|
||||
return trace.StartOptions{
|
||||
Sampler: trace.ProbabilitySampler(tracingSamplingRate),
|
||||
|
||||
Reference in New Issue
Block a user