Cloud Run Alert Configuration
GoogleOfficialPublished by Google
- Skill
- Workflow
- Cloud and DevOps
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a standardized approach to configuring high-signal alerting policies for Google Cloud Run resources. By leveraging Terraform and PromQL, it enables developers and SREs to implement observability based on seasoned SRE practices. It covers HTTP services, batch jobs, and worker pools, ensuring that critical metrics like error rates, latency, and saturation are monitored effectively. The skill emphasizes parameterization, mandatory labeling for governance, and adherence to specific lookback and duration rules for Cloud Monitoring.
What it does
- Generates Terraform HCL code for Google Cloud Monitoring alert policies.
- Applies SRE-based best practices for monitoring Cloud Run services, jobs, and worker pools.
- Configures PromQL queries for error rates, latency, saturation, and execution status.
- Enforces mandatory user labels for alert policy governance.
- Provides a fast-path workflow for users who specify resource names in their prompt.
- Includes logic for handling PromQL duration rules based on lookback windows.
When to use it
- When you need to set up production-grade alerting for Cloud Run resources.
- When you want to define monitoring policies as code using Terraform.
- When you need to implement specific SRE alerting patterns for HTTP services or batch jobs.
- When you require consistent alerting configurations across multiple Cloud Run environments.
Advantages
- Reduces configuration errors by using standardized, SRE-vetted templates.
- Ensures consistent observability across different Cloud Run workload types.
- Promotes infrastructure-as-code practices for monitoring policies.
- Simplifies the creation of complex PromQL queries for Cloud Monitoring.
- Supports centralized metrics scoping via parameterized project variables.
Usage examples
- “Generate a Terraform alert policy for my Cloud Run service named 'api-gateway' to monitor 5xx error rates.”
- The agent generates a complete Terraform resource block for the 'api-gateway' service, including the PromQL query for 5xx errors, mandatory labels, and alert strategy settings.
- “Create an alert policy for a Cloud Run job called 'nightly-sync' that pages immediately on failure.”
- The agent provides a Terraform configuration using a 0s duration PromQL query to trigger an immediate alert upon any failed execution of the 'nightly-sync' job.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/google/cloud-run-alert-configuration/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cloud-run-alert-configuration.zip -d .agents/skills
Documentation by Google
Cloud Run Alert Configuration
Production-grade observability for Cloud Run using Terraform and PromQL (Cloud Monitoring). Grounded in SRE practices, this skill focuses strictly on actionable user impact and scaling bounds.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:cloud-run-alert-configuration)"
and append agent-skills/1.0 (skill:cloud-run-alert-configuration) to User-Agent headers.
CRITICAL RULES
Prompt-First Fast Path (Skip Discovery When Named):
If the user prompt explicitly specifies the target Cloud Run service, job, or worker pool name (e.g.,
'video-encoder','nightly-reconciliation','web-frontend','catalog-service','api-gateway','order-processor'), SKIP all workspace.tffile scanning (find_by_name,code_search,list_dir) andgcloudCLI discovery commands entirely.Do NOT run
gcloud,terraform, or file search tools when the target name is already provided in the prompt. Instead, parameterize the project ID (variable "scoping_project_id" { default = "my-gcp-project" }) and target resource name in Terraform variables and proceed immediately to Step 2 (Configure Alerts).
Autonomous Discovery (Only When Target Name is Omitted):
Never Scan Root Monorepo or Unbounded Directories: Never run
find_by_nameorlsacross root workspace directories.Config First: Only if the prompt omits the resource name, check
.tffiles in the immediate working directory forgoogle_cloud_run_v2_service,google_cloud_run_service, orgoogle_cloud_run_v2_job.CLI Second (Graceful Fallback): Only if unconfigured in prompt or local
.tffiles, attemptgcloud config get-value projectandgcloud run services list. If anygcloudcommand fails (e.g., auth or metadata errors) orterraformis missing, immediately stop running CLI commands and output parameterized HCL using explicit variable defaults.
Workload Routing: Always classify the workload target and follow its specific reference guide:
For HTTP Services follow services.md
For Cloud Run Jobs follow jobs.md
For Worker Pools follow worker_pools.md
Explicit Defaults & User Overrides:
Always use explicit defaults for all constants specified in the target workload's reference file (SLO targets, latency thresholds, SLAs, saturation ceilings, rate guards).
State the defaults being applied in the final summary output and clearly notify the user that any default constant can be customized or overridden via Terraform variables or prompt input.
Metric Scope Centralization: Parameterize
project = var.scoping_project_idin all Terraformgoogle_monitoring_alert_policyresources so the policy can target either a single project or a centralized Cloud Monitoring Metrics Scope.PromQL
duration(Retest Window) Rules:Lookbacks $\le$ 25h: Set
duration = "300s"(5m buffer) to absorb transient blips and scale-up lag (except immediate job failure alerts which useduration = "0s").Lookbacks $> 25$h (e.g. 3d/7d Slow Burn): Omit
durationentirely (or set to0s). Cloud Monitoring rejects PromQL queries withdurationset on lookbacks >25h (INVALID_ARGUMENT).
Terraform Standards & Mandatory Labels:
Output clean, complete
.tfconfigurations usinggoogle_monitoring_alert_policyandcondition_prometheus_query_languagedirectly in your response.Mandatory User Labels: Every
google_monitoring_alert_policyresource MUST include auser_labelsblock containing:user_labels = { created-with-google-skill = "cloud-run-alert-configuration" }Include
alert_strategy { auto_close = "604800s" }and parameterizenotification_channels = var.notification_channels.
WORKFLOW STEPS
1. Discovery & Target Identification
Fast Path (Target Named in Prompt): If the user prompt names the target Cloud Run service, job, or worker pool, skip all discovery commands and file searches and proceed directly to Step 2.
Discovery Fallback (Target Unnamed): Only if no resource name is provided in the prompt, check local
.tffiles or rungcloudto identify the target workload type and name. Ifgcloudauth fails, fall back immediately to default Terraform variables (var.scoping_project_id).
2. Configure Alerts
Route to the corresponding guide to generate the alert policies:
HTTP Services: Open services.md. Apply the requested alerting policy or standard suite covering availability SLOs (5xx), request latency (P95/P99), client errors (4xx), container instance saturation, container CPU/memory utilization, traffic anomalies (drop/surge), and billable instance time.
Batch Jobs: Open jobs.md. Apply immediate job execution failure alerts (
duration = "0s").Worker Pools: Open worker_pools.md. Apply the 4-policy standard suite (Task Success SLO Fast/Slow Burn, Backlog ETD, Message Age SLA).
3. Terraform Generation & Review
Provide the complete HCL configuration in your response with explicitly parameterized defaults and the mandatory
user_labelsblock (created-with-google-skill = "cloud-run-alert-configuration").State the applied defaults and remind the user of their ability to override any constant.
Provide a clear plain-English breakdown of the PromQL logic and triggering thresholds.
Additional Resources
Files
- ATTRIBUTION.mdAdded by AutoGineer876 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md7.3 KiB
- references/attribution.md1.9 KiB
- references/jobs.md3.3 KiB
- references/services.md28.0 KiB
- references/worker_pools.md12.0 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/cloud-run-alert-configuration · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cloud-run-alert-configuration.zip