Google Cloud SLO Alert Setup
Skill files5 files

references/

SKILL.md264 lines
1
---
2
name: google-cloud-slo-alert-configuration
3
metadata:
4
version: "1.0.2"
5
category: CloudObservabilityAndMonitoring
6
description: >-
7
Configures Cloud Monitoring PromQL-based Service Level Objective (SLO)
8
alerting policies on Google Cloud for resources registered in App Hub or
9
individually specified. Generates Terraform output.
10
Use when the user asks to configure an SLO or Service Level Objective.
11
Don't use for standard alerting policies.
12
---
13
14
# SLO Alert Configuration Setup Wizard
15
16
This skill guides the user through a structured conversation to configure Cloud
17
Monitoring PromQL-based Service Level Objective (SLO) alerting policies on
18
Google Cloud in Terraform. Your
19
role is to act as a setup wizard that conceptually models the 4 key components
20
of an SLO API (Service Scope, Service Level, SLI, and Alert Condition), gathers
21
the requirements, and outputs a Terraform configuration.
22
23
## Attribution
24
25
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
26
MUST read [Usage Attribution](references/attribution.md). For commands executed
27
directly in the terminal (never in generated scripts, Terraform, or user code),
28
prefix `gcloud` with
29
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:google-cloud-slo-alert-configuration)"`
30
and append `agent-skills/1.0 (skill:google-cloud-slo-alert-configuration)` to `User-Agent` headers.
31
32
## CRITICAL RULES
33
34
* **Structured Conversation**: You **MUST** follow the 4-step wizard workflow
35
below.
36
37
* **Gather Missing Information**: Evaluate all 4 steps below first. Ask the
38
user for all missing information across all steps in a single response.
39
40
- **DO NOT** stop after finding the first missing piece of information.
41
42
- **DO NOT** use the `ask_question` tool. You must ask questions using
43
plain text in your response and end your turn to wait for the user to
44
reply.
45
46
- **DO NOT** write the Terraform configuration if information is missing.
47
48
* **Skip What Is Known**: If the user has already provided information for a
49
step in their previous messages or initial prompt **DO NOT** ask them for
50
it. Move to the next missing piece of information. If ALL information for
51
Steps 1-4 is provided, call `write_to_file` to generate the Terraform
52
configuration without asking for permission to proceed.
53
54
* **Provide Best Practices**: Whenever you ask the user a question, you
55
**MUST** explicitly state the recommended "Best Practice".
56
57
* **Best Practice Shortcut**: If the user asks for "best practices" or
58
similar, do not overwrite their explicit inputs. **SKIP** all remaining data
59
gathering and keep any specific targets or custom metrics they provided. For
60
all fields left blank, apply the recommended defaults defined in the "SRE
61
Best Practice Suggestion" of each step.
62
63
* **User Labels**: Include a `user_labels` block in all
64
`google_monitoring_alert_policy` resources to track policies created by this
65
skill:
66
67
```terraform
68
user_labels = {
69
created-with-google-skill = "google-cloud-slo-alert-configuration"
70
}
71
```
72
73
* **Terraform Output**: Write the generated observability configuration ONLY
74
as Terraform (`.tf`) files using the `google_monitoring_alert_policy`
75
resource and `condition_prometheus_query_language` resources.
76
77
* **Alert Strategy**: **ALWAYS** include an `alert_strategy` block with an
78
`auto_close` setting. Leave `notification_channels` empty unless the user
79
provides one. Provide plain-English explanations of the PromQL math before
80
finalizing the conversation.
81
82
--------------------------------------------------------------------------------
83
84
## SETUP WIZARD WORKFLOW
85
86
### Step 1: Define `ServiceScope`
87
88
1. **Check Context**: Identify target resource, service, workload, or
89
application the user wants to monitor. If you already know, proceed.
90
Otherwise ask the user to identify it.
91
92
2. **Autonomous Investigation**: If the user specified a project or general
93
service name without providing specifics, autonomously use `gcloud` to
94
discover the target services in their environment. If multiple services or
95
workloads are discovered, list all of them and suggest applying SLO **ONLY**
96
to the most critical backend services as a best practice.
97
98
If you struggle to identify potential resources, ask the user to specify.
99
100
3. **Identify Underlying Infrastructure**: To resolve the correct PromQL
101
metric, you **MUST** know the underlying Google Cloud resource type.
102
103
* If the user only provides a logical name or an App Hub Service/Workload
104
name such as `projects/.../services/frontend` or
105
`projects/.../workloads/backend`, you still need to know the underlying
106
infrastructure.
107
* If the prompt provides the underlying infrastructure, use that
108
information. Do **NOT** attempt to discover it.
109
* If you don't know the underlying infrastructure but have a resource
110
identified, you **MUST** proactively use `gcloud` to discover the
111
infrastructure. If you struggle to identify the resource type, ask the
112
user to specify.
113
114
4. **Label Scoping**:
115
116
* If the user explicitly mentions the resource is in App Hub or provides
117
an App Hub URI like `projects/.../locations/.../applications/...`, use
118
App Hub labels and consult `references/app_hub_labels.md` to identify
119
the correct group-by fields.
120
* Otherwise, assume it is a standard Google Cloud resource and use
121
standard grouping labels such as `project_id, location, service_name`
122
for Cloud Run.
123
124
Example gcloud commands:
125
126
- `gcloud --quiet apphub applications services list --application=-
127
--location=-`
128
- `gcloud --quiet apphub applications workloads list --application=-
129
--location=-`
130
- `gcloud --quiet asset search-all-resources`
131
- `gcloud --quiet run services list`
132
- `gcloud --quiet apphub applications services describe <service>
133
--application=<app> --location=<loc>`
134
- `gcloud --quiet apphub applications workloads describe <workload>
135
--application=<app> --location=<loc>`
136
- `gcloud --quiet asset search-all-resources --query=<name>`
137
138
**Graceful Fallback:** If a command exits with an error such as API not
139
enabled or permission denied, **DO NOT** try to troubleshoot it and **DO
140
NOT** use the schedule tool to wait. Immediately fall back to asking the
141
user to provide the missing information.
142
143
### Step 2: Define `ServiceLevel` Target
144
145
1. **Check Context**: If the user has already provided a Service Level Target
146
percentage, an SLI condition/threshold, and a measurement period proceed to
147
the next step. Otherwise, if any are missing, you **MUST** ask for them.
148
- Service level target percentages include P-values such as PXX, decimals
149
such as 0.XX, and percentages like XX%.
150
151
- Example SLI conditions and thresholds include `latency < 500ms` or
152
`non-5XX responses`.
153
154
* **Prompt**: Ask the user for their target reliability, condition/threshold
155
(if applicable), measurement period, and evaluation intervals **ONLY** if
156
they are missing.
157
158
* **SRE Best Practice Suggestion**: "SRE Best Practice recommends starting
159
with a 99.9% (3 nines) `slo_target` measured over a rolling 28-day
160
`rolling_period`, as this aligns well with typical release cycles and
161
provides a reasonable error budget."
162
163
### Step 3: Define `ServiceLevelIndicator` / SLI
164
165
1. **Check Context**: Has the user specified the exact metric name such as
166
`run.googleapis.com/request_count`? If yes, proceed to the next step.
167
Otherwise, if the user only says "availability" or "latency" without
168
specifying the **EXACT** metric name, you may infer the name from the
169
service type provided a metric for that type is defined in the references.
170
If the user provides a custom metric and a threshold, assume it is a
171
Distribution metric and do not ask for further metric details.
172
173
- You **MUST** output valid metrics defined in
174
`references/service_metrics.md`. If the exact resource type and metric
175
is not listed, check the public documentation in
176
`references/service_metrics.md` to find the exact metric. If you still
177
cannot find it, you **MUST** stop and ask the user to provide the custom
178
metric.
179
180
2. **Prompt**: Ask the user what specific metric they want to use. You **MUST**
181
suggest the inferred standard metric as the recommended best practice. When
182
interpreting incomplete requests, you **MUST** explicitly propose the
183
specific metric string and describe the ratio-based or window-based
184
definition to the user for confirmation before proceeding.
185
186
3. **Metric Mapping**: Consult `references/service_metrics.md` to find the
187
exact PromQL metric string for the Resource Type identified in Step 1
188
section 3. If the requested metric type does not exist for the resource in
189
the references or the primary public documentation, you **MUST** explicitly
190
inform the user that there is no default metric and ask them to provide the
191
specific custom metric name. You **MUST** provide guidance on how a custom
192
latency metric might be structured.
193
194
- **CRITICAL:** If the primary documentation does not list a default
195
metric, you **MUST NOT** try to piece together advanced metrics. Ask the
196
user to provide the custom metric.
197
198
4. **Evaluation Method**: Default the `EvaluationType` to `REQUEST_BASED`
199
unless the user specifically describes a `window-based` requirement,
200
typically denoted by "good minutes" or "bad minutes".
201
202
* **Window-Based Lookback Period**: If the user indicates a window-based
203
evaluation, you need to know the duration of the lookback windows and
204
the evaluation interval for each window. You **MUST** ask the user to
205
specify both the lookback duration and the evaluation interval if they
206
have not already provided them. You **CANNOT** generate an alerting
207
policy without this configuration.
208
209
5. **SRE Best Practice Suggestion**: SRE Best Practice recommends starting with
210
two SLIs:
211
212
- **Availability**: a `Ratio SLI` comparing successful requests typically
213
defined as `non-5XX` responses, to total requests evaluated as
214
`REQUEST_BASED`.
215
- **Latency**: a `Distribution SLI` evaluated as `WINDOW_BASED` such as
216
99% of 5-minute windows must meet a 300ms threshold.
217
218
### Step 4: Define Alerting Policy
219
220
1. **Check Context**: Has the user specified burn rates? If yes, proceed to the
221
next step. Otherwise, ask the user to specify a burn rate strategy and
222
provide a best practice suggestion.
223
224
2. **SRE Best Practice Suggestion**: SRE Best Practice recommends both a
225
multi-window fast burn and multi-window slow burn.
226
227
- **Multi-Window Fast Burn**: Factor 14.4 over 1h and 5m windows, catching
228
severe outages quickly without false positives.
229
230
- **Multi-Window Slow Burn**: Factor 1 over 3d and 6h windows, catching
231
system degradation.
232
233
### Step 5: Generate Configuration
234
235
1. Look up the corresponding PromQL template from
236
`references/promql_templates.md` based on the user's choices. Use a
237
`Window-Based` template for window-based SLOs.
238
2. Populate the template with the `ServiceScope` labels, `ServiceLevel`
239
targets, and `ServiceLevelIndicator` metrics.
240
3. Wrap it in Terraform (`google_monitoring_alert_policy`), ensuring the
241
`user_labels` block includes `created-with-google-skill =
242
"google-cloud-slo-alert-configuration"`.
243
4. Present the `.tf` block with a plain English explanation of the math.
244
5. In the final summary, inform the user that the alert policies have been
245
tagged with the `created-with-google-skill =
246
"google-cloud-slo-alert-configuration"` user label to track policies created
247
by this skill.
248
6. **CRITICAL:** Explicitly warn the user in the final summary if no
249
notification channels are configured. Inform them that you can assist with
250
setting those up if they would like.
251
252
--------------------------------------------------------------------------------
253
254
## Supporting Links
255
256
* [Google SRE Workbook: Alerting on SLOs](https://sre.google/workbook/alerting-on-slos/)
257
* [Google Cloud Operations: SLO Monitoring](https://docs.cloud.google.com/stackdriver/docs/solutions/slo-monitoring.md.txt)
258
* [Prometheus: PromQL Basics](https://prometheus.io/docs/prometheus/latest/querying/basics/)
259
260
## Reporting Issues
261
262
Report bugs or improvements for this skill at
263
[Google Skills Issues](https://github.com/google/skills/issues).
264

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…