fix(usage): derive API key last-used and bound stream memory#126
Closed
mojomast wants to merge 1 commit intofollowup/pr125-db-hardeningfrom
Closed
fix(usage): derive API key last-used and bound stream memory#126mojomast wants to merge 1 commit intofollowup/pr125-db-hardeningfrom
mojomast wants to merge 1 commit intofollowup/pr125-db-hardeningfrom
Conversation
Collaborator
Author
|
Superseded by updates pushed to #123 to keep all MVP changes in one review thread. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
last_used_ataccurate in user/UI key listings by deriving fromMAX(usage_events.timestamp)per key instead of relying on stale nullable column writes/ui/meAPI key tableStreamUsageTrackermetadata tracking for usage attribution and loggingVerification
PYTHONPATH=src .venv/bin/python -m py_compile src/proxy_app/usage_queries.py src/proxy_app/routers/user_api.py src/proxy_app/routers/ui.py src/proxy_app/stream_usage.py src/proxy_app/main.py tests/test_api_keys.py tests/test_stream_usage.pyPYTHONPATH=src .venv/bin/pytest -q tests/test_api_keys.py tests/test_stream_usage.py tests/test_usage_attribution.pyImportant
Improve API key last-used tracking and stream memory management with
StreamUsageTrackerand derived timestamps.last_used_atfor API keys fromMAX(usage_events.timestamp)instead of a nullable column./ui/meAPI key table.StreamUsageTrackerfor metadata tracking instream_usage.py.fetch_api_key_last_used_map()inusage_queries.pyto derive last-used timestamps.streaming_response_wrapper()inmain.pyto useStreamUsageTracker.me.htmlto show derived last-used timestamps.test_list_api_keys_uses_derived_last_used_timestamp()intest_api_keys.py.test_stream_usage_tracker_keeps_only_minimal_metadata()intest_stream_usage.py.This description was created by
for 5fd3f9a. You can customize this summary. It will automatically update as commits are pushed.