Skip to content

Commit b6c67d7

Browse files
committed
Add ARM throttling dashboards for FXCI subscriptions
1 parent 2a75c23 commit b6c67d7

5 files changed

Lines changed: 225 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module "arm_subscription_throttling_dashboard" {
2+
source = "../azure_modules/arm_subscription_throttling_dashboard"
3+
4+
resource_group_id = azurerm_resource_group.rg-central-us-runbooks.id
5+
location = azurerm_resource_group.rg-central-us-runbooks.location
6+
subscription_id = "108d46d5-fe9b-4850-9a7d-8c914aa6c1f0"
7+
subscription_display_name = "FXCI Azure DevTest Subscription"
8+
dashboard_name = "arm-throttle-fxci"
9+
dashboard_display_name = "FXCI ARM Throttling"
10+
tags = local.common_tags
11+
}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
terraform {
2+
required_providers {
3+
azapi = {
4+
source = "azure/azapi"
5+
}
6+
}
7+
}
8+
9+
locals {
10+
subscription_resource_id = "/subscriptions/${var.subscription_id}"
11+
12+
overview_markdown = <<-MARKDOWN
13+
## ${var.dashboard_display_name}
14+
This dashboard is the shared entry point for Azure Resource Manager subscription throttling in ${var.subscription_display_name}.
15+
16+
- Subscription resource: `${local.subscription_resource_id}`
17+
- Start with the `Traffic` metric and add `StatusCode = 429`.
18+
- High-signal filters for the current FXCI issue: `Namespace = MICROSOFT.RESOURCES`, `OperationType = write`.
19+
- Click a chart to open Metrics explorer and split or filter by `RequestRegion`, `Namespace`, or `OperationType`.
20+
MARKDOWN
21+
22+
drilldown_markdown = <<-MARKDOWN
23+
### How to confirm subscription bucket pressure
24+
1. Re-run a failing `az` command with `--debug`.
25+
2. Capture the `429` response and inspect `x-ms-ratelimit-remaining-subscription-reads` or `x-ms-ratelimit-remaining-subscription-writes`.
26+
3. If those headers are near `0`, the general ARM subscription bucket is being exhausted.
27+
28+
Docs:
29+
- [Monitor Azure Resource Manager](https://learn.microsoft.com/azure/azure-resource-manager/management/monitor-resource-manager)
30+
- [Understand how Azure Resource Manager throttles requests](https://learn.microsoft.com/azure/azure-resource-manager/management/request-limits-and-throttling)
31+
MARKDOWN
32+
}
33+
34+
resource "azapi_resource" "this" {
35+
type = "Microsoft.Portal/dashboards@2020-09-01-preview"
36+
name = var.dashboard_name
37+
parent_id = var.resource_group_id
38+
location = var.location
39+
schema_validation_enabled = false
40+
41+
tags = merge(
42+
var.tags,
43+
{
44+
Name = var.dashboard_name
45+
"hidden-title" = var.dashboard_display_name
46+
}
47+
)
48+
49+
body = {
50+
properties = {
51+
lenses = [
52+
{
53+
order = 0
54+
parts = [
55+
{
56+
position = {
57+
x = 0
58+
y = 0
59+
rowSpan = 3
60+
colSpan = 11
61+
}
62+
metadata = {
63+
inputs = []
64+
type = "Extension/HubsExtension/PartType/MarkdownPart"
65+
settings = {
66+
content = {
67+
settings = {
68+
content = local.overview_markdown
69+
title = var.dashboard_display_name
70+
subtitle = "Azure Resource Manager subscription throttling"
71+
}
72+
}
73+
}
74+
}
75+
},
76+
{
77+
position = {
78+
x = 0
79+
y = 3
80+
rowSpan = 4
81+
colSpan = 6
82+
}
83+
metadata = {
84+
inputs = [
85+
{
86+
name = "queryInputs"
87+
value = {
88+
timespan = {
89+
duration = var.metric_timespan
90+
}
91+
id = local.subscription_resource_id
92+
chartType = 0
93+
metrics = [
94+
{
95+
name = "Traffic"
96+
resourceId = local.subscription_resource_id
97+
}
98+
]
99+
}
100+
}
101+
]
102+
type = "Extension/Microsoft_Azure_Monitoring/PartType/MetricsChartPart"
103+
}
104+
},
105+
{
106+
position = {
107+
x = 6
108+
y = 3
109+
rowSpan = 4
110+
colSpan = 5
111+
}
112+
metadata = {
113+
inputs = [
114+
{
115+
name = "queryInputs"
116+
value = {
117+
timespan = {
118+
duration = var.metric_timespan
119+
}
120+
id = local.subscription_resource_id
121+
chartType = 0
122+
metrics = [
123+
{
124+
name = "Latency"
125+
resourceId = local.subscription_resource_id
126+
}
127+
]
128+
}
129+
}
130+
]
131+
type = "Extension/Microsoft_Azure_Monitoring/PartType/MetricsChartPart"
132+
}
133+
},
134+
{
135+
position = {
136+
x = 0
137+
y = 7
138+
rowSpan = 5
139+
colSpan = 11
140+
}
141+
metadata = {
142+
inputs = []
143+
type = "Extension/HubsExtension/PartType/MarkdownPart"
144+
settings = {
145+
content = {
146+
settings = {
147+
content = local.drilldown_markdown
148+
title = "Operational notes"
149+
}
150+
}
151+
}
152+
}
153+
}
154+
]
155+
}
156+
]
157+
}
158+
}
159+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "dashboard_id" {
2+
description = "Resource ID for the Azure Portal dashboard."
3+
value = azapi_resource.this.id
4+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
variable "dashboard_display_name" {
2+
description = "Portal display name for the dashboard."
3+
type = string
4+
}
5+
6+
variable "dashboard_name" {
7+
description = "Azure resource name for the dashboard."
8+
type = string
9+
}
10+
11+
variable "location" {
12+
description = "Azure region where the dashboard resource will live."
13+
type = string
14+
}
15+
16+
variable "metric_timespan" {
17+
description = "Default timespan for dashboard metrics."
18+
type = string
19+
default = "P7D"
20+
}
21+
22+
variable "resource_group_id" {
23+
description = "Resource group resource ID used as the dashboard parent."
24+
type = string
25+
}
26+
27+
variable "subscription_display_name" {
28+
description = "Human-readable subscription name shown in dashboard markdown."
29+
type = string
30+
}
31+
32+
variable "subscription_id" {
33+
description = "Subscription GUID for the monitored Azure subscription."
34+
type = string
35+
}
36+
37+
variable "tags" {
38+
description = "Tags applied to the dashboard resource."
39+
type = map(string)
40+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module "arm_subscription_throttling_dashboard" {
2+
source = "../azure_modules/arm_subscription_throttling_dashboard"
3+
4+
resource_group_id = azurerm_resource_group.rg-central-us-trusted-runbooks.id
5+
location = azurerm_resource_group.rg-central-us-trusted-runbooks.location
6+
subscription_id = "a30e97ab-734a-4f3b-a0e4-c51c0bff0701"
7+
subscription_display_name = "Trusted FXCI Azure DevTest Subscription"
8+
dashboard_name = "arm-throttle-tfxci"
9+
dashboard_display_name = "Trusted FXCI ARM Throttling"
10+
tags = local.common_tags
11+
}

0 commit comments

Comments
 (0)