Generated banner for Cloud Monitoring List Time Series Request
Generated logo for Cloud Monitoring List Time Series Request

Cloud Monitoring List Time Series Request

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Generates valid Cloud Monitoring ListTimeSeries requests and aggregation specifications from metric descriptors and resource parameters. Use when asked to create, generate, format, or build ListTimeSeries requests, JSON payloads, filter expressions, or aligner/reducer aggregations for Cloud Monitoring metrics and charts. Don't use for metric discovery or metric selection.
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill assists in constructing valid ListTimeSeries REST API requests for Google Cloud Monitoring. It guides the user through identifying metric descriptors, defining filter expressions, and selecting appropriate aggregation parameters like aligners and reducers. It ensures requests are formatted correctly according to the metric's kind and value type, and includes a validation step using the list_timeseries MCP tool to verify the generated query structure.

What it does

  • Generates valid ListTimeSeries REST API request payloads.
  • Constructs filter expressions based on metric types and resource labels.
  • Determines appropriate perSeriesAligner and crossSeriesReducer settings.
  • Calculates alignment periods based on requested time intervals.
  • Validates generated request structures against live telemetry.
  • Ensures proper attribution for API and CLI requests.

When to use it

  • When you need to build a JSON payload for a Cloud Monitoring ListTimeSeries API call.
  • When you need to determine the correct aggregation settings for a specific metric.
  • When you need to construct a filter string for querying time series data.
  • When you need to verify if a constructed monitoring query is syntactically valid.

Advantages

  • Ensures adherence to Cloud Monitoring API syntax requirements.
  • Automates the selection of aligners and reducers based on metric metadata.
  • Provides a structured workflow for resolving metric descriptors.
  • Includes built-in validation to confirm request validity before execution.

Usage examples

“Generate a ListTimeSeries request for compute.googleapis.com/instance/cpu/utilization for project my-gcp-project over the last hour.”
Returns a JSON object containing the name, filter, interval, and aggregation parameters configured for CPU utilization metrics.
“What aggregation settings should I use for a GAUGE metric with INT64 value type if I want the mean?”
Provides the specific perSeriesAligner (ALIGN_MEAN) and crossSeriesReducer (REDUCE_MEAN) to use in the aggregation block.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/google/cloud-monitoring-list-time-series-request/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip cloud-monitoring-list-time-series-request.zip -d .agents/skills

Documentation by Google

Cloud Monitoring ListTimeSeries Request Generator

Use this skill to translate any Cloud Monitoring metric descriptor into valid, production-ready ListTimeSeries REST API query parameters (name, filter, interval.startTime, interval.endTime, aggregation.*, view).

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

CRITICAL RULES

  • Mandatory Project ID Clarification: You MUST ensure the GCP Project ID is present in the user prompt, input payload, or environment context (such as via gcloud config get-value project). If the Project ID is missing and cannot be resolved, you MUST ask the user to clarify it before generating or executing ListTimeSeries requests. Do NOT use placeholders for project names.

Workflow

Inspect Metric Metadata
  1. Use Provided Metric Metadata First: If the user's prompt already includes metric metadata such as metric.type, metricKind, valueType, resource types, or label keys, use those values directly instead of calling API tools.

  2. Discover Missing Metadata: If exact metric descriptors including metric.type, metricKind, and valueType are missing or underspecified, resolve the target metric's descriptor using one of these paths:

    • Vague Query: If the prompt is vague, such as asking for 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 such as compute.googleapis.com/instance/cpu/utilization, but need its descriptor, call the 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 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, for example ["cloudsql_database", "cloudsql_instance"]. If multiple resource types are listed, select the specific resource.type that matches the target granularity of the user's request.


Construct Monitoring Filter

The filter parameter is a mandatory string in Cloud Monitoring syntax that restricts the query to a single metric.type and optional resource and metric labels:

  1. Single Metric Type Restriction: Every filter MUST specify exactly one metric.type clause using an equality operator. For example:

    • metric.type = "compute.googleapis.com/instance/cpu/utilization"

  2. Monitored Resource Type Filter: MUST include the resource.type filter when the target resource granularity is known, preventing collisions across services that share metric types or sub-resources. For example:

    • metric.type = "cloudsql.googleapis.com/database/cpu/utilization" AND resource.type = "cloudsql_database"

  3. Preserve User Literals and IDs: You MUST use literal resource names, IDs, zones, and project parameters provided by the user without alteration. Do NOT override or replace user-specified identifiers with active resources found during metric metadata discovery unless explicitly requested.

  4. Label Type Prefixing:

    • Prefix resource-level dimensions, such as instance ID, zone, project, database ID, or subscription ID, with the resource.labels. prefix. For example:

      • resource.labels.instance_id = "123456789"

      • resource.labels.database_id = "my-project:my-instance"

    • Prefix metric-level dimensions, such as state, command, response code, or instance name metadata when stored on the metric, with the metric.labels. prefix. For example:

      • metric.labels.state != "free"

      • metric.labels.instance_name = "instance-1"

  5. Resource Name versus ID Resolution:

    • If the user specifies a human-readable GCE VM instance name such as "instance-1", but resource.labels.instance_id expects a numeric ID, you MUST filter using either metric.labels.instance_name = "instance-1" or metadata.system_labels.name = "instance-1".

    • Do NOT use resource.metadata.name or resource.metadata.*. This prefix is invalid in Cloud Monitoring filter syntax.

    • Do NOT assign a string instance name directly to resource.labels.instance_id unless the resource type explicitly uses string IDs.

  6. Database Identifier Labels: Database labels such as database_id for Cloud SQL and Spanner, or dataset_id for BigQuery, use composite keys formatted as <project_id>:<instance_name>. For example: resource.labels.database_id = "my-project:foo".

  7. Ops Agent Metrics State Label Filtering: For agent.googleapis.com/memory/percent_used and agent.googleapis.com/disk/percent_used metrics, you MUST use metric.labels.state != "free". Do NOT filter by metric.labels.state = "used".


Choose Aggregation Structure

Select the perSeriesAligner, crossSeriesReducer, groupByFields, and alignmentPeriod according to the metric properties and visualization goal:

  1. Consult the Aggregations Reference: You MUST include both perSeriesAligner and crossSeriesReducer in the aggregation query parameters of every request. Read and follow the Cloud Monitoring ListTimeSeries Basic Aggregations Reference to select the exact perSeriesAligner and crossSeriesReducer combinations for your metric's Metric Kind and Value Type pairing, and to apply mandatory SRE rules for utilization metrics, counters, distributions, and state-based gauges such as memory filtered by state != "free".

  2. Grouping Fields and Resource Granularity: When crossSeriesReducer is specified as anything other than REDUCE_NONE, list the exact labels to preserve. When querying multi-instance resources like VMs, databases, or subscriptions, include the primary resource identifier in groupByFields. For example, use resource.labels.instance_id for VMs or resource.labels.database_id for databases. This prevents collapsing separate resource streams into a single global aggregate.

  3. Alignment Period Determination: Calculate the query lookback duration from endTime minus startTime, ensuring startTime precedes endTime. If endTime <= startTime, flag an error before computing duration. Set alignmentPeriod according to Cloud Console default fine granularity standards:

    • Duration <= 110 minutes: Set alignmentPeriod = "60s".

    • Duration <= 23 hours: Set alignmentPeriod = "300s".

    • Duration <= 6 days: Set alignmentPeriod = "3600s".

    • Duration <= 23 days: Set alignmentPeriod = "10800s".

    • Duration <= 80 days: Set alignmentPeriod = "21600s".

    • Duration <= 180 days: Set alignmentPeriod = "43200s".

    • Duration <= 350 days: Set alignmentPeriod = "86400s".

    • Duration <= 500 days: Set alignmentPeriod = "172800s".

    • Omission Rule: alignmentPeriod is omitted only when perSeriesAligner is set to ALIGN_NONE.


Format Valid Request

Present the generated ListTimeSeries REST query parameters. For example:

{
  "name": "projects/<project_id>",
  "filter": "metric.type = \"<metric_type>\" AND resource.type = \"<resource_type>\"",
  "interval": {
    "startTime": "<iso_8601_start>",
    "endTime": "<iso_8601_end>"
  },
  "aggregation": {
    "alignmentPeriod": "60s",
    "perSeriesAligner": "ALIGN_RATE",
    "crossSeriesReducer": "REDUCE_SUM",
    "groupByFields": [
      "resource.labels.zone"
    ]
  },
  "view": "FULL"
}
  • Aggregation Requirements: Populate the aggregation parameters with the perSeriesAligner, crossSeriesReducer, alignmentPeriod, and optional groupByFields values determined during aggregation selection.

  • Interval Requirements: startTime and endTime MUST be valid RFC 3339 and ISO 8601 timestamps such as "YYYY-MM-DDTHH:MM:SSZ". If not explicitly provided by the user, dynamically compute a one-hour lookback interval ending at the current time, where endTime is the present moment and startTime is one hour prior. Do NOT hardcode static dates from examples.

  • Alignment Period Requirement: Determine alignmentPeriod from the lookback duration of endTime minus startTime using the mapping above. For the default one-hour lookback interval, alignmentPeriod is "60s".

  • View Requirement: MUST default to "FULL" when time series data points are needed, or "HEADERS" when inspecting metadata and series identities only.


Validate Request via list_timeseries MCP Tool

You MUST validate the generated request parameters against live Cloud Monitoring telemetry before returning the final output. Call the list_timeseries MCP tool passing all generated query parameters (name, filter, interval, aggregation). When validating you MUST set view="HEADERS" to minimize latency and payload size while verifying request structure. A response without API errors confirms that your filter and aggregation settings are valid.

If the list_timeseries tool is unavailable, fall back to a direct API call.


References

Files

references/basic_aggregations.md

Cloud Monitoring ListTimeSeries Basic Aggregations Reference

This document maps Cloud Monitoring Aligner and Reducer concepts to structured ListTimeSeries (list_timeseries) REST request fields. Use this matrix and default rules to determine the correct aggregation query parameters (aggregation.perSeriesAligner, aggregation.crossSeriesReducer, and aggregation.groupByFields) based on Cloud Monitoring metric properties (metricKind and valueType) and desired calculation goals.

Table of Contents

  • Translation Matrix (~Line 26)

  • Default Aggregations and Visualization Rules (~Line 74)

    • 1. CPU and Memory Utilization (Ratios / Percentages) (~Line 80)

    • 2. Rate of Events / Throughput (Counters) (~Line 99)

    • 3. Distribution Metrics (Quantiles / Latency) (~Line 114)

    • 4. Boolean & Status Metrics (BOOL Value Type) (~Line 132)

    • 5. Backlog Age & Processing Lag (ALIGN_MAX / REDUCE_MAX) (~Line 143)

Translation Matrix

To use this matrix:

  • Inputs: Identify the metric's metricKind and valueType from its MetricDescriptor, then infer the target calculation goal from the user's prompt (e.g., Mean, Sum, 95th Percentile) under Aggregation Intent to select the matching perSeriesAligner and crossSeriesReducer.

  • Output Aggregation Fields (MANDATORY): Extract BOTH perSeriesAligner AND crossSeriesReducer values from the table below to populate the aggregation query parameters (aggregation.perSeriesAligner and aggregation.crossSeriesReducer) in your ListTimeSeries REST request. Every request MUST specify both perSeriesAligner and crossSeriesReducer.

Metric KindValue TypeAggregation IntentperSeriesAlignercrossSeriesReducer
GAUGENUMERIC (INT64 / DOUBLE)None / Raw PointsALIGN_MEANREDUCE_NONE
GAUGENUMERICMeanALIGN_MEANREDUCE_MEAN
GAUGENUMERICMinALIGN_MINREDUCE_MIN
GAUGENUMERICMaxALIGN_MAXREDUCE_MAX
GAUGENUMERICSum (default)ALIGN_MEANREDUCE_SUM
GAUGENUMERICCount time seriesALIGN_MEANREDUCE_COUNT
GAUGENUMERIC99th percentileALIGN_MEANREDUCE_PERCENTILE_99
GAUGENUMERIC95th percentileALIGN_MEANREDUCE_PERCENTILE_95
GAUGENUMERIC50th percentileALIGN_MEANREDUCE_PERCENTILE_50
GAUGENUMERIC5th percentileALIGN_MEANREDUCE_PERCENTILE_05
GAUGEDISTRIBUTIONDistribution (default)ALIGN_SUMREDUCE_SUM
GAUGEDISTRIBUTIONMeanALIGN_SUMREDUCE_MEAN
GAUGEDISTRIBUTION99th percentileALIGN_PERCENTILE_99REDUCE_NONE / REDUCE_PERCENTILE_99
GAUGEDISTRIBUTION95th percentileALIGN_PERCENTILE_95REDUCE_NONE / REDUCE_PERCENTILE_95
GAUGEDISTRIBUTION50th percentileALIGN_PERCENTILE_50REDUCE_NONE / REDUCE_PERCENTILE_50
GAUGEBOOLNone / Raw PointsALIGN_FRACTION_TRUEREDUCE_NONE
GAUGEBOOLFraction true (default)ALIGN_FRACTION_TRUEREDUCE_MEAN
GAUGEBOOLCount trueALIGN_FRACTION_TRUEREDUCE_SUM
DELTA / CUMULATIVENUMERIC (INT64 / DOUBLE)None / Raw PointsALIGN_RATEREDUCE_NONE
DELTA / CUMULATIVENUMERICSum (default)ALIGN_RATEREDUCE_SUM
DELTA / CUMULATIVENUMERICMeanALIGN_RATEREDUCE_MEAN
DELTA / CUMULATIVENUMERICMinALIGN_RATEREDUCE_MIN
DELTA / CUMULATIVENUMERICMaxALIGN_RATEREDUCE_MAX
DELTA / CUMULATIVENUMERIC99th percentileALIGN_RATEREDUCE_PERCENTILE_99
DELTA / CUMULATIVENUMERIC95th percentileALIGN_RATEREDUCE_PERCENTILE_95
DELTA / CUMULATIVENUMERIC50th percentileALIGN_RATEREDUCE_PERCENTILE_50
DELTA / CUMULATIVEDISTRIBUTIONDistribution (default)ALIGN_DELTAREDUCE_SUM
DELTA / CUMULATIVEDISTRIBUTIONMeanALIGN_DELTAREDUCE_MEAN
DELTA / CUMULATIVEDISTRIBUTION99th percentileALIGN_PERCENTILE_99REDUCE_NONE / REDUCE_PERCENTILE_99
DELTA / CUMULATIVEDISTRIBUTION95th percentileALIGN_PERCENTILE_95REDUCE_NONE / REDUCE_PERCENTILE_95
DELTA / CUMULATIVEDISTRIBUTION50th percentileALIGN_PERCENTILE_50REDUCE_NONE / REDUCE_PERCENTILE_50

Default Aggregations and Visualization Rules

Apply these standard defaults when constructing ListTimeSeries REST query specifications for charts, dashboards, or when the user's aggregation preference is underspecified:

1. CPU and Memory Utilization (Ratios / Percentages)
  • Use when: Querying CPU or memory utilization metrics (ratios or percentages) for any service or agent (e.g., compute.googleapis.com/instance/cpu/utilization or agent.googleapis.com/memory/percent_used).

  • Default Aggregation Directive: For CPU and memory utilization metrics, default to perSeriesAligner = ALIGN_MEAN and crossSeriesReducer = REDUCE_NONE. If needed, group specifically by instance, such as groupByFields = ["resource.labels.instance_id"].

  • Aggregation Constraints:

    • No Cross-Series Summing: Do NOT use crossSeriesReducer = REDUCE_SUM. Utilization metrics represent ratios or percentages; summing them across instances yields invalid percentages over 100%.

    • No Cross-Series Averaging for Resource Limits: Averaging utilization across instances (crossSeriesReducer = REDUCE_MEAN) masks severe outliers. For example, one instance crashing at 100% while others sit idle at 0%.

2. Rate of Events / Throughput (Counters)
  • Use when: Querying DELTA or CUMULATIVE event counter metrics.

  • Throughput Rule: You MUST convert DELTA or CUMULATIVE metrics representing event counts (INT64 / DOUBLE) to a rate by setting perSeriesAligner = ALIGN_RATE.

  • Cross-Series Reducer: Use crossSeriesReducer = REDUCE_SUM when combining throughput across instances (e.g., total read bytes per second across all VMs in a zone).

    • Example: perSeriesAligner = ALIGN_RATE, crossSeriesReducer = REDUCE_SUM, alignmentPeriod = "300s".

  • Removal of Transform Functions: Do NOT apply multi-layer transform aligners. Apply perSeriesAligner = ALIGN_RATE and crossSeriesReducer = REDUCE_SUM cleanly in a single primary aggregation query.

3. Distribution Metrics (Quantiles / Latency)
  • Use when: Querying DISTRIBUTION metrics (such as request latencies).

  • Rule: For DISTRIBUTION metrics, such as Cloud Run request latencies (run.googleapis.com/request_latency/e2e_latencies) or Pub/Sub ack latencies (pubsub.googleapis.com/subscription/ack_latencies):

    • To retrieve raw histogram bucket distributions across instances, use perSeriesAligner = ALIGN_DELTA (for DELTA/CUMULATIVE) or perSeriesAligner = ALIGN_SUM (for GAUGE) with crossSeriesReducer = REDUCE_SUM.

    • To extract specific percentile latency gauges directly via the API, use percentile aligners: perSeriesAligner = ALIGN_PERCENTILE_99, perSeriesAligner = ALIGN_PERCENTILE_95, perSeriesAligner = ALIGN_PERCENTILE_50, or perSeriesAligner = ALIGN_PERCENTILE_05. When reduction across instances is requested, combine with the matching reducer (e.g., perSeriesAligner = ALIGN_PERCENTILE_95, crossSeriesReducer = REDUCE_PERCENTILE_95).

4. Boolean & Status Metrics (BOOL Value Type)
  • Use when: Querying BOOL value type metrics.

  • Default Aggregations:

    • Fraction True / Availability: perSeriesAligner = ALIGN_FRACTION_TRUE, crossSeriesReducer = REDUCE_MEAN returns the fraction of healthy instances in [0.0, 1.0].

    • Count True: perSeriesAligner = ALIGN_FRACTION_TRUE, crossSeriesReducer = REDUCE_SUM returns the total count of healthy instances (INT64).

5. Backlog Age & Processing Lag (ALIGN_MAX / REDUCE_MAX)
  • Use when: Querying metrics tracking maximum age, lag, or oldest unacknowledged items.

  • Rule: For metrics tracking the maximum age, lag, or oldest unacknowledged item across services or workers (e.g., pubsub.googleapis.com/subscription/oldest_unacked_message_age or dataflow.googleapis.com/job/system_lag), always default to perSeriesAligner = ALIGN_MAX and crossSeriesReducer = REDUCE_MAX to surface peak delays across instances.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/cloud-monitoring-list-time-series-request · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cloud-monitoring-list-time-series-request.zip