Struct rustis::commands::TsMRangeOptions
source · pub struct TsMRangeOptions { /* private fields */ }
redis-time-series
only.Expand description
Options for the ts_mrange
and
ts_mrevrange
commands.
Implementations§
source§impl TsMRangeOptions
impl TsMRangeOptions
sourcepub fn latest(self) -> Self
pub fn latest(self) -> Self
Used when a time series is a compaction.
With latest
, ts_mrange
also reports the compacted value of the latest possibly partial bucket,
given that this bucket’s start time falls within [from_timestamp
, to_timestamp
].
Without latest
, ts_mrange
does not report the latest possibly partial bucket.
When a time series is not a compaction, latest
is ignored.
The data in the latest bucket of a compaction is possibly partial.
A bucket is closed and compacted only upon arrival of a new sample that opens a new latest bucket.
There are cases, however, when the compacted value of the latest possibly partial bucket is also required.
In such a case, use latest
.
sourcepub fn filter_by_ts(self, ts: impl SingleArgCollection<u64>) -> Self
pub fn filter_by_ts(self, ts: impl SingleArgCollection<u64>) -> Self
filters samples by a list of specific timestamps.
A sample passes the filter if its exact timestamp is specified and falls within [from_timestamp
, to_timestamp
].
sourcepub fn filter_by_value(self, min: f64, max: f64) -> Self
pub fn filter_by_value(self, min: f64, max: f64) -> Self
filters samples by minimum and maximum values.
sourcepub fn withlabels(self) -> Self
pub fn withlabels(self) -> Self
Includes in the reply all label-value pairs representing metadata labels of the time series.
If withlabels
or selected_labels
are not specified, by default, an empty list is reported as label-value pairs.
sourcepub fn selected_labels<L: SingleArg>(
self,
labels: impl SingleArgCollection<L>
) -> Self
pub fn selected_labels<L: SingleArg>( self, labels: impl SingleArgCollection<L> ) -> Self
returns a subset of the label-value pairs that represent metadata labels of the time series.
Use when a large number of labels exists per series, but only the values of some of the labels are required.
If withlabels
or selected_labels
are not specified, by default, an empty list is reported as label-value pairs.
sourcepub fn align(self, align: impl SingleArg) -> Self
pub fn align(self, align: impl SingleArg) -> Self
A time bucket alignment control for aggregation
.
It controls the time bucket timestamps by changing the reference timestamp on which a bucket is defined.
Values include:
start
or-
: The reference timestamp will be the query start interval time (from_timestamp
) which can’t be-
end
or+
: The reference timestamp will be the query end interval time (to_timestamp
) which can’t be+
- A specific timestamp: align the reference timestamp to a specific time
§Note
When not provided, alignment is set to 0.
sourcepub fn aggregation(
self,
aggregator: TsAggregationType,
bucket_duration: u64
) -> Self
pub fn aggregation( self, aggregator: TsAggregationType, bucket_duration: u64 ) -> Self
Aggregates results into time buckets, where:
aggregator
- takes a value ofTsAggregationType
bucket_duration
- is duration of each bucket, in milliseconds.
Without align
, bucket start times are multiples of bucket_duration
.
With align
, bucket start times are multiples of bucket_duration
with remainder align
% bucket_duration
.
The first bucket start time is less than or equal to from_timestamp
.
sourcepub fn bucket_timestamp(self, bucket_timestamp: u64) -> Self
pub fn bucket_timestamp(self, bucket_timestamp: u64) -> Self
controls how bucket timestamps are reported.
bucket_timestamp
values include:
-
orlow
- Timestamp reported for each bucket is the bucket’s start time (default)+
orhigh
- Timestamp reported for each bucket is the bucket’s end time~
ormid
- Timestamp reported for each bucket is the bucket’s mid time (rounded down if not an integer)
sourcepub fn empty(self) -> Self
pub fn empty(self) -> Self
A flag, which, when specified, reports aggregations also for empty buckets.
when aggregator
values are:
sum
,count
- the value reported for each empty bucket is0
last
- the value reported for each empty bucket is the value of the last sample before the bucket’s start.NaN
when no such sample.twa
- the value reported for each empty bucket is the average value over the bucket’s timeframe based on linear interpolation of the last sample before the bucket’s start and the first sample after the bucket’s end.NaN
when no such samples.min
,max
,range
,avg
,first
,std.p
,std.s
- the value reported for each empty bucket isNaN
Regardless of the values of from_timestamp
and to_timestamp
,
no data is reported for buckets that end before the earliest sample or begin after the latest sample in the time series.