-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add INFO request-lifecycle logging skeleton and rebalance levels #435 #454
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
df9583c
feat: add INFO request-lifecycle logging skeleton and rebalance level…
ypldan 1a62d19
Merge branch 'development' into feat/435-operational-logging-skeleton
ypldan 220e8b9
fix: demote REST tool-error log to DEBUG per ownership rule #435
ypldan a944886
Merge branch 'development' into feat/435-operational-logging-skeleton
ypldan 5644b2f
fix: address PR #454 review — single-line tool failure, config-fail s…
ypldan 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| """Formatting for the INFO request-lifecycle skeleton (design #434, issue #435). | ||
|
|
||
| The request skeleton is written as a stable message ``prefix`` followed by | ||
| ``key=value`` fields rather than free prose, so later work — JSON output (#438) | ||
| and request-scoped ids (#439) — can lift the same fields into structured | ||
| attributes without rewording the events. | ||
|
|
||
| Only structural metadata belongs in these records (roles, counts, sizes, | ||
| durations, names, ids, statuses); never message bodies, tool-call arguments, or | ||
| other payload content (the content rule, delivered by #436). | ||
| """ | ||
|
|
||
| from collections.abc import Mapping | ||
| from typing import Any | ||
|
|
||
|
|
||
| def _render(value: Any) -> str: | ||
| if isinstance(value, Mapping): | ||
| return "{" + ", ".join(f"{k}: {v}" for k, v in value.items()) + "}" | ||
| if isinstance(value, (list, tuple, set)): | ||
| return "[" + ", ".join(str(v) for v in value) + "]" | ||
| return str(value) | ||
|
|
||
|
|
||
| def format_event(prefix: str, **fields: Any) -> str: | ||
| """Render a lifecycle event as ``"<prefix>: key=value, ..."``. | ||
|
|
||
| Fields whose value is ``None`` are omitted, so callers can pass optional | ||
| fields (e.g. token usage) unconditionally. Lists and maps render as | ||
| structure (``[a, b]`` / ``{k: v}``) — the login result map is structure, | ||
| not content. | ||
| """ | ||
| parts = [f"{key}={_render(value)}" for key, value in fields.items() if value is not None] | ||
| return f"{prefix}: {', '.join(parts)}" if parts else prefix | ||
|
|
||
|
|
||
| def format_duration(seconds: float) -> str: | ||
| """Format an elapsed duration for a lifecycle field (e.g. ``2.10s``).""" | ||
| return f"{seconds:.2f}s" |
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.