# Cloud Monitoring API . timeseries

## Instance Methods

List the data points of the time series that match the metric and labels values and that have data points in the interval. Large responses are paginated; use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.

Retrieves the next page of results.

Put data points to one or more time series for one or more metrics. If a time series does not exist, a new time series will be created. It is not allowed to write a time series point that is older than the existing youngest point of that time series. Points that are older than the existing youngest point of that time series will be discarded silently. Therefore, users should make sure that points of a time series are written sequentially in the order of their end time.

### Method Details

`list(project, metric, youngest, count=None, timespan=None, aggregator=None, labels=None, window=None, pageToken=None, oldest=None)`

    List the data points of the time series that match the metric and labels values and that have data points in the interval. Large responses are paginated; use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.

    Args:
      project: string, The project ID to which this time series belongs. The value can be the numeric project ID or string-based project name. (required)
      metric: string, Metric names are protocol-free URLs as listed in the Supported Metrics page. For example, compute.googleapis.com/instance/disk/read_ops_count. (required)
      youngest: string, End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp. (required)
      count: integer, Maximum number of data points per page, which is used for pagination of results.
      timespan: string, Length of the time interval to query, which is an alternative way to declare the interval: (youngest - timespan, youngest]. The timespan and oldest parameters should not be used together. Units:
    - s: second
    - m: minute
    - h: hour
    - d: day
    - w: week  Examples: 2s, 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.

    If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest].
      aggregator: string, The aggregation function that will reduce the data points in each window to a single point. This parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.
        Allowed values
          max -
          mean -
          min -
          sum -
      labels: string, A collection of labels for the matching time series, which are represented as:
    - key==value: key equals the value
    - key=~value: key regex matches the value
    - key!=value: key does not equal the value
    - key!~value: key regex does not match the value  For example, to list all of the time series descriptors for the region us-central1, you could specify:
    label=cloud.googleapis.com%2Flocation=~us-central1.* (repeated)
      window: string, The sampling window. At most one data point will be returned for each window in the requested time interval. This parameter is only valid for non-cumulative metric types. Units:
    - m: minute
    - h: hour
    - d: day
    - w: week  Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
      pageToken: string, The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.
      oldest: string, Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]

    Returns:
      An object of the form:

        { # The response of cloudmonitoring.timeseries.list
        "nextPageToken": "A String", # Pagination token. If present, indicates that additional results are available for retrieval. To access the results past the pagination limit, set the pageToken query parameter to this value. All of the points of a time series will be returned before returning any point of the subsequent time series.
        "youngest": "A String", # The youngest timestamp of the interval of this query as an RFC 3339 string.
        "kind": "cloudmonitoring#listTimeseriesResponse", # Identifies what kind of resource this is. Value: the fixed string "cloudmonitoring#listTimeseriesResponse".
        "oldest": "A String", # The oldest timestamp of the interval of this query as an RFC 3339 string.
        "timeseries": [ # The returned time series.
          { # The monitoring data is organized as metrics and stored as data points that are recorded over time. Each data point represents information like the CPU utilization of your virtual machine. A historical record of these data points is called a time series.
            "timeseriesDesc": { # TimeseriesDescriptor identifies a single time series. # The descriptor of this time series.
              "project": "A String", # The Developers Console project number to which this time series belongs.
              "metric": "A String", # The name of the metric.
              "labels": { # The label's name.
                "a_key": "A String", # The label's name.
              },
            },
            "points": [ # The data points of this time series. The points are listed in order of their end timestamp, from younger to older.
              { # Point is a single point in a time series. It consists of a start time, an end time, and a value.
                "end": "A String", # The interval [start, end] is the time period to which the point's value applies. For gauge metrics, whose values are instantaneous measurements, this interval should be empty (start should equal end). For cumulative metrics (of which deltas and rates are special cases), the interval should be non-empty. Both start and end are RFC 3339 strings.
                "doubleValue": 3.14, # The value of this data point as a double-precision floating-point number.
                "start": "A String", # The interval [start, end] is the time period to which the point's value applies. For gauge metrics, whose values are instantaneous measurements, this interval should be empty (start should equal end). For cumulative metrics (of which deltas and rates are special cases), the interval should be non-empty. Both start and end are RFC 3339 strings.
                "boolValue": True or False, # The value of this data point. Either "true" or "false".
                "distributionValue": { # Distribution data point value type. When writing distribution points, try to be consistent with the boundaries of your buckets. If you must modify the bucket boundaries, then do so by merging, partitioning, or appending rather than skewing them. # The value of this data point as a distribution. A distribution value can contain a list of buckets and/or an underflowBucket and an overflowBucket. The values of these points can be used to create a histogram.
                  "buckets": [ # The finite buckets.
                    { # The histogram's bucket. Buckets that form the histogram of a distribution value. If the upper bound of a bucket, say U1, does not equal the lower bound of the next bucket, say L2, this means that there is no event in [U1, L2).
                      "count": "A String", # The number of events whose values are in the interval defined by this bucket.
                      "lowerBound": 3.14, # The lower bound of the value interval of this bucket (inclusive).
                      "upperBound": 3.14, # The upper bound of the value interval of this bucket (exclusive).
                    },
                  ],
                  "underflowBucket": { # The underflow bucket is a special bucket that does not have the lowerBound field; it includes all of the events that are less than its upper bound. # The underflow bucket.
                    "count": "A String", # The number of events whose values are in the interval defined by this bucket.
                    "upperBound": 3.14, # The upper bound of the value interval of this bucket (exclusive).
                  },
                  "overflowBucket": { # The overflow bucket is a special bucket that does not have the upperBound field; it includes all of the events that are no less than its lower bound. # The overflow bucket.
                    "count": "A String", # The number of events whose values are in the interval defined by this bucket.
                    "lowerBound": 3.14, # The lower bound of the value interval of this bucket (inclusive).
                  },
                },
                "stringValue": "A String", # The value of this data point in string format.
                "int64Value": "A String", # The value of this data point as a 64-bit integer.
              },
            ],
          },
        ],
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`write(project, body)`

    Put data points to one or more time series for one or more metrics. If a time series does not exist, a new time series will be created. It is not allowed to write a time series point that is older than the existing youngest point of that time series. Points that are older than the existing youngest point of that time series will be discarded silently. Therefore, users should make sure that points of a time series are written sequentially in the order of their end time.

    Args:
      project: string, The project ID. The value can be the numeric project ID or string-based project name. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # The request of cloudmonitoring.timeseries.write
        "timeseries": [ # Provide time series specific labels and the data points for each time series. The labels in timeseries and the common_labels should form a complete list of labels that required by the metric.
          { # When writing time series, TimeseriesPoint should be used instead of Timeseries, to enforce single point for each time series in the timeseries.write request.
            "timeseriesDesc": { # TimeseriesDescriptor identifies a single time series. # The descriptor of this time series.
              "project": "A String", # The Developers Console project number to which this time series belongs.
              "metric": "A String", # The name of the metric.
              "labels": { # The label's name.
                "a_key": "A String", # The label's name.
              },
            },
            "point": { # Point is a single point in a time series. It consists of a start time, an end time, and a value. # The data point in this time series snapshot.
              "end": "A String", # The interval [start, end] is the time period to which the point's value applies. For gauge metrics, whose values are instantaneous measurements, this interval should be empty (start should equal end). For cumulative metrics (of which deltas and rates are special cases), the interval should be non-empty. Both start and end are RFC 3339 strings.
              "doubleValue": 3.14, # The value of this data point as a double-precision floating-point number.
              "start": "A String", # The interval [start, end] is the time period to which the point's value applies. For gauge metrics, whose values are instantaneous measurements, this interval should be empty (start should equal end). For cumulative metrics (of which deltas and rates are special cases), the interval should be non-empty. Both start and end are RFC 3339 strings.
              "boolValue": True or False, # The value of this data point. Either "true" or "false".
              "distributionValue": { # Distribution data point value type. When writing distribution points, try to be consistent with the boundaries of your buckets. If you must modify the bucket boundaries, then do so by merging, partitioning, or appending rather than skewing them. # The value of this data point as a distribution. A distribution value can contain a list of buckets and/or an underflowBucket and an overflowBucket. The values of these points can be used to create a histogram.
                "buckets": [ # The finite buckets.
                  { # The histogram's bucket. Buckets that form the histogram of a distribution value. If the upper bound of a bucket, say U1, does not equal the lower bound of the next bucket, say L2, this means that there is no event in [U1, L2).
                    "count": "A String", # The number of events whose values are in the interval defined by this bucket.
                    "lowerBound": 3.14, # The lower bound of the value interval of this bucket (inclusive).
                    "upperBound": 3.14, # The upper bound of the value interval of this bucket (exclusive).
                  },
                ],
                "underflowBucket": { # The underflow bucket is a special bucket that does not have the lowerBound field; it includes all of the events that are less than its upper bound. # The underflow bucket.
                  "count": "A String", # The number of events whose values are in the interval defined by this bucket.
                  "upperBound": 3.14, # The upper bound of the value interval of this bucket (exclusive).
                },
                "overflowBucket": { # The overflow bucket is a special bucket that does not have the upperBound field; it includes all of the events that are no less than its lower bound. # The overflow bucket.
                  "count": "A String", # The number of events whose values are in the interval defined by this bucket.
                  "lowerBound": 3.14, # The lower bound of the value interval of this bucket (inclusive).
                },
              },
              "stringValue": "A String", # The value of this data point in string format.
              "int64Value": "A String", # The value of this data point as a 64-bit integer.
            },
          },
        ],
        "commonLabels": { # The label's name.
          "a_key": "A String", # The label's name.
        },
      }

    Returns:
      An object of the form:

        { # The response of cloudmonitoring.timeseries.write
        "kind": "cloudmonitoring#writeTimeseriesResponse", # Identifies what kind of resource this is. Value: the fixed string "cloudmonitoring#writeTimeseriesResponse".
      }