diff --git a/frontend/pkg/frontend/frontend.go b/frontend/pkg/frontend/frontend.go index 8d5f28e51..f62e0150e 100644 --- a/frontend/pkg/frontend/frontend.go +++ b/frontend/pkg/frontend/frontend.go @@ -156,8 +156,6 @@ func (f *Frontend) ArmResourceList(writer http.ResponseWriter, request *http.Req return } - logger.Info(fmt.Sprintf("%s: ArmResourceList", versionedInterface)) - var pageSizeHint int32 = 20 var continuationToken *string var pagedResponse arm.PagedResponse @@ -330,8 +328,6 @@ func (f *Frontend) ArmResourceRead(writer http.ResponseWriter, request *http.Req return } - logger.Info(fmt.Sprintf("%s: ArmResourceRead", versionedInterface)) - responseBody, cloudError := f.MarshalResource(ctx, resourceID, versionedInterface) if cloudError != nil { arm.WriteCloudError(writer, cloudError) @@ -594,13 +590,6 @@ func (f *Frontend) ArmResourceDelete(writer http.ResponseWriter, request *http.R ctx := request.Context() logger := LoggerFromContext(ctx) - versionedInterface, err := VersionFromContext(ctx) - if err != nil { - logger.Error(err.Error()) - arm.WriteInternalServerError(writer) - return - } - resourceID, err := ResourceIDFromContext(ctx) if err != nil { logger.Error(err.Error()) @@ -608,8 +597,6 @@ func (f *Frontend) ArmResourceDelete(writer http.ResponseWriter, request *http.R return } - logger.Info(fmt.Sprintf("%s: ArmResourceDelete", versionedInterface)) - resourceDoc, err := f.dbClient.GetResourceDoc(ctx, resourceID) if err != nil { // For resource not found errors on deletion, ARM requires @@ -654,18 +641,6 @@ func (f *Frontend) ArmResourceDelete(writer http.ResponseWriter, request *http.R } func (f *Frontend) ArmResourceAction(writer http.ResponseWriter, request *http.Request) { - ctx := request.Context() - logger := LoggerFromContext(ctx) - - versionedInterface, err := VersionFromContext(ctx) - if err != nil { - logger.Error(err.Error()) - arm.WriteInternalServerError(writer) - return - } - - logger.Info(fmt.Sprintf("%s: ArmResourceAction", versionedInterface)) - writer.WriteHeader(http.StatusOK) } @@ -900,13 +875,6 @@ func (f *Frontend) OperationStatus(writer http.ResponseWriter, request *http.Req ctx := request.Context() logger := LoggerFromContext(ctx) - versionedInterface, err := VersionFromContext(ctx) - if err != nil { - logger.Error(err.Error()) - writer.WriteHeader(http.StatusInternalServerError) - return - } - resourceID, err := ResourceIDFromContext(ctx) if err != nil { logger.Error(err.Error()) @@ -914,8 +882,6 @@ func (f *Frontend) OperationStatus(writer http.ResponseWriter, request *http.Req return } - logger.Info(fmt.Sprintf("%s: OperationStatus", versionedInterface)) - doc, err := f.dbClient.GetOperationDoc(ctx, resourceID.Name) if err != nil { logger.Error(err.Error()) @@ -1005,8 +971,6 @@ func (f *Frontend) OperationResult(writer http.ResponseWriter, request *http.Req return } - logger.Info(fmt.Sprintf("%s: OperationResult", versionedInterface)) - doc, err := f.dbClient.GetOperationDoc(ctx, resourceID.Name) if err != nil { logger.Error(err.Error()) diff --git a/frontend/pkg/frontend/middleware_logging.go b/frontend/pkg/frontend/middleware_logging.go index 6173eede3..93b826fc4 100644 --- a/frontend/pkg/frontend/middleware_logging.go +++ b/frontend/pkg/frontend/middleware_logging.go @@ -57,6 +57,7 @@ func MiddlewareLogging(w http.ResponseWriter, r *http.Request, next http.Handler "request_method", r.Method, "request_path", r.URL.Path, "request_proto", r.Proto, + "request_query", r.URL.RawQuery, "request_remote_addr", r.RemoteAddr, "request_user_agent", r.UserAgent()) diff --git a/frontend/pkg/frontend/middleware_validateapi.go b/frontend/pkg/frontend/middleware_validateapi.go index f96b6c96b..e0bbd2449 100644 --- a/frontend/pkg/frontend/middleware_validateapi.go +++ b/frontend/pkg/frontend/middleware_validateapi.go @@ -11,6 +11,9 @@ import ( ) func MiddlewareValidateAPIVersion(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { + ctx := r.Context() + logger := LoggerFromContext(ctx) + apiVersion := r.URL.Query().Get(APIVersionKey) if apiVersion == "" { arm.WriteError( @@ -26,7 +29,9 @@ func MiddlewareValidateAPIVersion(w http.ResponseWriter, r *http.Request, next h api.ClusterResourceType, apiVersion) } else { - ctx := ContextWithVersion(r.Context(), version) + logger = logger.With("api_version", apiVersion) + ctx = ContextWithLogger(ctx, logger) + ctx = ContextWithVersion(ctx, version) r = r.WithContext(ctx) next(w, r) } diff --git a/frontend/pkg/frontend/node_pool.go b/frontend/pkg/frontend/node_pool.go index 6e3c6bb6b..75f156c6e 100644 --- a/frontend/pkg/frontend/node_pool.go +++ b/frontend/pkg/frontend/node_pool.go @@ -57,8 +57,6 @@ func (f *Frontend) CreateOrUpdateNodePool(writer http.ResponseWriter, request *h return } - logger.Info(fmt.Sprintf("%s: CreateNodePool", versionedInterface)) - doc, err := f.dbClient.GetResourceDoc(ctx, resourceID) if err != nil && !errors.Is(err, database.ErrNotFound) { logger.Error(err.Error())