From 810df4cd0644508f370a1caed981916d43598ef7 Mon Sep 17 00:00:00 2001 From: Greeshma Date: Mon, 20 Apr 2026 19:22:12 +0530 Subject: [PATCH 1/2] APPS-12973: Update spec to include request metrics for autoscaling and alerts --- .../apps/models/app_alert_spec_rule.yml | 2 ++ .../apps/models/app_autoscaling_spec.yml | 35 +++++++++++++++++++ .../models/app_autoscaling_spec_service.yml | 28 +++++++++++++++ .../models/app_component_instance_base.yml | 33 ----------------- .../resources/apps/models/app_job_spec.yml | 3 ++ .../apps/models/app_service_spec.yml | 3 ++ .../resources/apps/models/app_worker_spec.yml | 3 ++ 7 files changed, 74 insertions(+), 33 deletions(-) create mode 100644 specification/resources/apps/models/app_autoscaling_spec.yml create mode 100644 specification/resources/apps/models/app_autoscaling_spec_service.yml diff --git a/specification/resources/apps/models/app_alert_spec_rule.yml b/specification/resources/apps/models/app_alert_spec_rule.yml index ea5199744..d407aa2af 100644 --- a/specification/resources/apps/models/app_alert_spec_rule.yml +++ b/specification/resources/apps/models/app_alert_spec_rule.yml @@ -16,5 +16,7 @@ enum: - FUNCTIONS_AVERAGE_WAIT_TIME_MS - FUNCTIONS_ERROR_COUNT - FUNCTIONS_GB_RATE_PER_SECOND + - REQUESTS_PER_SECOND + - REQUEST_DURATION_P95_MS type: string example: CPU_UTILIZATION diff --git a/specification/resources/apps/models/app_autoscaling_spec.yml b/specification/resources/apps/models/app_autoscaling_spec.yml new file mode 100644 index 000000000..e2dbbd0ea --- /dev/null +++ b/specification/resources/apps/models/app_autoscaling_spec.yml @@ -0,0 +1,35 @@ +# Autoscaling for workers and jobs (CPU only). Services use app_autoscaling_spec_service.yml instead. +description: Configuration for automatically scaling this component based on metrics. +type: object +properties: + min_instance_count: + description: The minimum amount of instances for this component. + type: integer + format: uint32 + minimum: 1 + example: 2 + max_instance_count: + description: >- + The maximum amount of instances for this component. Maximum 250. + Consider using a larger instance size if your application requires more than 250 instances. + type: integer + format: uint32 + minimum: 1 + maximum: 250 + example: 3 + metrics: + description: The metrics that the component is scaled on. + type: object + properties: + cpu: + description: Settings for scaling the component based on CPU utilization. + type: object + properties: + percent: + description: The average target CPU utilization for the component. + type: integer + format: uint32 + minimum: 1 + maximum: 100 + default: 80 + example: 75 diff --git a/specification/resources/apps/models/app_autoscaling_spec_service.yml b/specification/resources/apps/models/app_autoscaling_spec_service.yml new file mode 100644 index 000000000..f35f72f4b --- /dev/null +++ b/specification/resources/apps/models/app_autoscaling_spec_service.yml @@ -0,0 +1,28 @@ +# Extends CPU autoscaling with request-based metrics. Only applicable to service components. +allOf: + - $ref: app_autoscaling_spec.yml + - type: object + properties: + metrics: + type: object + properties: + requests_per_second: + description: Settings for scaling the component based on requests per second. + type: object + properties: + per_instance: + description: The target number of requests per second per instance for the component. + type: integer + format: uint32 + minimum: 1 + example: 100 + request_duration: + description: Settings for scaling the component based on request duration. + type: object + properties: + p95_milliseconds: + description: The p95 target request duration in milliseconds for the component. + type: integer + format: uint32 + minimum: 1 + example: 500 diff --git a/specification/resources/apps/models/app_component_instance_base.yml b/specification/resources/apps/models/app_component_instance_base.yml index 541bbdbf4..88a2a51c2 100644 --- a/specification/resources/apps/models/app_component_instance_base.yml +++ b/specification/resources/apps/models/app_component_instance_base.yml @@ -50,36 +50,3 @@ properties: example: basic-xxs deprecated: true example: apps-s-1vcpu-0.5gb - - autoscaling: - description: Configuration for automatically scaling this component based on metrics. - type: object - properties: - min_instance_count: - description: The minimum amount of instances for this component. Must be less than max_instance_count. - type: integer - format: uint32 - minimum: 1 - example: 2 - max_instance_count: - description: The maximum amount of instances for this component. Must be more than min_instance_count. - type: integer - format: uint32 - minimum: 1 - example: 3 - metrics: - description: The metrics that the component is scaled on. - type: object - properties: - cpu: - description: Settings for scaling the component based on CPU utilization. - type: object - properties: - percent: - description: The average target CPU utilization for the component. - type: integer - format: uint32 - minimum: 1 - maximum: 100 - default: 80 - example: 75 diff --git a/specification/resources/apps/models/app_job_spec.yml b/specification/resources/apps/models/app_job_spec.yml index c47ad17f4..50319eb70 100755 --- a/specification/resources/apps/models/app_job_spec.yml +++ b/specification/resources/apps/models/app_job_spec.yml @@ -4,6 +4,9 @@ allOf: - type: object properties: + autoscaling: + $ref: app_autoscaling_spec.yml + kind: type: string enum: diff --git a/specification/resources/apps/models/app_service_spec.yml b/specification/resources/apps/models/app_service_spec.yml index 8ecc4ccfb..3e570c5fa 100755 --- a/specification/resources/apps/models/app_service_spec.yml +++ b/specification/resources/apps/models/app_service_spec.yml @@ -4,6 +4,9 @@ allOf: - type: object properties: + autoscaling: + $ref: app_autoscaling_spec_service.yml + cors: allOf: - $ref: apps_cors_policy.yml diff --git a/specification/resources/apps/models/app_worker_spec.yml b/specification/resources/apps/models/app_worker_spec.yml index 84a460ec7..6cf4f27b2 100755 --- a/specification/resources/apps/models/app_worker_spec.yml +++ b/specification/resources/apps/models/app_worker_spec.yml @@ -3,6 +3,9 @@ allOf: - $ref: app_component_instance_base.yml - type: object properties: + autoscaling: + $ref: app_autoscaling_spec.yml + termination: $ref: app_worker_spec_termination.yml liveness_health_check: From 2495789cfdfaa25e913d122f792fb4ae7eab6e80 Mon Sep 17 00:00:00 2001 From: Greeshma Date: Wed, 22 Apr 2026 16:39:38 +0530 Subject: [PATCH 2/2] remove autoscaling from job component type --- specification/resources/apps/models/app_autoscaling_spec.yml | 2 +- specification/resources/apps/models/app_job_spec.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/specification/resources/apps/models/app_autoscaling_spec.yml b/specification/resources/apps/models/app_autoscaling_spec.yml index e2dbbd0ea..bfc3633f0 100644 --- a/specification/resources/apps/models/app_autoscaling_spec.yml +++ b/specification/resources/apps/models/app_autoscaling_spec.yml @@ -1,4 +1,4 @@ -# Autoscaling for workers and jobs (CPU only). Services use app_autoscaling_spec_service.yml instead. +# CPU-only autoscaling for worker components. Services use app_autoscaling_spec_service.yml. description: Configuration for automatically scaling this component based on metrics. type: object properties: diff --git a/specification/resources/apps/models/app_job_spec.yml b/specification/resources/apps/models/app_job_spec.yml index 50319eb70..c47ad17f4 100755 --- a/specification/resources/apps/models/app_job_spec.yml +++ b/specification/resources/apps/models/app_job_spec.yml @@ -4,9 +4,6 @@ allOf: - type: object properties: - autoscaling: - $ref: app_autoscaling_spec.yml - kind: type: string enum: