Skip to content

Commit

Permalink
[CES-196] Added wallet gate0 scaling profile (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-calabrese authored Oct 14, 2024
1 parent 0c9f8da commit 4a9b45e
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/domains/functions/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cidr_subnet_services = ["10.0.139.0/26", "10.0.139.64/26"]
function_services_kind = "Linux"
function_services_sku_tier = "PremiumV3"
function_services_sku_size = "P1v3"
function_services_autoscale_minimum = 6
function_services_autoscale_minimum = 3
function_services_autoscale_maximum = 30
function_services_autoscale_default = 10

Expand Down
104 changes: 104 additions & 0 deletions src/domains/functions/function_services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,110 @@ resource "azurerm_monitor_autoscale_setting" "function_services_autoscale" {
}
}
}

profile {
name = "wallet_gate0"

capacity {
default = var.function_services_autoscale_default
minimum = 6
maximum = var.function_services_autoscale_maximum
}

fixed_date {
timezone = "W. Europe Standard Time"
start = "2024-10-15T08:00:00.000Z"
end = "2024-10-15T23:30:00.000Z"
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.function_services[count.index].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 3000
divide_by_instance_count = true
}

scale_action {
direction = "Increase"
type = "ChangeCount"
value = "2"
cooldown = "PT1M"
}
}

rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.function_services[count.index].app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 40
divide_by_instance_count = false
}

scale_action {
direction = "Increase"
type = "ChangeCount"
value = "3"
cooldown = "PT2M"
}
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.function_services[count.index].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 300
divide_by_instance_count = true
}

scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "1"
cooldown = "PT1M"
}
}

rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.function_services[count.index].app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 15
divide_by_instance_count = false
}

scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "1"
cooldown = "PT2M"
}
}
}
}

# Cosmos container for subscription cidrs
Expand Down

0 comments on commit 4a9b45e

Please sign in to comment.