cloud-monitoring-chart-generation
Generates Cloud Monitoring Server-Driven UI (SDUI) Widget and XyChart Protocol Buffer textprotos on Google Cloud from resolved PromQL or ListTimeSeries queries. Use when: - Generating valid google.monitoring.dashboard.v1.Widget textprotos, containing PrometheusQuery or TimeSeriesFilter datasets, for
- 0
- Installs
- —
- Rating
- —
- Success rate
- 10
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 6036d9184d6426eb… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Cloud Monitoring Chart Generation Skill (cloud-monitoring-chart-generation)
Transforms PromQL or ListTimeSeries JSON request payloads and metric metadata
into valid Server-Driven UI (SDUI) google.monitoring.dashboard.v1.Widget
Protocol Buffer textprotos. These generated textprotos are designed to be
ingested by the Cloud Monitoring Dashboards API, gcloud CLI, or declarative
dashboard provisioning pipelines.
[!IMPORTANT] Preferred API & Mutually Exclusive Queries:
- API Preference: Always prefer generating
ListTimeSeries(time_series_filter) configurations for widgets over PromQL, unless the user explicitly requested PromQL or the metric math strictly requires it.- Mutually Exclusive: A widget dataset
time_series_querymust contain EITHER atime_series_filterOR aprometheus_query. You must never populate both fields in the same dataset simultaneously.- Strict Passthrough: You MUST copy the provided PromQL query or ListTimeSeries JSON exact filter string character-for-character. DO NOT invent, rewrite, or modify the queries under any circumstances.
[!CAUTION] CRITICAL EXECUTION & WORKING DIRECTORY RULES:
- DO NOT CHANGE WORKING DIRECTORY: Keep your working directory at your workspace root. Do NOT
cdinto skill subdirectories.- NO DISCOVERY OR SEARCH RULE: The metric descriptor, PromQL query, ListTimeSeries JSON payload, unit, and resource type are ALWAYS present in the conversation context. NEVER run file or codebase search tools, like grep, find, directory listings, or codebase queries, to discover metric metadata or inspect repository structures.
- SCRIPT EXECUTION: Execute the bundled Python scripts directly using python3.
- OUTPUT GENERATION: The
assemble_widget_protoscript automatically generates a unique UUID-based filename to prevent parallel execution collisions. It will print the generated filename to standard error strongly prefixed with "Wrote widget textproto to:". You MUST parse this exact prefix from the logs to extract the generated path and use it for validation in Stage 4.
Prerequisites: Environment Setup
Install the required dependencies in your environment or sandbox:
pip install -r scripts/requirements.txt
Follow the workflow pipeline
[ Stage 1: compute_labels ] ---> [ Stage 2: LLM Synthesis ] ---> [ Stage 3: assemble_widget_proto ]
Generates candidate labels Formulates SemanticPlotSpec Emits validated widget textproto
Stage 1: Baseline Candidate Synthesis
Run Stage 1 using python3:
# For PromQL:
python3 scripts/compute_labels.py \
--metric_display_name "METRIC_DISPLAY_NAME" \
--resource_type "RESOURCE_TYPE" \
--metric_unit "UNIT" \
--promql_query 'PROMQL_QUERY'
# For ListTimeSeries:
python3 scripts/compute_labels.py \
--metric_display_name "METRIC_DISPLAY_NAME" \
--resource_type "RESOURCE_TYPE" \
--metric_unit "UNIT" \
--filter_string 'metric.type="m"...' \
--per_series_aligner "ALIGN_RATE" \
--cross_series_reducer "REDUCE_SUM"
Stage 2: SemanticPlotSpec Prediction (LLM)
Review the user prompt, PromQL or LTS query structure, and Stage 1 baseline
candidates to formulate a 4-key SemanticPlotSpec JSON object:
title: PolishtitleCandidateto ensure it is concise, human-readable, and under 80 characters.yAxisLabel: Set this to a concise, human-readable quantitative descriptor or metric concept, like"Utilization","Bytes", or"Bytes Rate". Do NOT append unit symbols or suffixes like"(%)","(/s)", or"(By)"to the label, because units are rendered automatically viaunitOverride.plotType: Default toLINE. UseSTACKED_AREAif requested by the user or for distribution queries.unitOverride: Set this to the Unified Code for Units of Measure (UCUM) unit string, derived by applying the corresponding rules below:
List Time Series (LTS) Unit Strategy:
- Trust the Candidate: For List Time Series flows, set this directly to
the
unitOverrideCandidateproduced by Stage 1. Stage 1 mathematically processesALIGN_RATE, for example producingBy/s, forces%forALIGN_PERCENT_CHANGE, and correctly outputs native normalizations unconditionally.
PromQL Unit Strategy (LLM Manual Override):
Because PromQL expressions can geometrically compose, for example
histogram_quantile(..., rate(...)), rely on your own semantic reasoning to
govern the final unit:
-
Rate Functions (
rate(...),irate(...)): Convert cumulative counters into per-second rates. Append/sto the raw metric unit. For example, a raw metric unit ofBywithrate(...)results inunitOverride: "By/s".- Exception: If
rate()is evaluated inside ahistogram_quantile(), the output is the raw bucket unit like"s", not a rate.
- Exception: If
-
Ratios & Percentages (
100 * (A / B)): Ratios of identical metric units typically represent percentages, resulting inunitOverride: "%". -
Normalizations: Normalize
10^2.%to"%". -
Preserved Units: For simple aggregation functions like
avg_over_time(...)orsum by (...), retain and output the underlying metric unit without modification. -
Legend Template: Do NOT configure the
legend_templatefield. It is intentionally omitted so that the Cloud Monitoring frontend dynamically renders its multi-column table legend at runtime.
Example SemanticPlotSpec:
{
"title": "VM CPU Utilization us-central1-a",
"yAxisLabel": "Utilization",
"plotType": "LINE",
"unitOverride": "%"
}
Stage 3: Protobuf Assembly & Output
Run Stage 3 using python3 to generate and save the widget textproto. Use
--promql_query for PromQL, or --lts_request_json for ListTimeSeries:
# For PromQL:
python3 scripts/assemble_widget_proto.py \
--promql_query 'PROMQL_QUERY' \
--spec_json 'SEMANTIC_PLOT_SPEC_JSON'
# For ListTimeSeries:
python3 scripts/assemble_widget_proto.py \
--lts_request_json '{"filter": "...", "aggregation": {...}}' \
--spec_json 'SEMANTIC_PLOT_SPEC_JSON'
[!IMPORTANT] MANDATORY FILE OUTPUT CONTRACT: Do not attempt to guess or enforce the output filename. The script will automatically generate a guaranteed-unique filename and print it to standard error. Search stderr for the explicit prefix "Wrote widget textproto to:" to deterministically capture this filename, and then target it in Stage 4 validation.
- Assigned Filename Feedback: Whenever an output file is saved, the script logs the file path to stderr. Read your command execution logs for the exact filename created so you can target it in Stage 4 validation.
- Text Chat Output: Enclose the generated SDUI widget textproto inside
a
```textprotocode block in your response:
title: "..."
xy_chart {
...
}
Verify and auto-retry
[!CAUTION] DO NOT FINISH YOUR TURN UNTIL FILE VERIFICATION PASSES: 1. Validate Artifact: Execute the validator script against the generated file output from Stage 3:
# For PromQL charts: python3 scripts/validate_chart.py --input_file "GENERATED_FILE.textproto" \ --expected_promql_substring "SOME_IDENTIFYING_SUBSTRING_FROM_QUERY" \ --expected_unit_override "UNIT_OVERRIDE_CANDIDATE" # For ListTimeSeries (LTS) charts: python3 scripts/validate_chart.py --input_file "GENERATED_FILE.textproto" \ --expected_lts_filter_substring "SOME_IDENTIFYING_SUBSTRING_FROM_FILTER" \ --expected_unit_override "UNIT_OVERRIDE_CANDIDATE" # ALWAYS provide an identifying substring and the Stage 1 unit override candidate to verify you didn't mutate the data.
CRITICAL: If you generated multiple charts for multiple metrics, you MUST run this validation script independently for EACH file generated to ensure every chart is correct!
2. **Auto-Retry if Missing or Failed**: If `validate_chart` reports that the file is missing or invalid, verify your script parameters and immediately re-run Stage 3: ```bash python3 scripts/assemble_widget_proto.py \ --promql_query 'PROMQL_QUERY' \ --spec_json 'SEMANTIC_PLOT_SPEC_JSON' # Or use --lts_request_json if applicable ``` 3. **Validation & Retries**: Run `validate_chart` to verify the generated textproto. If validation fails due to a schema or syntax error, correct the parameters and retry up to 2 times. If validation still fails after 2 retries, stop retrying, notify the user of the validation error, and present the best-effort textproto. 4. **Execution vs. Validation Errors**: Note that schema/syntax validation errors from `validate_chart.py` are distinct from OS or environment execution restrictions, which are handled below in **Graceful Sandbox Fallback**.
Perform graceful sandbox fallback
If compute_labels.py, assemble_widget_proto.py, or validate_chart.py
cannot be executed due to environment or sandbox restrictions, do the
following:
- Notify the user which script cannot be executed and why.
- Synthesize and output the complete widget textproto directly in your response, following all formatting and unit rules.
- Provide a "Local Verification" section containing the standalone python3 commands so the user can run and validate the schema locally if desired.
Supporting Links
Files
10- SKILL.md
3dbd35316110.4 KB - scripts/assemble_widget_proto.py
58073b8d588.2 KB - scripts/assemble_widget_proto_test.py
43d11dd60d1.7 KB - scripts/compute_labels.py
2198a9d13411.8 KB - scripts/compute_labels_test.py
8fea416ede6.8 KB - scripts/requirements.txt
748d44e58d157 B - scripts/textproto_util.py
de9a49793e8.0 KB - scripts/textproto_util_test.py
c1b851b28810.0 KB - scripts/validate_chart.py
b83c0e87888.1 KB - scripts/validate_chart_test.py
fc73fd8bf73.0 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from google/skills8
Configures best-practice alerting policies for AI agents using OpenTelemetry (OTel) metrics, generating output as Terraform (.tf) configuration files. Use when analyzing, writing, or deploying alerting policies to monitor agent latency, error rates, token usage, and quality metrics. Don't use for st
Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up resources by undeploying models and deleting endpoints. Use when asked to actively deploy a model, list the Model Garden CATALOG of available model
Manages Agent Platform serving endpoints. Use when you need to create, list, describe, update, or delete serving endpoints for model deployment on Agent Platform. Also use when troubleshooting endpoint permission, quota, or resource busy errors. Don't use for deploying models to endpoints or for run
Measures and improves the quality of AI models and agents on Google Cloud using the Eval Quality Flywheel methodology. Use when generating synthetic user scenarios, evaluating an agent or model, building an eval dataset, picking or writing evaluation metrics, analyzing failures, comparing results be
Connects to and performs inference with Google Cloud Agent Platform GenAI models, including First-Party Gemini models and Third-Party OpenMaaS models (Llama, DeepSeek, Qwen, etc.). Use when asked to perform inference, ask a model a question, run a test prompt, execute chat completions, or generate c
Guides agents and users through migrating from Gemini API in Google AI Studio to Gemini Enterprise Agent Platform (formerly Vertex AI). Use this skill when moving applications to Google Cloud, to leverage Cloud credits, or to unify inferencing with other Cloud infrastructure (IAM, billing, telemetry
Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.
Manages and orchestrates prompts in Agent Platform. Use when you need to create, list, retrieve, version, or delete managed prompts in Agent Platform. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform prompts.
Related devops skillsscan passed
Use when managing an Uncloud cluster — deploying services, configuring Caddy ingress, adding static proxy routes for non-cluster devices, publishing ports, scaling, inspecting logs, or managing machines and volumes with the `uc` CLI.
Deploys and configures classic Firebase Hosting for static websites, single-page apps (SPAs), and microservices. Use when deploying static sites/SPAs, setting up custom domains, configuring firebase.json hosting settings (redirects, rewrites, headers, multi-site), or managing preview channels. Don't
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Configures AWS Shield Advanced for enhanced Distributed Denial of Service (DDoS) protection: subscribing accounts and adding resource protections, enabling automatic application layer (layer 7) mitigation through AWS WAF, configuring health-based detection with Route 53 health checks, setting up Shi