You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please refer to the `Metrics`_ documentation for more information.
328
+
329
+
With a Metric and Resource specified, the :class:`~gcloud.monitoring.timeseries.MetricStream`
330
+
can be used to write :class:`~gcloud.monitoring.timeseries.Point` values.
331
+
:class:`~gcloud.monitoring.timeseries.MetricStream` is a helper class that helps create
332
+
:class:`~gcloud.monitoring.timeseries.TimeSeries` objects with the same Metric and Resource types.
333
+
334
+
When writing points with :class:`~gcloud.monitoring.timeseries.MetricStream`, you specify
335
+
points containing a value of the type that matches the *value_type* specified in the associated
336
+
:class:`~gcloud.monitoring.metric.MetricDescriptor`. The point must also contain a time interval.
337
+
The point's time interval must be later than any points already created for the same
338
+
:class:`~gcloud.monitoring.timeseries.TimeSeries`
339
+
(where :class:`~gcloud.monitoring.timeseries.TimeSeries` with matching :class:`~gcloud.monitoring.metric.Metric` and :class:`~gcloud.monitoring.resource.Resource` types are considered the same).
340
+
The end
341
+
time of the interval must not be more than 24 hours in the past or more than five minutes in the
342
+
future::
343
+
344
+
>>> start = datetime.utcnow()
345
+
>>> end = datetime.utcnow() - datetime.timedelta(minutes=5)
346
+
>>> value = get_num_404s_in_last_five_minutes() # get value from a hypothetical call
0 commit comments