Skip to content

Commit

Permalink
[Serve] fix component id logging field (ray-project#47609)
Browse files Browse the repository at this point in the history
Re:
https://github.com/ray-project/ray/pull/46215/files#diff-7cdcb1bc84fb40e59bcec9c12e97178abb61f0cad81c1c3077b4911b68b0416fR71

In the previous PR I had a typo replaced `component_id` with `replica`
field name. TDD make sure this is captured in the test then fixed the
issue.

Signed-off-by: Gene Su <[email protected]>
Signed-off-by: ujjawal-khare <[email protected]>
  • Loading branch information
GeneDer authored and ujjawal-khare committed Oct 15, 2024
1 parent 84a900f commit 942105d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/ray/serve/_private/logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions python/ray/serve/tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,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
Expand Down

0 comments on commit 942105d

Please sign in to comment.