From 856318d933a0727a58f4fbab3918a31204173600 Mon Sep 17 00:00:00 2001 From: Gene Su Date: Wed, 11 Sep 2024 07:30:18 -0700 Subject: [PATCH] [Serve] fix component id logging field Signed-off-by: Gene Su --- python/ray/serve/_private/logging_utils.py | 2 +- python/ray/serve/tests/test_logging.py | 4 ++++ serve/serve_40797.log | 0 3 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 serve/serve_40797.log diff --git a/python/ray/serve/_private/logging_utils.py b/python/ray/serve/_private/logging_utils.py index 010428410636d..8308b056ccf7e 100644 --- a/python/ray/serve/_private/logging_utils.py +++ b/python/ray/serve/_private/logging_utils.py @@ -69,7 +69,7 @@ def filter(self, record: logging.LogRecord) -> bool: setattr(record, SERVE_LOG_COMPONENT, self.component_type) else: setattr(record, SERVE_LOG_COMPONENT, self.component_name) - setattr(record, SERVE_LOG_REPLICA, self.component_id) + setattr(record, SERVE_LOG_COMPONENT_ID, self.component_id) return True diff --git a/python/ray/serve/tests/test_logging.py b/python/ray/serve/tests/test_logging.py index 31b66685d3884..3c95d977dc76e 100644 --- a/python/ray/serve/tests/test_logging.py +++ b/python/ray/serve/tests/test_logging.py @@ -604,6 +604,10 @@ def format_and_verify_json_output(record, expected_record: dict): if is_replica_type_component: expected_json["deployment"] = "component" expected_json["replica"] = "component_id" + expected_json["component_name"] = "replica" + else: + expected_json["component_name"] = "component" + expected_json["component_id"] = "component_id" # Ensure message exists in the output. # Note that there is no "message" key in the record dict until it has been diff --git a/serve/serve_40797.log b/serve/serve_40797.log deleted file mode 100644 index e69de29bb2d1d..0000000000000