Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)22k · #10247

cloud-run-alert-configuration

Skill này làm gì

Skill này tạo quy tắc cảnh báo Terraform cho Cloud Run để các đội nhận được thông báo khi có vấn đề ảnh hưởng đến người dùng. Skill dành cho kỹ sư muốn có cảnh báo hữu ích mà không gây nhiễu.

Khi nào nên dùng

  • ✓Khi bạn muốn cảnh báo cho tỷ lệ lỗi, độ trễ hoặc độ bão hòa container của Cloud Run.
  • ✓Khi bạn cần chính sách cảnh báo Terraform cho một dịch vụ, job hoặc worker pool Cloud Run có tên cụ thể.
  • ✓Khi bạn muốn rà soát hoặc cải thiện các cảnh báo Cloud Run bạn đã có.

Liên kết skill

https://github.com/google/skills/blob/main/skills/cloud/cloud-run-alert-configuration/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/google/skills/blob/main/skills/cloud/cloud-run-alert-configuration/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Viết cảnh báo Terraform cho dịch vụ Cloud Run video-encoder của tôi để tôi biết khi lỗi hoặc yêu cầu chậm ảnh hưởng đến người dùng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill dùng các quy tắc cảnh báo PromQL dựa trên thực hành SRE, tập trung vào tác động đến người dùng và giới hạn mở rộng. Khi bạn nêu tên dịch vụ, skill bỏ qua việc tìm trong file và viết Terraform trực tiếp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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 .tf file scanning (find_by_name, code_search, list_dir) and gcloud CLI 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_name or ls across root workspace directories.
    • Config First: Only if the prompt omits the resource name, check .tf files in the immediate working directory for google_cloud_run_v2_service, google_cloud_run_service, or google_cloud_run_v2_job.
    • CLI Second (Graceful Fallback): Only if unconfigured in prompt or local .tf files, attempt gcloud config get-value project and gcloud run services list. If any gcloud command fails (e.g., auth or metadata errors) or terraform is 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:
  • 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_id in all Terraform google_monitoring_alert_policy resources 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 use duration = "0s").
    • Lookbacks $> 25$h (e.g. 3d/7d Slow Burn): Omit duration entirely (or set to 0s). Cloud Monitoring rejects PromQL queries with duration set on lookbacks >25h (INVALID_ARGUMENT).
  • Terraform Standards & Mandatory Labels:
    • Output clean, complete .tf configurations using google_monitoring_alert_policy and condition_prometheus_query_language directly in your response.
    • Mandatory User Labels: Every google_monitoring_alert_policy resource MUST include a user_labels block containing:
      user_labels = {
        created-with-google-skill = "cloud-run-alert-configuration"
      }
      
    • Include alert_strategy { auto_close = "604800s" } and parameterize notification_channels = var.notification_channels.

WORKFLOW STEPS

1. Discovery & Target Identification

  • **Fast Path (Target Named in Prompt)
Câu hỏi thường gặp

Skill có tìm trong mã của tôi khi tôi nêu tên dịch vụ không?

Không. Skill chỉ tìm dịch vụ khi tên bị thiếu trong yêu cầu của bạn.

Skill bao gồm những tài nguyên Cloud Run nào?

Dịch vụ, job và worker pool.

Skill có triển khai cảnh báo không?

Skill viết các chính sách Terraform để bạn xem lại và triển khai.

Chi tiết

Mô tả gốc của tác giả

Configures best-practice, high-signal alerting policies for Cloud Run resources on Google Cloud (services, jobs, and worker pools) based on seasoned SRE practices. Use when analyzing, recommending, writing, or deploying Terraform PromQL alerting policies to monitor Cloud Run error rates (4xx/5xx), request latency, container instance saturation (warning/critical), container CPU/memory utilization and allocation, billable instance time, job execution status, and worker pool queue backlog. Don't use for GKE workloads (use gke-alert-configuration) or Compute Engine VMs.

repo: google/skills

Độ phổ biến

Sao GitHub
22k
Vị trí xếp hạng
#10247
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự