net.opentsdb.core
public interface WritableDataPoints extends DataPoints
Implementations of this interface aren't expected to be synchronized.
Modifier and Type | Method and Description |
---|---|
com.stumbleupon.async.Deferred<Object> |
addPoint(long timestamp,
float value)
Appends a
float data point to this sequence. |
com.stumbleupon.async.Deferred<Object> |
addPoint(long timestamp,
long value)
Adds a
long data point to the TSDB. |
void |
setBatchImport(boolean batchornot)
Specifies whether or not this is a batch import.
|
void |
setBufferingTime(short time)
Specifies for how long to buffer edits, in milliseconds.
|
void |
setSeries(String metric,
Map<String,String> tags)
Sets the metric name and tags of the series.
|
aggregatedSize, doubleValue, getAggregatedTags, getAggregatedTagsAsync, getAnnotations, getTags, getTagsAsync, getTSUIDs, isInteger, iterator, longValue, metricName, metricNameAsync, size, timestamp
void setSeries(String metric, Map<String,String> tags)
This method can be called multiple times on the same instance to start adding data points to another time series without having to create a new instance.
metric
- A non-empty string.tags
- The tags on this series. This map must be non-empty.IllegalArgumentException
- if the metric name is empty or contains
illegal characters.IllegalArgumentException
- if the tags list is empty or one of the
elements contains illegal characters.com.stumbleupon.async.Deferred<Object> addPoint(long timestamp, long value)
long
data point to the TSDB.
The data point is immediately persisted unless setBufferingTime(short)
is used. Data points must be added in chronological order.
timestamp
- The timestamp associated with the value.value
- The value of the data point.Object
has not special meaning and can be null
(think
of it as Deferred<Void>
). But you probably want to attach at
least an errback to this Deferred
to handle failures.IllegalArgumentException
- if the timestamp is less than or equal
to the previous timestamp added or 0 for the first timestamp, or if the
difference with the previous timestamp is too large.org.hbase.async.HBaseException
- (deferred) if there was a problem while persisting
data.com.stumbleupon.async.Deferred<Object> addPoint(long timestamp, float value)
float
data point to this sequence.
The data point is immediately persisted unless setBufferingTime(short)
is used. Data points must be added in chronological order.
timestamp
- The timestamp associated with the value.value
- The value of the data point.Object
has not special meaning and can be null
(think
of it as Deferred<Void>
). But you probably want to attach at
least an errback to this Deferred
to handle failures.IllegalArgumentException
- if the timestamp is less than or equal
to the previous timestamp added or 0 for the first timestamp, or if the
difference with the previous timestamp is too large.IllegalArgumentException
- if the value is NaN
or
Infinite
.org.hbase.async.HBaseException
- (deferred) if there was a problem while persisting
data.void setBufferingTime(short time)
By calling this method, you're allowing new data points to be buffered
before being sent to HBase. 0
(the default) means data points
are persisted immediately.
Buffering improves performance, reduces the number of RPCs sent to HBase, but can cause data loss if we die before we get a chance to send buffered edits to HBase. It also entails that buffered data points aren't visible to other applications using the TSDB until they're flushed to HBase.
time
- The approximate maximum number of milliseconds for which data
points should be buffered before being sent to HBase. This deadline will
be honored on a "best effort" basis.void setBatchImport(boolean batchornot)
It is preferred that this method be called for anything importing a batch of data points (as opposed to streaming in new data points in real time).
Calling this method changes a few important things:
setBufferingTime(short)
may be called with an argument
chosen by the implementation.batchornot
- if true, then this is a batch import.