Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
feat(gateway): give a 503 serving refusal its own admission outcome (#493)
Krisztian Gajdar39a1aa95289b
diff --git a/packages/sie_gateway/src/observability/metrics.rs b/packages/sie_gateway/src/observability/metrics.rsindex 3c905e411..64ea40a88 100644--- a/packages/sie_gateway/src/observability/metrics.rs+++ b/packages/sie_gateway/src/observability/metrics.rs@@ -168,6 +168,11 @@ pub enum AdmissionOutcome {AuthMisconfigured,RegionMismatch,LicenseExcluded,+ /// A deployment's `ModelAccessPolicy::serving_refusal` declined to serve+ /// the resolved model for now and answered 503. Distinct from+ /// `AuthMisconfigured`: the request authenticated, and the refusal is a+ /// retryable serving state rather than a broken credential setup.+ ServingUnavailable,PayloadTooLarge,/// A policy gate refused the request because it could not read the field it/// gates on — e.g. a `multipart/form-data` inference body whose `model`@@ -189,6 +194,7 @@ impl AdmissionOutcome {Self::AuthMisconfigured => "auth_misconfigured",Self::RegionMismatch => "region_mismatch",Self::LicenseExcluded => "license_excluded",+ Self::ServingUnavailable => "serving_unavailable",Self::PayloadTooLarge => "payload_too_large",Self::InvalidRequest => "invalid_request",Self::InsufficientCredits => "insufficient_credits",@@ -2259,6 +2265,70 @@ mod tests {(telemetry, exporter, provider)}+ fn every_admission_outcome() -> [AdmissionOutcome; 12] {+ use AdmissionOutcome::*;+ // A new variant fails to compile here until it is listed below.+ let _exhaustive = |outcome: AdmissionOutcome| match outcome {+ Admitted+ | Unauthenticated+ | Forbidden+ | AuthMisconfigured+ | RegionMismatch+ | LicenseExcluded+ | ServingUnavailable+ | PayloadTooLarge+ | InvalidRequest+ | InsufficientCredits+ | KeySpendLimitExceeded+ | RateLimited => (),+ };+ [+ Admitted,+ Unauthenticated,+ Forbidden,+ AuthMisconfigured,+ RegionMismatch,+ LicenseExcluded,+ ServingUnavailable,+ PayloadTooLarge,+ InvalidRequest,+ InsufficientCredits,+ KeySpendLimitExceeded,+ RateLimited,+ ]+ }++ #[test]+ fn every_admission_outcome_is_declared_in_the_telemetry_contract() {+ let contract: serde_yaml::Value = serde_yaml::from_str(include_str!(concat!(+ env!("CARGO_MANIFEST_DIR"),+ "/../../telemetry/contract.yaml"+ )))+ .expect("telemetry contract parses");+ let declared: HashSet<&str> = contract["enums"]["admission_outcome"]+ .as_sequence()+ .expect("admission_outcome is a contract enum")+ .iter()+ .map(|value| value.as_str().expect("enum values are strings"))+ .collect();+ for outcome in every_admission_outcome() {+ assert!(+ declared.contains(outcome.as_str()),+ "{} is missing from enums.admission_outcome in telemetry/contract.yaml",+ outcome.as_str()+ );+ }+ }++ #[test]+ fn every_admission_outcome_exports_a_distinct_label() {+ let labels: HashSet<&str> = every_admission_outcome()+ .into_iter()+ .map(AdmissionOutcome::as_str)+ .collect();+ assert_eq!(labels.len(), every_admission_outcome().len());+ }+#[test]fn unsupported_model_route_exclusions_export_one_attribute_free_counter() {assert!(!record_unsupported_model_route_exclusion_to(None));diff --git a/packages/sie_gateway/src/server.rs b/packages/sie_gateway/src/server.rsindex a276fedbb..06f70332d 100644--- a/packages/sie_gateway/src/server.rs+++ b/packages/sie_gateway/src/server.rs@@ -77,7 +77,10 @@ pub trait ModelAccessPolicy: Send + Sync {////// `ext` carries the request extensions, so an implementation can record the/// refusal on whatever per-request observability slot the deployment- /// installed. Consulted AFTER `visible`, so a caller who may not see the+ /// installed. A refusal answered 503 records+ /// [`AdmissionOutcome::ServingUnavailable`](crate::observability::metrics::AdmissionOutcome::ServingUnavailable),+ /// so a temporary refusal is not counted as an authentication fault.+ /// Consulted AFTER `visible`, so a caller who may not see the/// model has already been answered the not-found shape and this refusal can/// never become a cross-tenant existence oracle. The default returns `None`,/// so the OSS self-host build refuses nothing.diff --git a/telemetry/contract.yaml b/telemetry/contract.yamlindex d5e6c77a7..75301203d 100644--- a/telemetry/contract.yaml+++ b/telemetry/contract.yaml@@ -755,7 +755,9 @@ enums:- auth_misconfigured- region_mismatch- license_excluded+ - serving_unavailable- payload_too_large+ - invalid_request- insufficient_credits- key_spend_limit_exceeded- rate_limited