Operations: Get Incremental Time Series
- Get time series entries using
GetTimeSeriesOperation
. -
Using this method, you can retrieve node values from incremental time series entries.
-
In this page:
GetTimeSeriesOperation
Use GetTimeSeriesOperation
to retrieve the distinct values stored per-node for the requested entries.
Syntax
-
GetTimeSeriesOperation
Definition:
public GetTimeSeriesOperation( string docId, string timeseries, DateTime? @from = null, DateTime? to = null, int start = 0, int pageSize = int.MaxValue, bool returnFullResults = false)
-
Parameters
Parameters Type Description docId
string
Document ID timeseries
string
Time series name from
(optional)DateTime?
Range start
Default:DateTime.Min
to
(optional)DateTime?
Range end
Default:DateTime.Max
start
int
Start of first Page pageSize
int
Size of each page, counted in entries with unique timestamps returnFullResults
bool
If true, retrieve the values stored per-node.
If false, returnnull
inTimeSeriesEntry.NodeValues
. -
Return Value:
TimeSeriesRangeResult<TimeSeriesEntry>
public class TimeSeriesRangeResult { public DateTime From, To; public TimeSeriesEntry[] Entries; // The number of unique values public long? TotalResults;
public class TimeSeriesEntry { public DateTime Timestamp { get; set; } public double[] Values { get; set; } public string Tag { get; set; } public bool IsRollup { get; set; } // The nodes distribution per each entry public Dictionary<string, double[]> NodeValues { get; set; }
TimeSeriesRangeResult.TotalResults
will contain the number of unique values.
If the time series contains entries with multiple values (remember that since this is an incremental time series this means duplications of the same number at the same timestamp) all values will be aggregated inTotalResults
to a single unique value.- Requesting a time series that doesn't exist will return
null
. - Requesting an entries range that doesn't exist will return a
TimeSeriesRangeResult
object with an emptyEntries
property.
-
Exceptions
Exceptions are not generated.
Usage Sample
- In this sample we retrieve 50 entries from an incremental time series that contains
two per-node values in each entry.
We then calculate where the nextGet
operation should start, and run anotherGet
operation starting there.
int pageSize = 100; var entries = store.Operations .Send(new GetTimeSeriesOperation("users/ayende", "INC:Downloads", start: 0, pageSize: pageSize, returnFullResults: true)); //load another page, starting with the first entry that wasn't read yet int nextStart = entries.Entries.Length; entries = store.Operations .Send(new GetTimeSeriesOperation("users/ayende", "INC:Downloads", start: nextStart, pageSize: pageSize, returnFullResults: true));
GetMultipleTimeSeriesOperation
To retrieve data from multiple time series, use GetMultipleTimeSeriesOperation.