Skip to content
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

[CES-196] Added wallet gate0 scaling profile #1241

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading