@@ -27,36 +27,33 @@ class AvailabilityOutcome(StrEnum):
2727
2828
2929class AvailabilityReason (StrEnum ):
30- # Values overlapping PrometheusRejectionReason are kept identical so the
31- # availability counter and the rejection counter reconcile on shared strings.
32- # Keep them in sync if a rejection reason is added.
33- # success
34- CLEAN_COMPLETION = "clean_completion"
35- # failure
36- UPSTREAM_ERROR = "upstream_error"
37- EMPTY_RESPONSE = "empty_response"
38- # excluded (policy rejections)
39- BUDGET_EXCEEDED = "budget_exceeded"
40- RATE_LIMITED_OWN = "rate_limited_own"
41- RATE_LIMITED_UPSTREAM = "rate_limited_upstream"
42- PAYLOAD_TOO_LARGE = "payload_too_large"
43- INVALID_MODEL_NAME = "invalid_model_name"
44- INVALID_REQUEST = "invalid_request"
45- # abort
46- CLIENT_DISCONNECT = "client_disconnect"
47- # pre-completion (auth dependency and route body, before the completion path)
48- # excluded
49- AUTH_REJECTED = "auth_rejected"
50- INVALID_AUTH_REQUEST = "invalid_auth_request"
51- INVALID_SERVICE_TYPE_FOR_MODEL = "invalid_service_type_for_model"
52- SIGNUP_CAP_EXCEEDED = "signup_cap_exceeded"
53- BLOCKED = "blocked"
54- # failure
55- PROVISIONING_FAILURE = "provisioning_failure"
56- # Defined but not emitted yet: auth backends normalize system failures to 401
57- # (indistinguishable from expected rejections), so capturing this is left to a
58- # follow-on auth backend change that surfaces a real disposition.
59- AUTH_SYSTEM_FAILURE = "auth_system_failure"
30+ # Strings shared with PrometheusRejectionReason are kept identical so the
31+ # two counters reconcile. Keep them in sync when a rejection reason is added.
32+
33+ # --- completion-stage reasons (recorded inside stream_completion / get_completion) ---
34+ CLEAN_COMPLETION = "clean_completion" # success
35+ UPSTREAM_ERROR = "upstream_error" # failure
36+ EMPTY_RESPONSE = "empty_response" # failure
37+ BUDGET_EXCEEDED = "budget_exceeded" # excluded
38+ RATE_LIMITED_OWN = "rate_limited_own" # excluded
39+ RATE_LIMITED_UPSTREAM = "rate_limited_upstream" # excluded
40+ PAYLOAD_TOO_LARGE = "payload_too_large" # excluded
41+ INVALID_MODEL_NAME = "invalid_model_name" # excluded
42+ INVALID_REQUEST = "invalid_request" # excluded
43+ CLIENT_DISCONNECT = "client_disconnect" # abort
44+
45+ # --- pre-completion reasons (recorded in the auth dependency and route body) ---
46+ AUTH_REJECTED = "auth_rejected" # excluded
47+ INVALID_AUTH_REQUEST = "invalid_auth_request" # excluded
48+ INVALID_SERVICE_TYPE_FOR_MODEL = "invalid_service_type_for_model" # excluded
49+ SIGNUP_CAP_EXCEEDED = "signup_cap_exceeded" # excluded
50+ BLOCKED = "blocked" # excluded
51+ PROVISIONING_FAILURE = "provisioning_failure" # failure
52+
53+ # Defined but not yet emitted: auth backends normalize system failures to 401,
54+ # making them indistinguishable from expected rejections. Capturing this
55+ # properly requires a follow-on change to the auth backends themselves.
56+ AUTH_SYSTEM_FAILURE = "auth_system_failure" # failure
6057
6158
6259_AVAILABILITY_OUTCOME_BY_REASON : dict [AvailabilityReason , AvailabilityOutcome ] = {
0 commit comments