-
Notifications
You must be signed in to change notification settings - Fork 742
[Feature] add traceback to error logs and optimize trace log #7608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xyxinyang
wants to merge
1
commit into
PaddlePaddle:develop
Choose a base branch
from
xyxinyang:dev-log-v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,8 @@ | |
| from fastdeploy.engine.request import Request | ||
| from fastdeploy.inter_communicator import EngineCacheQueue, IPCSignal, PrefixTreeStatus | ||
| from fastdeploy.metrics.metrics import main_process_metrics | ||
| from fastdeploy.trace.constants import LoggingEventName | ||
| from fastdeploy.trace.trace_logger import print as trace_print | ||
| from fastdeploy.utils import get_hash_str, get_logger | ||
|
|
||
| logger = get_logger("prefix_cache_manager", "cache_manager.log") | ||
|
|
@@ -624,6 +626,8 @@ def _prepare_cpu_cache( | |
|
|
||
| assert len(need_transfer_task_gpu_block_ids) == len(need_transfer_task_cpu_block_ids) | ||
| logger.info(f"request_block_ids: req_id {req_id} issue_swap_task transfer_task_id {transfer_task_id}") | ||
| # Record CACHE_SWAP_IN trace event (CPU -> GPU) | ||
| trace_print(LoggingEventName.CACHE_SWAP_IN, req_id, None) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ 疑问 如果 |
||
| self.issue_swap_task( | ||
| transfer_task_id, | ||
| swap_node_ids, | ||
|
|
@@ -915,7 +919,9 @@ def request_match_blocks(self, task: Request, block_size, *args): | |
| f"request_match_blocks: an error occurred while prefix tree status is not normal, ignore it. {e}" | ||
| ) | ||
| else: | ||
| logger.error(f"request_match_blocks: request_block_ids: error: {type(e)} {e}") | ||
| logger.error( | ||
| f"request_match_blocks: request_block_ids: error: {type(e)} {e}, {traceback.format_exc()}" | ||
| ) | ||
| raise e | ||
|
|
||
| def request_block_ids(self, task, block_size, dec_token_num, *args): | ||
|
|
@@ -999,6 +1005,11 @@ def request_block_ids(self, task, block_size, dec_token_num, *args): | |
| # 3. update metrics | ||
| if matched_block_num > 0: | ||
| self.metrics.hit_req_count += 1 | ||
| # Record CACHE_HIT trace event | ||
| trace_print(LoggingEventName.CACHE_HIT, req_id, None) | ||
| else: | ||
| # Record CACHE_MISS trace event | ||
| trace_print(LoggingEventName.CACHE_MISS, req_id, None) | ||
| self.metrics.calculate_hit_metrics( | ||
| req_id, | ||
| cpu_match_token_num, | ||
|
|
@@ -1317,7 +1328,7 @@ def free_nodes_directly(self, node): | |
| f"free_nodes_directly: an error occurred while prefix tree status is not normal, ignore it. {e}" | ||
| ) | ||
| else: | ||
| logger.error(f"free_nodes_directly: error: {type(e)} {e}") | ||
| logger.error(f"free_nodes_directly: error: {type(e)} {e}, {traceback.format_exc()}") | ||
| raise e | ||
|
|
||
| def _handle_free_gpu_node_without_cpu(self, node): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.