net.opentsdb.core
public interface Query
Modifier and Type | Method and Description |
---|---|
void |
downsample(long interval,
Aggregator downsampler)
Downsamples the results by specifying a fixed interval between points.
|
long |
getEndTime()
Returns the end time of the graph.
|
long |
getStartTime()
Returns the start time of the graph.
|
DataPoints[] |
run()
Runs this query.
|
com.stumbleupon.async.Deferred<DataPoints[]> |
runAsync()
Executes the query asynchronously
|
void |
setEndTime(long timestamp)
Sets the end time of the graph.
|
void |
setStartTime(long timestamp)
Sets the start time of the graph.
|
void |
setTimeSeries(List<String> tsuids,
Aggregator function,
boolean rate)
Sets up a query for the given timeseries UIDs.
|
void |
setTimeSeries(List<String> tsuids,
Aggregator function,
boolean rate,
RateOptions rate_options)
Sets up a query for the given timeseries UIDs.
|
void |
setTimeSeries(String metric,
Map<String,String> tags,
Aggregator function,
boolean rate)
Sets the time series to the query.
|
void |
setTimeSeries(String metric,
Map<String,String> tags,
Aggregator function,
boolean rate,
RateOptions rate_options)
Sets the time series to the query.
|
void setStartTime(long timestamp)
timestamp
- The start time, all the data points returned will have a
timestamp greater than or equal to this one.IllegalArgumentException
- if timestamp is less than or equal to 0,
or if it can't fit on 32 bits.IllegalArgumentException
- if
timestamp >=
getEndTime
.long getStartTime()
IllegalStateException
- if setStartTime(long)
was never called on
this instance before.void setEndTime(long timestamp)
timestamp
- The end time, all the data points returned will have a
timestamp less than or equal to this one.IllegalArgumentException
- if timestamp is less than or equal to 0,
or if it can't fit on 32 bits.IllegalArgumentException
- if
timestamp <=
getStartTime
.long getEndTime()
If setEndTime(long)
was never called before, this method will
automatically execute
setEndTime
(System.currentTimeMillis() / 1000)
to set the end time.
void setTimeSeries(String metric, Map<String,String> tags, Aggregator function, boolean rate, RateOptions rate_options) throws NoSuchUniqueName
metric
- The metric to retreive from the TSDB.tags
- The set of tags of interest.function
- The aggregation function to use.rate
- If true, the rate of the series will be used instead of the
actual values.rate_options
- If included specifies additional options that are used
when calculating and graph rate valuesNoSuchUniqueName
- if the name of a metric, or a tag name/value
does not exist.void setTimeSeries(String metric, Map<String,String> tags, Aggregator function, boolean rate) throws NoSuchUniqueName
metric
- The metric to retreive from the TSDB.tags
- The set of tags of interest.function
- The aggregation function to use.rate
- If true, the rate of the series will be used instead of the
actual values.NoSuchUniqueName
- if the name of a metric, or a tag name/value
does not exist.void setTimeSeries(List<String> tsuids, Aggregator function, boolean rate)
tsuids
- A list of one or more TSUIDs to scan forfunction
- The aggregation function to use on resultsrate
- Whether or not the results should be converted to a rateIllegalArgumentException
- if the tsuid list is null, empty or the
TSUIDs do not share a common metricvoid setTimeSeries(List<String> tsuids, Aggregator function, boolean rate, RateOptions rate_options)
tsuids
- A list of one or more TSUIDs to scan forfunction
- The aggregation function to use on resultsrate
- Whether or not the results should be converted to a raterate_options
- If included specifies additional options that are used
when calculating and graph rate valuesIllegalArgumentException
- if the tsuid list is null, empty or the
TSUIDs do not share a common metricvoid downsample(long interval, Aggregator downsampler)
Technically, downsampling means reducing the sampling interval. Here
the idea is similar. Instead of returning every single data point that
matched the query, we want one data point per fixed time interval. The
way we get this one data point is by aggregating all the data points of
that interval together using an Aggregator
. This enables you
to compute things like the 5-minute average or 10 minute 99th percentile.
interval
- Number of seconds wanted between each data point.downsampler
- Aggregation function to use to group data points
within an interval.DataPoints[] run() throws org.hbase.async.HBaseException
Each element in the non-null
but possibly empty array returned
corresponds to one time series for which some data points have been
matched by the query.
org.hbase.async.HBaseException
- if there was a problem communicating with HBase to
perform the search.com.stumbleupon.async.Deferred<DataPoints[]> runAsync() throws org.hbase.async.HBaseException
Each element in the non-null
but possibly empty array returned
corresponds to one time series for which some data points have been
matched by the query.
org.hbase.async.HBaseException
- if there was a problem communicating with HBase to
perform the search.