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
GetTimeSeriesOperationDefinition:
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 docIdstringDocument ID timeseriesstringTime series name from(optional)DateTime?Range start
Default:DateTime.Minto(optional)DateTime?Range end
Default:DateTime.MaxstartintStart of first Page pageSizeintSize of each page, counted in entries with unique timestamps returnFullResultsboolIf true, retrieve the values stored per-node.
If false, returnnullinTimeSeriesEntry.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.TotalResultswill 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 inTotalResultsto 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
TimeSeriesRangeResultobject with an emptyEntriesproperty. -
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 nextGetoperation should start, and run anotherGetoperation 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.