Struct google_api_proto::google::cloud::timeseriesinsights::v1::TimeseriesParams
source · pub struct TimeseriesParams {
pub forecast_history: Option<Duration>,
pub granularity: Option<Duration>,
pub metric: Option<String>,
pub metric_aggregation_method: i32,
}
Expand description
Parameters that control how we construct the time series for each slice.
Fields§
§forecast_history: Option<Duration>
Required. How long should we go in the past when fetching the timeline used for forecasting each slice.
This is used in combination with the
[detectionTime][google.cloud.timeseriesinsights.v1.QueryDataSetRequest.detection_time] parameter.
The time series we construct will have the following time range:
\[detectionTime - forecastHistory, detectionTime + granularity\]
.
The forecast history might be rounded up, so that a multiple of
granularity
is used to process the query.
Note: If there are not enough events in the
\[detectionTime - forecastHistory, detectionTime + granularity\]
time
interval, the slice evaluation can fail. For more information, see
[EvaluatedSlice.status][google.cloud.timeseriesinsights.v1.EvaluatedSlice.status].
granularity: Option<Duration>
Required. The time granularity of the time series (on the x-axis). Each time series point starting at time T will aggregate all events for a particular slice in [T, T + granularity) time windows.
Note: The aggregation is decided based on the [metric][google.cloud.timeseriesinsights.v1.TimeseriesParams.metric] parameter.
This granularity defines the query-time aggregation windows and is not necessarily related to any event time granularity in the raw data (though we do recommend that the query-time granularity is not finer than the ingestion-time one).
Currently, the minimal supported granularity is 10 seconds.
metric: Option<String>
Optional. Denotes the [name][google.cloud.timeseriesinsights.v1.EventDimension.name] of a numerical dimension that will have its values aggregated to compute the y-axis of the time series.
The aggregation method must also be specified by setting the [metricAggregationMethod][google.cloud.timeseriesinsights.v1.TimeseriesParams.metric_aggregation_method] field.
Note: Currently, if the aggregation method is unspecified, we will default to SUM for backward compatibility reasons, but new implementations should set the [metricAggregationMethod][google.cloud.timeseriesinsights.v1.TimeseriesParams.metric_aggregation_method] explicitly.
If the metric is unspecified, we will use the number of events that each time series point contains as the point value.
Example: Let’s assume we have the following three events in our dataset:
{
eventTime: "2020-12-27T00:00:00Z",
dimensions: [
{ name: "d1" stringVal: "v1" },
{ name: "d2" stringVal: "v2" }
{ name: "m1" longVal: 100 }
{ name: "m2" longVal: 11 }
]
},
{
eventTime: "2020-12-27T00:10:00Z",
dimensions: [
{ name: "d1" stringVal: "v1" },
{ name: "d2" stringVal: "v2" }
{ name: "m1" longVal: 200 }
{ name: "m2" longVal: 22 }
]
},
{
eventTime: "2020-12-27T00:20:00Z",
dimensions: [
{ name: "d1" stringVal: "v1" },
{ name: "d2" stringVal: "v2" }
{ name: "m1" longVal: 300 }
{ name: "m2" longVal: 33 }
]
}
These events are all within the same hour, spaced 10 minutes between each of them. Assuming our [QueryDataSetRequest][google.cloud.timeseriesinsights.v1.QueryDataSetRequest] had set [slicingParams.dimensionNames][google.cloud.timeseriesinsights.v1.SlicingParams.dimension_names] to [“d1”, “d2”] and [timeseries_params.granularity][google.cloud.timeseriesinsights.v1.TimeseriesParams.granularity] to “3600s”, then all the previous events will be aggregated into the same [timeseries point][google.cloud.timeseriesinsights.v1.TimeseriesPoint].
The time series point that they’re all part of will have the [time][google.cloud.timeseriesinsights.v1.TimeseriesPoint.time] set to “2020-12-27T00:00:00Z” and the [value][google.cloud.timeseriesinsights.v1.TimeseriesPoint.value] populated based on this metric field:
- If the metric is set to “m1” and metric_aggregation_method to SUM, then the value of the point will be 600.
- If the metric is set to “m2” and metric_aggregation_method to SUM, then the value of the point will be 66.
- If the metric is set to “m1” and metric_aggregation_method to AVERAGE, then the value of the point will be 200.
- If the metric is set to “m2” and metric_aggregation_method to AVERAGE, then the value of the point will be 22.
- If the metric field is “” or unspecified, then the value of the point will be 3, as we will simply count the events.
metric_aggregation_method: i32
Optional. Together with the [metric][google.cloud.timeseriesinsights.v1.TimeseriesParams.metric] field, specifies how we will aggregate multiple events to obtain the value of a time series point. See the [metric][google.cloud.timeseriesinsights.v1.TimeseriesParams.metric] documentation for more details.
If the metric is not specified or “”, then this field will be ignored.
Implementations§
source§impl TimeseriesParams
impl TimeseriesParams
sourcepub fn metric(&self) -> &str
pub fn metric(&self) -> &str
Returns the value of metric
, or the default value if metric
is unset.
sourcepub fn metric_aggregation_method(&self) -> AggregationMethod
pub fn metric_aggregation_method(&self) -> AggregationMethod
Returns the enum value of metric_aggregation_method
, or the default if the field is set to an invalid enum value.
sourcepub fn set_metric_aggregation_method(&mut self, value: AggregationMethod)
pub fn set_metric_aggregation_method(&mut self, value: AggregationMethod)
Sets metric_aggregation_method
to the provided enum value.
Trait Implementations§
source§impl Clone for TimeseriesParams
impl Clone for TimeseriesParams
source§fn clone(&self) -> TimeseriesParams
fn clone(&self) -> TimeseriesParams
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TimeseriesParams
impl Debug for TimeseriesParams
source§impl Default for TimeseriesParams
impl Default for TimeseriesParams
source§impl Message for TimeseriesParams
impl Message for TimeseriesParams
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for TimeseriesParams
impl PartialEq for TimeseriesParams
source§fn eq(&self, other: &TimeseriesParams) -> bool
fn eq(&self, other: &TimeseriesParams) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for TimeseriesParams
Auto Trait Implementations§
impl Freeze for TimeseriesParams
impl RefUnwindSafe for TimeseriesParams
impl Send for TimeseriesParams
impl Sync for TimeseriesParams
impl Unpin for TimeseriesParams
impl UnwindSafe for TimeseriesParams
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request