diff --git a/commerce_coordinator/apps/commercetools/clients.py b/commerce_coordinator/apps/commercetools/clients.py index 6991f551..5e7047a1 100644 --- a/commerce_coordinator/apps/commercetools/clients.py +++ b/commerce_coordinator/apps/commercetools/clients.py @@ -272,8 +272,8 @@ def get_orders(self, customer: CTCustomer, offset=0, ) end_time = datetime.datetime.now() logger.info( - "[UserOrdersView] Get CT orders query call finished at %s with total duration: %s", - end_time, end_time - start_time + "[UserOrdersView] Get CT orders query call finished at %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds() ) start_time = datetime.datetime.now() @@ -282,8 +282,8 @@ def get_orders(self, customer: CTCustomer, offset=0, result = PaginatedResult(values.results, values.total, values.offset) end_time = datetime.datetime.now() logger.info( - '[UserOrdersView] Pagination of CT orders finished at %s with total duration: %s', - end_time, end_time - start_time) + '[UserOrdersView] Pagination of CT orders finished at %s with total duration: %ss', + end_time, (end_time - start_time).total_seconds()) return result @@ -304,8 +304,8 @@ def get_orders_for_customer(self, edx_lms_user_id: int, offset=0, customer = self.get_customer_by_lms_user_id(edx_lms_user_id) end_time = datetime.datetime.now() logger.info( - "[UserOrdersView] For CT orders get customer id from lms id call finished at %s with total duration: %s", - end_time, end_time - start_time + "[UserOrdersView] For CT orders get customer id from lms id call finished at %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds() ) if customer is None: # pragma: no cover @@ -316,8 +316,8 @@ def get_orders_for_customer(self, edx_lms_user_id: int, offset=0, start_time) orders = self.get_orders(customer, offset, limit) end_time = datetime.datetime.now() - logger.info("[UserOrdersView] Get CT orders call finished at %s with total duration: %s", - end_time, end_time - start_time) + logger.info("[UserOrdersView] Get CT orders call finished at %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds()) return orders, customer diff --git a/commerce_coordinator/apps/commercetools/pipeline.py b/commerce_coordinator/apps/commercetools/pipeline.py index e7994a79..09c2ea29 100644 --- a/commerce_coordinator/apps/commercetools/pipeline.py +++ b/commerce_coordinator/apps/commercetools/pipeline.py @@ -69,8 +69,8 @@ def run_filter(self, request, params, order_data): # pylint: disable=arguments- for x in ct_orders[0].results] end_time = datetime.now() log.info( - "[UserOrdersView] CT orders to attrs objects processing finished at %s with total duration: %s", - end_time, end_time - start_time + "[UserOrdersView] CT orders to attrs objects processing finished at %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds() ) start_time = datetime.now() @@ -79,13 +79,13 @@ def run_filter(self, request, params, order_data): # pylint: disable=arguments- ct_orders[0].rebuild(converted_orders) ) end_time = datetime.now() - log.info("[UserOrdersView] CT orders rebuild call finished at %s with total duration: %s", - end_time, end_time - start_time) + log.info("[UserOrdersView] CT orders rebuild call finished at %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds()) method_end_time = datetime.now() log.info( - "[UserOrdersView] Completed CT pipeline step execution at %s with total duration: %s", - method_end_time, method_end_time - method_start_time + "[UserOrdersView] Completed CT pipeline step execution at %s with total duration: %ss", + method_end_time, (method_end_time - method_start_time).total_seconds() ) return { "order_data": order_data diff --git a/commerce_coordinator/apps/ecommerce/clients.py b/commerce_coordinator/apps/ecommerce/clients.py index 516a5e73..8f526719 100644 --- a/commerce_coordinator/apps/ecommerce/clients.py +++ b/commerce_coordinator/apps/ecommerce/clients.py @@ -44,8 +44,8 @@ def get_orders(self, query_params): response = self.client.get(resource_url, params=query_params) end_time = datetime.now() logger.info( - '[UserOrdersView] Legacy ecommerce get_orders API finished at: %s with total duration: %s', - end_time, end_time - start_time + '[UserOrdersView] Legacy ecommerce get_orders API finished at: %s with total duration: %ss', + end_time, (end_time - start_time).total_seconds() ) response.raise_for_status() self.log_request_response(logger, response) diff --git a/commerce_coordinator/apps/ecommerce/pipeline.py b/commerce_coordinator/apps/ecommerce/pipeline.py index 7de0c1d4..a7d9df85 100644 --- a/commerce_coordinator/apps/ecommerce/pipeline.py +++ b/commerce_coordinator/apps/ecommerce/pipeline.py @@ -55,8 +55,8 @@ def run_filter(self, request, params, order_data): # pylint: disable=arguments- end_time = datetime.now() log.info( - "[UserOrdersView] Completed Ecommerce pipeline step execution at %s with total duration: %s", - end_time, end_time - start_time) + "[UserOrdersView] Completed Ecommerce pipeline step execution at %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds()) return { "order_data": order_data } diff --git a/commerce_coordinator/apps/frontend_app_ecommerce/views.py b/commerce_coordinator/apps/frontend_app_ecommerce/views.py index b48c2d24..dca74a6f 100644 --- a/commerce_coordinator/apps/frontend_app_ecommerce/views.py +++ b/commerce_coordinator/apps/frontend_app_ecommerce/views.py @@ -99,8 +99,8 @@ def get(self, request): logger.info("[UserOrdersView] Pipline filter run started at: %s", start_time) order_data = OrderHistoryRequested.run_filter(request, params) end_time = datetime.now() - logger.info("[UserOrdersView] Pipline filter run finished at: %s with total duration: %s", - end_time, end_time - start_time) + logger.info("[UserOrdersView] Pipline filter run finished at: %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds()) output_orders = [] @@ -111,8 +111,8 @@ def get(self, request): end_time = datetime.now() logger.info( - "[UserOrdersView] Looping through combined orders results finished at: %s with total duration: %s", - end_time, end_time - start_time) + "[UserOrdersView] Looping through combined orders results finished at: %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds()) start_time = datetime.now() logger.info("[UserOrdersView] Sorting combined orders results for output starting at: %s", start_time) @@ -125,10 +125,10 @@ def get(self, request): end_time = datetime.now() logger.info( - "[UserOrdersView] Sorting combined orders results for output finished at: %s with total duration: %s", - end_time, end_time - start_time) + "[UserOrdersView] Sorting combined orders results for output finished at: %s with total duration: %ss", + end_time, (end_time - start_time).total_seconds()) request_end_time = datetime.now() - logger.info("[UserOrdersView] GET method finished at: %s with total duration: %s", request_end_time, - request_end_time - request_start_time) + logger.info("[UserOrdersView] GET method finished at: %s with total duration: %ss", request_end_time, + (request_end_time - request_start_time).total_seconds()) return Response(output)