-
Notifications
You must be signed in to change notification settings - Fork 26
feat(dashboard): surface failing requests so admins see dropped traffic #449
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
base: main
Are you sure you want to change the base?
Changes from all commits
86180b1
0e225d8
df6ca14
1c364c6
48d2134
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,9 +219,28 @@ async def run_passthrough( | |
| and pricing_required_but_missing(pricing, require_pricing=config.require_pricing) | ||
| ): | ||
| await refund_reservation(db, reservation) | ||
| no_pricing_detail = no_pricing_error_detail(model) | ||
| # Record the rejection so dropped traffic is visible in the activity | ||
| # log and countable as an error, rather than only reaching the | ||
| # operator as a user complaint. cost stays null: nothing was spent. | ||
| await log_writer.put( | ||
| UsageLog( | ||
| id=str(uuid.uuid4()), | ||
| api_key_id=api_key_id, | ||
| user_id=user_id, | ||
| timestamp=datetime.now(UTC), | ||
| model=resolved.model, | ||
|
Member
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. Logs Not necessarily worth changing here, but the new tests do not pin it either (the chat test asserts the model string, the passthrough one does not), so asserting the expected embeddings model would at least record which form is intended. |
||
| provider=resolved.instance, | ||
| endpoint=endpoint, | ||
| status="error", | ||
| error_message=no_pricing_detail, | ||
| latency_ms=_elapsed_ms(started_at), | ||
| counts_toward_budget=not budget_exempt, | ||
| ) | ||
| ) | ||
| raise HTTPException( | ||
| status_code=status.HTTP_402_PAYMENT_REQUIRED, | ||
| detail=no_pricing_error_detail(model), | ||
| detail=no_pricing_detail, | ||
| ) | ||
|
|
||
| # Model access control (per-key). The reservation is already taken above (the | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
This is the third hand-built
UsageLogliteral in this file (also the success row at ~263 and the provider-error row at ~290), all eleven fields repeated. A local_usage_row(status, **overrides)helper would make the next field addition a one-line change instead of three sites to keep in sync.