Struct rustis::commands::TsRangeOptions
source · pub struct TsRangeOptions { /* private fields */ }
redis-time-series
only.Expand description
Options for the ts_range
and
ts_revrange
commands.
Implementations§
source§impl TsRangeOptions
impl TsRangeOptions
sourcepub fn latest(self) -> Self
pub fn latest(self) -> Self
Used when a time series is a compaction.
With latest
, ts_range
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_range
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 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.