diff --git a/frontend/pkg/frontend/frontend.go b/frontend/pkg/frontend/frontend.go index be65055db..fe0235719 100644 --- a/frontend/pkg/frontend/frontend.go +++ b/frontend/pkg/frontend/frontend.go @@ -155,8 +155,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 @@ -290,8 +288,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) @@ -350,8 +346,6 @@ func (f *Frontend) ArmResourceCreateOrUpdate(writer http.ResponseWriter, request return } - logger.Info(fmt.Sprintf("%s: ArmResourceCreateOrUpdate", versionedInterface)) - doc, err := f.dbClient.GetResourceDoc(ctx, resourceID) if err != nil && !errors.Is(err, database.ErrNotFound) { logger.Error(err.Error()) @@ -563,13 +557,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()) @@ -577,8 +564,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 @@ -623,18 +608,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) } @@ -869,13 +842,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()) @@ -883,8 +849,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()) @@ -974,8 +938,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_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())