#[non_exhaustive]pub struct TimeSeries {
pub metric: String,
pub value_type: ValueType,
pub metric_kind: MetricKind,
pub points: Vec<Point>,
/* private fields */
}Expand description
The metrics object for a SubTask.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.metric: StringRequired. The name of the metric.
If the metric is not known by the service yet, it will be auto-created.
value_type: ValueTypeRequired. The value type of the time series.
metric_kind: MetricKindOptional. The metric kind of the time series.
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.
points: Vec<Point>Required. The 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.
Implementations§
Source§impl TimeSeries
impl TimeSeries
pub fn new() -> Self
Sourcepub fn set_metric<T: Into<String>>(self, v: T) -> Self
pub fn set_metric<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_value_type<T: Into<ValueType>>(self, v: T) -> Self
pub fn set_value_type<T: Into<ValueType>>(self, v: T) -> Self
Sets the value of value_type.
§Example
use api::model::metric_descriptor::ValueType;
let x0 = TimeSeries::new().set_value_type(ValueType::Bool);
let x1 = TimeSeries::new().set_value_type(ValueType::Int64);
let x2 = TimeSeries::new().set_value_type(ValueType::Double);Sourcepub fn set_metric_kind<T: Into<MetricKind>>(self, v: T) -> Self
pub fn set_metric_kind<T: Into<MetricKind>>(self, v: T) -> Self
Sets the value of metric_kind.
§Example
use api::model::metric_descriptor::MetricKind;
let x0 = TimeSeries::new().set_metric_kind(MetricKind::Gauge);
let x1 = TimeSeries::new().set_metric_kind(MetricKind::Delta);
let x2 = TimeSeries::new().set_metric_kind(MetricKind::Cumulative);Sourcepub fn set_points<T, V>(self, v: T) -> Self
pub fn set_points<T, V>(self, v: T) -> Self
Trait Implementations§
Source§impl Clone for TimeSeries
impl Clone for TimeSeries
Source§fn clone(&self) -> TimeSeries
fn clone(&self) -> TimeSeries
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more