Skip to main content

time_series

Creates, updates, deletes, gets or lists a time_series resource.

Overview

Nametime_series
TypeResource
Idgoogle.monitoring.time_series

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
descriptionstringInput only. A detailed description of the time series that will be associated with the google.api.MetricDescriptor for the metric. Once set, this field cannot be changed through CreateTimeSeries.
metadataobjectOutput only. The associated monitored resource metadata. When reading a time series, this field will include metadata labels that are explicitly named in the reduction. When creating a time series, this field is ignored. (id: MonitoredResourceMetadata)
metricobjectThe associated metric. A fully-specified metric used to identify the time series. (id: Metric)
metricKindstringThe metric kind of the time series. When listing time series, this metric kind might be different from the metric kind of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the metric kind of the associated metric. If the associated metric's descriptor must be auto-created, then this field specifies the metric kind of the new descriptor and must be either GAUGE (the default) or CUMULATIVE.
pointsarrayThe data points of this time series. When listing time series, points are returned in reverse time order.When creating a time series, this field must contain exactly one point and the point's type must be the same as the value type of the associated metric. If the associated metric's descriptor must be auto-created, then the value type of the descriptor is determined by the point's type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION.
resourceobjectThe associated monitored resource. Custom metrics can use only certain monitored resource types in their time series data. For more information, see Monitored resources for custom metrics (https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources). (id: MonitoredResource)
unitstringThe units in which the metric value is reported. It is only applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The unit defines the representation of the stored metric values. This field can only be changed through CreateTimeSeries when it is empty.
valueTypestringThe value type of the time series. When listing time series, this value type might be different from the value type of the associated metric if this time series is an alignment or reduction of other time series.When creating a time series, this field is optional. If present, it must be the same as the type of the data in the points field.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_time_series_listselectprojectsIdfilter, interval.endTime, interval.startTime, aggregation.alignmentPeriod, aggregation.perSeriesAligner, aggregation.crossSeriesReducer, aggregation.groupByFields, secondaryAggregation.alignmentPeriod, secondaryAggregation.perSeriesAligner, secondaryAggregation.crossSeriesReducer, secondaryAggregation.groupByFields, orderBy, view, pageSize, pageTokenLists time series that match a filter.
organizations_time_series_listselectorganizationsIdfilter, interval.endTime, interval.startTime, aggregation.alignmentPeriod, aggregation.perSeriesAligner, aggregation.crossSeriesReducer, aggregation.groupByFields, secondaryAggregation.alignmentPeriod, secondaryAggregation.perSeriesAligner, secondaryAggregation.crossSeriesReducer, secondaryAggregation.groupByFields, orderBy, view, pageSize, pageTokenLists time series that match a filter.
folders_time_series_listselectfoldersIdfilter, interval.endTime, interval.startTime, aggregation.alignmentPeriod, aggregation.perSeriesAligner, aggregation.crossSeriesReducer, aggregation.groupByFields, secondaryAggregation.alignmentPeriod, secondaryAggregation.perSeriesAligner, secondaryAggregation.crossSeriesReducer, secondaryAggregation.groupByFields, orderBy, view, pageSize, pageTokenLists time series that match a filter.
projects_time_series_createinsertprojectsIdCreates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response. This method does not support resource locations constraint of an organization policy (https://cloud.google.com/resource-manager/docs/organization-policy/defining-locations#setting_the_organization_policy).
projects_time_series_queryexecprojectsIdQueries time series by using Monitoring Query Language (MQL). We recommend using PromQL instead of MQL. For more information about the status of MQL, see the MQL deprecation notice (https://cloud.google.com/stackdriver/docs/deprecations/mql).

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
foldersIdstring
organizationsIdstring
projectsIdstring
aggregation.alignmentPeriodstring (google-duration)
aggregation.crossSeriesReducerstring
aggregation.groupByFieldsstring
aggregation.perSeriesAlignerstring
filterstring
interval.endTimestring (google-datetime)
interval.startTimestring (google-datetime)
orderBystring
pageSizeinteger (int32)
pageTokenstring
secondaryAggregation.alignmentPeriodstring (google-duration)
secondaryAggregation.crossSeriesReducerstring
secondaryAggregation.groupByFieldsstring
secondaryAggregation.perSeriesAlignerstring
viewstring

SELECT examples

Lists time series that match a filter.

SELECT
description,
metadata,
metric,
metricKind,
points,
resource,
unit,
valueType
FROM google.monitoring.time_series
WHERE projectsId = '{{ projectsId }}' -- required
AND filter = '{{ filter }}'
AND interval.endTime = '{{ interval.endTime }}'
AND interval.startTime = '{{ interval.startTime }}'
AND aggregation.alignmentPeriod = '{{ aggregation.alignmentPeriod }}'
AND aggregation.perSeriesAligner = '{{ aggregation.perSeriesAligner }}'
AND aggregation.crossSeriesReducer = '{{ aggregation.crossSeriesReducer }}'
AND aggregation.groupByFields = '{{ aggregation.groupByFields }}'
AND secondaryAggregation.alignmentPeriod = '{{ secondaryAggregation.alignmentPeriod }}'
AND secondaryAggregation.perSeriesAligner = '{{ secondaryAggregation.perSeriesAligner }}'
AND secondaryAggregation.crossSeriesReducer = '{{ secondaryAggregation.crossSeriesReducer }}'
AND secondaryAggregation.groupByFields = '{{ secondaryAggregation.groupByFields }}'
AND orderBy = '{{ orderBy }}'
AND view = '{{ view }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';

INSERT examples

Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response. This method does not support resource locations constraint of an organization policy (https://cloud.google.com/resource-manager/docs/organization-policy/defining-locations#setting_the_organization_policy).

INSERT INTO google.monitoring.time_series (
data__timeSeries,
projectsId
)
SELECT
'{{ timeSeries }}',
'{{ projectsId }}'
;

Lifecycle Methods

Queries time series by using Monitoring Query Language (MQL). We recommend using PromQL instead of MQL. For more information about the status of MQL, see the MQL deprecation notice (https://cloud.google.com/stackdriver/docs/deprecations/mql).

EXEC google.monitoring.time_series.projects_time_series_query 
@projectsId='{{ projectsId }}' --required
@@json=
'{
"query": "{{ query }}",
"pageSize": {{ pageSize }},
"pageToken": "{{ pageToken }}"
}';