Loading...
Loading...
Generates Google Cloud Monitoring Server-Driven UI (SDUI) Widget and XyChart Protocol Buffer textprotos from resolved PromQL queries. Use when: - Generating valid google.monitoring.dashboard.v1.Widget textprotos, containing PrometheusQuery datasets, for use with the Cloud Monitoring Dashboards API, gcloud CLI, or declarative dashboard definitions. - Synthesizing Server-Driven UI (SDUI) widget titles, axis labels, and plot types for Prometheus queries. Don't use for: - Metric discovery or PromQL query generation. For those tasks, use the cloud-monitoring-metric-selection or cloud-monitoring-promql-query skills.
npx skill4agent add google/skills cloud-monitoring-chart-generationcloud-monitoring-chart-generationgoogle.monitoring.dashboard.v1.Widget[!CAUTION] CRITICAL EXECUTION & WORKING DIRECTORY RULES:
- DO NOT CHANGE WORKING DIRECTORY: Keep your working directory at your workspace root. Do NOT
into skill subdirectories.cd- NO DISCOVERY OR SEARCH RULE: The metric descriptor, PromQL query, unit, and resource type are ALWAYS present in the conversation context. NEVER run file or codebase search tools, such as 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, for example:
.python3 scripts/assemble_widget_proto.py ...- OUTPUT GENERATION: The
script automatically generates deterministic sequential filenames likeassemble_widget_protoandchart.textprotoand saves them to the active workspace. The script will handle naming and saving automatically, and will print the generated filename to the console.chart_2.textproto
pip install -r scripts/requirements.txt[ Stage 1: compute_labels ] ---> [ Stage 2: LLM Synthesis ] ---> [ Stage 3: assemble_widget_proto ]
Generates candidate labels Formulates SemanticPlotSpec Emits validated widget textprotopython3 scripts/compute_labels.py \
--metric_display_name "METRIC_DISPLAY_NAME" \
--resource_type "RESOURCE_TYPE" \
--metric_unit "UNIT" \
--promql_query "PROMQL_QUERY"SemanticPlotSpectitletitleCandidateyAxisLabel"Utilization""Bytes""Bytes Rate""(%)""(/s)""(By)"unitOverrideplotTypeLINESTACKED_AREAunitOverriderate(...)irate(...)/sByrate(...)unitOverride: "By/s"100 * ... / ...unitOverride: "%"10^2.%"%"avg_over_time(...)sum by (...)"%""By""s"legend_templateSemanticPlotSpec{
"title": "VM CPU Utilization (us-central1-a)",
"yAxisLabel": "Utilization",
"plotType": "LINE",
"unitOverride": "%"
}python3 scripts/assemble_widget_proto.py \
--promql_query "PROMQL_QUERY" \
--spec_json 'SEMANTIC_PLOT_SPEC_JSON'[!IMPORTANT] MANDATORY FILE OUTPUT CONTRACT: The script automatically names and saves output files likeandchart.textprotodirectly in your workspace root without subdirectories.chart_2.textproto
Wrote widget textproto to: .../chart.textproto```textprototitle: "..."
xy_chart {
...
}[!CAUTION] DO NOT FINISH YOUR TURN UNTIL FILE VERIFICATION PASSES:
- Run Validation Check: Execute the validator script against the generated file, such as
or the sequential filename likechart.textprotooutput from Stage 3:chart_2.textprotobashpython3 scripts/validate_chart.py --input_file "GENERATED_FILE.textproto"- Auto-Retry if Missing or Failed: If
reports that the file is missing or invalid, verify your script parameters and immediately re-run Stage 3:validate_chartbashpython3 scripts/assemble_widget_proto.py \ --promql_query "PROMQL_QUERY" \ --spec_json 'SEMANTIC_PLOT_SPEC_JSON'- Validation & Retries: Run
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.validate_chart- Execution vs. Validation Errors: Note that schema/syntax validation errors from
are distinct from OS or environment execution restrictions, such asvalidate_chart.pyorPermission denied, which are handled below in Graceful Sandbox Fallback.Command not found
compute_labels.pyassemble_widget_proto.pyvalidate_chart.py