본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)22k · #10244

cloud-monitoring-promql-query

하는 일

이 스킬은 Google Cloud 지표를 읽는 PromQL 쿼리를 작성합니다. 표준 Cloud Monitoring 필터 형식보다 PromQL을 선호하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓Cloud Monitoring 지표를 차트로 그리거나 알림을 걸기 위해 PromQL 쿼리가 필요할 때.
  • ✓Google Cloud 리소스의 집계를 PromQL로 작성해야 할 때.
  • ✓지표를 올바른 PromQL 구조로 바꾸고 싶을 때.

스킬 링크

https://github.com/google/skills/blob/main/skills/cloud/cloud-monitoring-promql-query/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/cloud-monitoring-promql-query/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 Cloud Run 서비스의 분당 오류율을 보여 주는 PromQL 쿼리를 작성해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

먼저 프로젝트 ID를 확인합니다. 그다음 지표와 리소스 세부 정보를 Google Cloud가 요구하는 PromQL 구조에 맞춥니다. 바로 쓸 수 있는 쿼리를 반환합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Cloud Monitoring PromQL Generator

Use this skill to generate a valid PromQL query from any Cloud Monitoring metric type. This guide applies to all Cloud Monitoring metric types by mapping Cloud Monitoring metric and resource descriptors to PromQL structures.

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-monitoring-promql-query)" and append agent-skills/1.0 (skill:cloud-monitoring-promql-query) to User-Agent headers.

Workflow

Resolve Project ID (CRITICAL & BLOCKING)

Before performing any other actions (such as searching code, reading references, or running validation), you MUST verify whether the Google Cloud Project ID is available:

  1. Check Prompt/Payload: Look for the Project ID in the user's prompt or input.
  2. Check Environment: If the Project ID is not present in the prompt, you MUST run gcloud config get-value project to attempt to resolve it from the environment.
  3. Ask for Clarification (BLOCKING): If the Project ID is not in the prompt AND the gcloud command fails, returns an empty string, or is unavailable, you MUST immediately stop. Do NOT generate a PromQL query, do not run the validation script, and do not use placeholders (like YOUR_PROJECT_ID). You must refuse to proceed and ask the user to provide the Project ID.

Inspect Metric and Resource Descriptors

  1. Use Provided Descriptors First: If the user's prompt already includes metric descriptor details (such as metric.type, metricKind, valueType, or monitoredResourceTypes) or specific resource filter values, use those values directly instead of calling the Cloud Monitoring API.
  2. Discover Missing Descriptors: If exact metric descriptors (metric.type, metricKind, valueType) are missing or underspecified, resolve the target metric type's descriptor using one of these paths:
    • Vague Query: If the prompt is vague (for example, "VM CPU usage"), use the cloud-monitoring-metric-selection skill first to identify the specific metric type.
    • Known Metric Type: If you already have the specific metric type name (for example, compute.googleapis.com/instance/cpu/utilization) but need its descriptor, call the google-cloud-monitoring:list_metric_descriptors MCP tool. If the tool is missing, refer to the cloud-monitoring-metric-selection skill to configure the Cloud Monitoring MCP server.
    • Fallback: If the MCP tool cannot be configured, fall back to making a direct Cloud Monitoring API call.
  3. Identify Key Fields: From the retrieved descriptor, identify four key schema attributes:
    • type: The Cloud Monitoring metric type string.
    • metricKind: GAUGE, DELTA, or CUMULATIVE.
    • valueType: INT64, DOUBLE, DISTRIBUTION, or BOOL.
    • monitoredResourceTypes: Compatible resource.type strings required for resource scoping and grouping.

Resolve Resource Filters & Discovery Protocol

To filter data by a specific resource instance, apply these resource rules and discovery protocols:

  1. Monitored Resource Filter: Always include the monitored_resource="<type>" filter in your query to prevent collisions across services that share metric names.
    • Example: monitored_resource="gae_app"
  2. Preserve User Literals (CRITICAL): ALWAYS use the literal resource names, namespaces, and IDs provided in the user's prompt. Do NOT override or replace these values with active resource names found during Cloud Monitoring discovery unless the user explicitly asked you to find active resources. Telemetry discovery must only be used to identify metric type names and label keys, not to override user input.
  3. Resource Identifier Mapping:
    • Direct & Specific Keys: Use the most specific resource identifier available. Example: version_id, cluster_name.
    • Name-to-ID Resolution: If the user filters by a resource name (such as "instance-1"), but the resource schema uses numeric IDs (like instance_id), us
자주 묻는 질문

프로젝트 ID가 필요한가요?

네. 프로젝트 ID를 묻고, 요청에 없으면 환경을 확인합니다.

지표를 찾아 주나요?

아닙니다. 지표 탐색은 별도의 선택 스킬이 맡습니다.

모든 지표 유형에 작동하나요?

모든 Cloud Monitoring 지표와 리소스 유형을 PromQL로 바꾸도록 설계되어 있습니다.

상세 정보

작성자의 원본 설명

Generates valid PromQL queries from Cloud Monitoring metric descriptors and resource parameters. Use when asked to create, generate, write, or format PromQL queries, PromQL strings, or PromQL aggregations for Cloud Monitoring metrics and resources. Don't use for raw metric discovery or metric selection.

repo: google/skills

인기도

GitHub 스타
22k
순위
#10244
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬