Module query (2.24.0)

Time series query for the Google Stackdriver Monitoring API (V3)_.

.. _Google Stackdriver Monitoring API (V3): https://cloud.google.com/monitoring/api/ref_v3/rest/v3/ projects.timeSeries/list

Classes

Query

Query(
    client,
    project,
    metric_type="compute.googleapis.com/instance/cpu/utilization",
    end_time=None,
    days=0,
    hours=0,
    minutes=0,
)

Query object for retrieving metric data.

Parameters
Name Description
client :class:google.cloud.monitoring_v3.gapic. metric_service_client.MetricServiceClient

The client to use.

project str

The project ID or number.

metric_type str

The metric type name. The default value is :data:Query.DEFAULT_METRIC_TYPE <google.cloud.monitoring.query.Query.DEFAULT_METRIC_TYPE>, but please note that this default value is provided only for demonstration purposes and is subject to change. See the supported metrics_.

end_time datetime.datetime

(Optional) The end time (inclusive) of the time interval for which results should be returned, as a datetime object. The default is the start of the current minute. The start time (exclusive) is determined by combining the values of days, hours, and minutes, and subtracting the resulting duration from the end time. It is also allowed to omit the end time and duration here, in which case select_interval must be called before the query is executed.

days int

The number of days in the time interval.

hours int

The number of hours in the time interval.

minutes int

The number of minutes in the time interval.

Exceptions
Type Description
`ValueError if end_time is specified but days, hours, and minutes are all zero. If you really want to specify a point in time, use select_interval. .. _supported metrics: https://cloud.google.com/monitoring/api/metrics