{"data":{"slug":"github-google-skills-skills-cloud-google-cloud-slo-alert-configuration-f1e3f0d478c3","title":"Configure SLO Alerting Policies on Google Cloud with Terraform","summary":"This skill guides users through configuring Service Level Objective (SLO) alerting policies on Google Cloud using Terraform. It ensures accurate PromQL-based monitoring for resources registered in App Hub or specified individually, and generates Terraform output.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-google-cloud-slo-alert-configuration-f1e3f0d478c3","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-google-cloud-slo-alert-configuration-f1e3f0d478c3","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-google-cloud-slo-alert-configuration-f1e3f0d478c3.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-google-cloud-slo-alert-configuration-f1e3f0d478c3\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before executing any `gcloud`, REST API, or MCP command, you MUST read [Usage Attribution](references\/attribution.md). For commands executed directly in the terminal, prefix `gcloud` with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:google-cloud-slo-alert-configuration)\"` and append `agent-skills\/1.0 (skill:google-cloud-slo-alert-configuration)` to `User-Agent` headers.","instructions":"---\nname: google-cloud-slo-alert-configuration\nmetadata:\n  version: \"1.0.2\"\n  category: CloudObservabilityAndMonitoring\ndescription: >-\n  Configures Cloud Monitoring PromQL-based Service Level Objective (SLO)\n  alerting policies on Google Cloud for resources registered in App Hub or\n  individually specified. Generates Terraform output.\n  Use when the user asks to configure an SLO or Service Level Objective.\n  Don't use for standard alerting policies.\n---\n\n# SLO Alert Configuration Setup Wizard\n\nThis skill guides the user through a structured conversation to configure Cloud\nMonitoring PromQL-based Service Level Objective (SLO) alerting policies on\nGoogle Cloud in Terraform. Your\nrole is to act as a setup wizard that conceptually models the 4 key components\nof an SLO API (Service Scope, Service Level, SLI, and Alert Condition), gathers\nthe requirements, and outputs a Terraform configuration.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\/attribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:google-cloud-slo-alert-configuration)\"`\nand append `agent-skills\/1.0 (skill:google-cloud-slo-alert-configuration)` to `User-Agent` headers.\n\n## CRITICAL RULES\n\n*   **Structured Conversation**: You **MUST** follow the 4-step wizard workflow\n    below.\n\n*   **Gather Missing Information**: Evaluate all 4 steps below first. Ask the\n    user for all missing information across all steps in a single response.\n\n    -   **DO NOT** stop after finding the first missing piece of information.\n\n    -   **DO NOT** use the `ask_question` tool. You must ask questions using\n        plain text in your response and end your turn to wait for the user to\n        reply.\n\n    -   **DO NOT** write the Terraform configuration if information is missing.\n\n*   **Skip What Is Known**: If the user has already provided information for a\n    step in their previous messages or initial prompt **DO NOT** ask them for\n    it. Move to the next missing piece of information. If ALL information for\n    Steps 1-4 is provided, call `write_to_file` to generate the Terraform\n    configuration without asking for permission to proceed.\n\n*   **Provide Best Practices**: Whenever you ask the user a question, you\n    **MUST** explicitly state the recommended \"Best Practice\".\n\n*   **Best Practice Shortcut**: If the user asks for \"best practices\" or\n    similar, do not overwrite their explicit inputs. **SKIP** all remaining data\n    gathering and keep any specific targets or custom metrics they provided. For\n    all fields left blank, apply the recommended defaults defined in the \"SRE\n    Best Practice Suggestion\" of each step.\n\n*   **User Labels**: Include a `user_labels` block in all\n    `google_monitoring_alert_policy` resources to track policies created by this\n    skill:\n\n    ```terraform\n    user_labels = {\n      created-with-google-skill = \"google-cloud-slo-alert-configuration\"\n    }\n    ```\n\n*   **Terraform Output**: Write the generated observability configuration ONLY\n    as Terraform (`.tf`) files using the `google_monitoring_alert_policy`\n    resource and `condition_prometheus_query_language` resources.\n\n*   **Alert Strategy**: **ALWAYS** include an `alert_strategy` block with an\n    `auto_close` setting. Leave `notification_channels` empty unless the user\n    provides one. Provide plain-English explanations of the PromQL math before\n    finalizing the conversation.\n\n--------------------------------------------------------------------------------\n\n## SETUP WIZARD WORKFLOW\n\n### Step 1: Define `ServiceScope`\n\n1.  **Check Context**: Identify target resource, service, workload, or\n    application the user wants to monitor. If you already know, proceed.\n    Otherwise ask the user to identify it.\n\n2.  **Autonomous Investigation**: If the user specified a project or general\n    service name without providing specifics, autonomously use `gcloud` to\n    discover the target services in their environment. If multiple services or\n    workloads are discovered, list all of them and suggest applying SLO **ONLY**\n    to the most critical backend services as a best practice.\n\n    If you struggle to identify potential resources, ask the user to specify.\n\n3.  **Identify Underlying Infrastructure**: To resolve the correct PromQL\n    metric, you **MUST** know the underlying Google Cloud resource type.\n\n    *   If the user only provides a logical name or an App Hub Service\/Workload\n        name such as `projects\/...\/services\/frontend` or\n        `projects\/...\/workloads\/backend`, you still need to know the underlying\n        infrastructure.\n    *   If the prompt provides the underlying infrastructure, use that\n        information. Do **NOT** attempt to discover it.\n    *   If you don't know the underlying infrastructure but have a resource\n        identified, you **MUST** proactively use `gcloud` to discover the\n        infrastructure. If you struggle to identify the resource type, ask the\n        user to specify.\n\n4.  **Label Scoping**:\n\n    *   If the user explicitly mentions the resource is in App Hub or provides\n        an App Hub URI like `projects\/...\/locations\/...\/applications\/...`, use\n        App Hub labels and consult `references\/app_hub_labels.md` to identify\n        the correct group-by fields.\n    *   Otherwise, assume it is a standard Google Cloud resource and use\n        standard grouping labels such as `project_id, location, service_name`\n        for Cloud Run.\n\n    Example gcloud commands:\n\n    -   `gcloud --quiet apphub applications services list --application=-\n        --location=-`\n    -   `gcloud --quiet apphub applications workloads list --application=-\n        --location=-`\n    -   `gcloud --quiet asset search-all-resources`\n    -   `gcloud --quiet run services list`\n    -   `gcloud --quiet apphub applications services describe <service>\n        --application=<app> --location=<loc>`\n    -   `gcloud --quiet apphub applications workloads describe <workload>\n        --application=<app> --location=<loc>`\n    -   `gcloud --quiet asset search-all-resources --query=<name>`\n\n    **Graceful Fallback:** If a command exits with an error such as API not\n    enabled or permission denied, **DO NOT** try to troubleshoot it and **DO\n    NOT** use the schedule tool to wait. Immediately fall back to asking the\n    user to provide the missing information.\n\n### Step 2: Define `ServiceLevel` Target\n\n1.  **Check Context**: If the user has already provided a Service Level Target\n    percentage, an SLI condition\/threshold, and a measurement period proceed to\n    the next step. Otherwise, if any are missing, you **MUST** ask for them.\n    -   Service level target percentages include P-values such as PXX, decimals\n        such as 0.XX, and percentages like XX%.\n\n    -   Example SLI conditions and thresholds include `latency < 500ms` or\n        `non-5XX responses`.\n\n*   **Prompt**: Ask the user for their target reliability, condition\/threshold\n    (if applicable), measurement period, and evaluation intervals **ONLY** if\n    they are missing.\n\n*   **SRE Best Practice Suggestion**: \"SRE Best Practice recommends starting\n    with a 99.9% (3 nines) `slo_target` measured over a rolling 28-day\n    `rolling_period`, as this aligns well with typical release cycles and\n    provides a reasonable error budget.\"\n\n### Step 3: Define `ServiceLevelIndicator` \/ SLI\n\n1.  **Check Context**: Has the user specified the exact metric name such as\n    `run.googleapis.com\/request_count`? If yes, proceed to the next step.\n    Otherwise, if the user only says \"availability\" or \"latency\" without\n    specifying the **EXACT** metric name, you may infer the name from the\n    service type provided a metric for that type is defined in the references.\n    If the user provides a custom metric and a threshold, assume it is a\n    Distribution metric and do not ask for further metric details.\n\n    -   You **MUST** output valid metrics defined in\n        `references\/service_metrics.md`. If the exact resource type and metric\n        is not listed, check the public documentation in\n        `references\/service_metrics.md` to find the exact metric. If you still\n        cannot find it, you **MUST** stop and ask the user to provide the custom\n        metric.\n\n2.  **Prompt**: Ask the user what specific metric they want to use. You **MUST**\n    suggest the inferred standard metric as the recommended best practice. When\n    interpreting incomplete requests, you **MUST** explicitly propose the\n    specific metric string and describe the ratio-based or window-based\n    definition to the user for confirmation before proceeding.\n\n3.  **Metric Mapping**: Consult `references\/service_metrics.md` to find the\n    exact PromQL metric string for the Resource Type identified in Step 1\n    section 3. If the requested metric type does not exist for the resource in\n    the references or the primary public documentation, you **MUST** explicitly\n    inform the user that there is no default metric and ask them to provide the\n    specific custom metric name. You **MUST** provide guidance on how a custom\n    latency metric might be structured.\n\n    -   **CRITICAL:** If the primary documentation does not list a default\n        metric, you **MUST NOT** try to piece together advanced metrics. Ask the\n        user to provide the custom metric.\n\n4.  **Evaluation Method**: Default the `EvaluationType` to `REQUEST_BASED`\n    unless the user specifically describes a `window-based` requirement,\n    typically denoted by \"good minutes\" or \"bad minutes\".\n\n    *   **Window-Based Lookback Period**: If the user indicates a window-based\n        evaluation, you need to know the duration of the lookback windows and\n        the evaluation interval for each window. You **MUST** ask the user to\n        specify both the lookback duration and the evaluation interval if they\n        have not already provided them. You **CANNOT** generate an alerting\n        policy without this configuration.\n\n5.  **SRE Best Practice Suggestion**: SRE Best Practice recommends starting with\n    two SLIs:\n\n    -   **Availability**: a `Ratio SLI` comparing successful requests typically\n        defined as `non-5XX` responses, to total requests evaluated as\n        `REQUEST_BASED`.\n    -   **Latency**: a `Distribution SLI` evaluated as `WINDOW_BASED` such as\n        99% of 5-minute windows must meet a 300ms threshold.\n\n### Step 4: Define Alerting Policy\n\n1.  **Check Context**: Has the user specified burn rates? If yes, proceed to the\n    next step. Otherwise, ask the user to specify a burn rate strategy and\n    provide a best practice suggestion.\n\n2.  **SRE Best Practice Suggestion**: SRE Best Practice recommends both a\n    multi-window fast burn and multi-window slow burn.\n\n    -   **Multi-Window Fast Burn**: Factor 14.4 over 1h and 5m windows, catching\n        severe outages quickly without false positives.\n\n    -   **Multi-Window Slow Burn**: Factor 1 over 3d and 6h windows, catching\n        system degradation.\n\n### Step 5: Generate Configuration\n\n1.  Look up the corresponding PromQL template from\n    `references\/promql_templates.md` based on the user's choices. Use a\n    `Window-Based` template for window-based SLOs.\n2.  Populate the template with the `ServiceScope` labels, `ServiceLevel`\n    targets, and `ServiceLevelIndicator` metrics.\n3.  Wrap it in Terraform (`google_monitoring_alert_policy`), ensuring the\n    `user_labels` block includes `created-with-google-skill =\n    \"google-cloud-slo-alert-configuration\"`.\n4.  Present the `.tf` block with a plain English explanation of the math.\n5.  In the final summary, inform the user that the alert policies have been\n    tagged with the `created-with-google-skill =\n    \"google-cloud-slo-alert-configuration\"` user label to track policies created\n    by this skill.\n6.  **CRITICAL:** Explicitly warn the user in the final summary if no\n    notification channels are configured. Inform them that you can assist with\n    setting those up if they would like.\n\n--------------------------------------------------------------------------------\n\n## Supporting Links\n\n*   [Google SRE Workbook: Alerting on SLOs](https:\/\/sre.google\/workbook\/alerting-on-slos\/)\n*   [Google Cloud Operations: SLO Monitoring](https:\/\/docs.cloud.google.com\/stackdriver\/docs\/solutions\/slo-monitoring.md.txt)\n*   [Prometheus: PromQL Basics](https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/basics\/)\n\n## Reporting Issues\n\nReport bugs or improvements for this skill at\n[Google Skills Issues](https:\/\/github.com\/google\/skills\/issues).\n","use_cases":["Setting up SLO alerting policies for a backend service in App Hub","Creating SLO-based alerts for a custom metric with a defined threshold","Monitoring service reliability with a 99.9% target over a 28-day period"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/cloud\/google-cloud-slo-alert-configuration\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T17:35:36.000000Z","updated_at":"2026-11-17T15:28:10.000000Z","seo_title":"Configure SLO Alerting Policies on Google Cloud","seo_description":"Configure SLO alerting policies on Google Cloud using Terraform with PromQL-based monitoring for App Hub resources or specified services.","seo_keywords":["configure SLO alerting policies","Google Cloud SLO setup","PromQL-based SLO monitoring","Terraform SLO configuration","Service Level Objective alerts"]}}