-
Notifications
You must be signed in to change notification settings - Fork 281
feat(account selection) Add relative availability routing strategy #507
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
faac125
Add relative availability routing strategy
egusev 7028d5e
Add relative availability selection logs
egusev 31aeb0f
Expose app logs through root logger
egusev 15de6e9
Honor relative availability tuning in sticky fallback
egusev a0cbd19
Reduce relative availability candidate log level
egusev a114c72
Merge remote-tracking branch 'origin/main' into rel_strategy
Komzpa 23516c6
Merge remote-tracking branch 'origin/main' into rel_strategy
Komzpa 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
68 changes: 68 additions & 0 deletions
68
app/db/alembic/versions/20260426_000000_add_dashboard_relative_availability_settings.py
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,68 @@ | ||
| """add relative availability routing settings to dashboard_settings | ||
|
|
||
| Revision ID: 20260426_000000_add_dashboard_relative_availability_settings | ||
| Revises: 20260423_120000_add_api_key_limit_reset_at_index | ||
| Create Date: 2026-04-26 | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
| from sqlalchemy.engine import Connection | ||
|
|
||
| revision = "20260426_000000_add_dashboard_relative_availability_settings" | ||
| down_revision = "20260423_120000_add_api_key_limit_reset_at_index" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def _columns(connection: Connection, table_name: str) -> set[str]: | ||
| inspector = sa.inspect(connection) | ||
| if not inspector.has_table(table_name): | ||
| return set() | ||
| return {str(column["name"]) for column in inspector.get_columns(table_name) if column.get("name") is not None} | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "dashboard_settings") | ||
| if not columns: | ||
| return | ||
|
|
||
| if "relative_availability_power" not in columns: | ||
| with op.batch_alter_table("dashboard_settings") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column( | ||
| "relative_availability_power", | ||
| sa.Float(), | ||
| nullable=False, | ||
| server_default="2.0", | ||
| ) | ||
| ) | ||
|
|
||
| if "relative_availability_top_k" not in columns: | ||
| with op.batch_alter_table("dashboard_settings") as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column( | ||
| "relative_availability_top_k", | ||
| sa.Integer(), | ||
| nullable=False, | ||
| server_default="5", | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| bind = op.get_bind() | ||
| columns = _columns(bind, "dashboard_settings") | ||
| if not columns: | ||
| return | ||
|
|
||
| if "relative_availability_top_k" in columns: | ||
| with op.batch_alter_table("dashboard_settings") as batch_op: | ||
| batch_op.drop_column("relative_availability_top_k") | ||
|
|
||
| if "relative_availability_power" in columns: | ||
| with op.batch_alter_table("dashboard_settings") as batch_op: | ||
| batch_op.drop_column("relative_availability_power") |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
state.emailas the primary routing label causes INFO diagnostics to log raw email addresses for candidate scoring, top-k selection, and winner selection. In deployments that ship logs off-host, this introduces unnecessary PII exposure compared with using stable internal account IDs (or a redacted/hash form), and the change affects every relative-availability routing decision.Useful? React with 👍 / 👎.