cloud-monitoring-chart-generation

Generates Cloud Monitoring dashboard Widget textprotos from PromQL or ListTimeSeries queries.

19.1k|1.5k|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/google/skills --skill cloud-monitoring-chart-generation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloud-monitoring-chart-generation
Source: https://github.com/google/skills/tree/main/skills/cloud/cloud-monitoring-chart-generation
Command: npx skills add https://github.com/google/skills --skill cloud-monitoring-chart-generation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Writing valid Google Cloud Monitoring dashboard widget definitions by hand is error-prone: the google.monitoring.dashboard.v1.Widget protobuf schema has strict field rules, mutually exclusive query types, and UCUM unit conventions. This Skill converts resolved PromQL or ListTimeSeries queries into validated Server-Driven UI (SDUI) Widget textprotos ready for the Dashboards API, gcloud CLI, or declarative dashboard pipelines.

Core Features & Use Cases

  • Widget textproto generation: Assembles complete XyChart Widget textprotos with titles, axis labels, plot types, and unit overrides from a PromQL query or ListTimeSeries JSON payload.
  • Label and unit synthesis: Computes baseline chart titles, y-axis labels, and UCUM unit overrides from metric metadata, resource types, aligners, and PromQL structure.
  • Built-in validation: Parses and validates generated textprotos against the Widget schema, enforcing rules such as the mutual exclusivity of prometheus_query and time_series_filter.
  • Use Case: Given a PromQL query like rate(compute_googleapis_com:instance_cpu_utilization[1m]) and its metric metadata, produce a validated dashboard widget textproto with the correct "%" unit override for direct use with the Cloud Monitoring Dashboards API.

Quick Start

Ask the agent to generate a Cloud Monitoring dashboard chart widget from your resolved PromQL query or ListTimeSeries filter along with the metric display name, resource type, and unit.

Frequently Asked Questions about cloud-monitoring-chart-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a Cloud Monitoring dashboard widget from a PromQL query?

Provide the resolved PromQL query plus the metric display name, resource type, and unit. The skill computes label candidates, synthesizes a plot spec, and runs assemble_widget_proto.py to emit a validated Widget textproto file.

How do I create a Cloud Monitoring chart from a ListTimeSeries filter?

Pass the ListTimeSeries JSON payload with its filter and aggregation (perSeriesAligner, crossSeriesReducer) to the pipeline. The assembler builds a time_series_filter dataset, and validate_chart.py verifies the filter substring and unit override.

Can a Cloud Monitoring widget dataset contain both PromQL and a time series filter?

No. A time_series_query dataset must contain either a prometheus_query or a time_series_filter, never both. The validation script rejects any widget where both fields are populated in the same dataset.

Does this skill write PromQL queries or discover metrics?

No. It only converts already-resolved PromQL or ListTimeSeries queries into chart widgets. Metric discovery and PromQL query generation are handled by separate skills such as cloud-monitoring-metric-selection or cloud-monitoring-promql-query.

What Python dependencies are required to run the chart generation scripts?

The runtime scripts use only Python 3.10+ standard library modules such as re, json, and argparse, so no external PyPI packages are needed. The bundled unit tests use absltest.

What happens if the generated widget textproto fails validation?

The workflow re-runs the assembly script with corrected parameters and retries validation up to two times. If scripts cannot execute due to sandbox restrictions, the skill outputs the textproto directly with local verification commands.