From 86e037e0fa11480d53a0facaa778aada2e0b4e53 Mon Sep 17 00:00:00 2001 From: ImMin5 Date: Fri, 13 Dec 2024 15:02:09 +0900 Subject: [PATCH] feat: modify log format, add response time Signed-off-by: ImMin5 --- src/spaceone/core/service/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/spaceone/core/service/__init__.py b/src/spaceone/core/service/__init__.py index 4336bb9..aaec253 100644 --- a/src/spaceone/core/service/__init__.py +++ b/src/spaceone/core/service/__init__.py @@ -1,6 +1,7 @@ +import copy import functools import logging -import copy +import time from typing import Generator, Union, Literal from opentelemetry import trace @@ -181,6 +182,8 @@ def _pipeline( try: with _TRACER.start_as_current_span("PreProcessing"): + start_time = time.time() + # 1. Event - Start if event_handler_state: for handler in get_event_handlers(): @@ -239,7 +242,9 @@ def _pipeline( # 9. Print Response Info Log if print_info_log: - _LOGGER.info(f"(RESPONSE) => SUCCESS") + + process_time = time.time() - start_time + _LOGGER.info(f"(RESPONSE) => SUCCESS (Time = {process_time:.2f}s)") return response_or_iterator