本文整理汇总了Java中net.opentsdb.core.WritableDataPoints类的典型用法代码示例。如果您正苦于以下问题:Java WritableDataPoints类的具体用法?Java WritableDataPoints怎么用?Java WritableDataPoints使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WritableDataPoints类属于net.opentsdb.core包,在下文中一共展示了WritableDataPoints类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeDataPoints
import net.opentsdb.core.WritableDataPoints; //导入依赖的package包/类
/**
* Main entry method for adding points
*
* @param data points list
*/
private void writeDataPoints(List<EventData> data) throws Exception {
if (data.size() < 1)
return;
final WritableDataPoints dataPoints = tsdb.newDataPoints();
final EventData first = data.get(0);
dataPoints.setSeries(first.metric, first.tags);
dataPoints.setBatchImport(false); // we need data to be persisted
long prevTs = 0;
Set<String> failures = new HashSet<String>();
for (EventData eventData : data) {
try {
if (eventData.timestamp == prevTs)
continue;
sinkCounter.incrementEventDrainAttemptCount();
prevTs = eventData.timestamp;
final Deferred<Object> d =
eventData.makeDeferred(dataPoints, this);
d.addCallback(new Callback<Object, Object>() {
@Override
public Object call(Object o) throws Exception {
pointsCounter.mark();
inFlight.decrementAndGet();
signal.release();
return null;
}
});
d.addErrback(this);
if (throttle)
throttle(d);
inFlight.incrementAndGet();
sinkCounter.incrementEventDrainSuccessCount();
} catch (IllegalArgumentException ie) {
failures.add(ie.getMessage());
}
}
if (failures.size() > 0) {
logger.error("Points imported with " + failures.toString() + " IllegalArgumentExceptions");
}
}
示例2: makeDeferred
import net.opentsdb.core.WritableDataPoints; //导入依赖的package包/类
public Deferred<Object> makeDeferred(WritableDataPoints dp, State state) {
Deferred<Object> d;
if (Tags.looksLikeInteger(value)) {
d = dp.addPoint(timestamp, Tags.parseLong(value));
} else { // floating point value
d = dp.addPoint(timestamp, Float.parseFloat(value));
}
return d;
}
示例3: makeDeferred
import net.opentsdb.core.WritableDataPoints; //导入依赖的package包/类
public Deferred<Object> makeDeferred(WritableDataPoints dp) {
Deferred<Object> d;
if (Tags.looksLikeInteger(value)) {
d = dp.addPoint(timestamp, Tags.parseLong(value));
} else { // floating point value
d = dp.addPoint(timestamp, Float.parseFloat(value));
}
return d;
}
示例4: newDataPoints
import net.opentsdb.core.WritableDataPoints; //导入依赖的package包/类
/**
* {@inheritDoc}
* @see com.heliosapm.tsdbex.test.mocks.ITSDB#newDataPoints()
*/
@Override
public WritableDataPoints newDataPoints() {
return null;
}
示例5: newDataPoints
import net.opentsdb.core.WritableDataPoints; //导入依赖的package包/类
/**
* Returns a new {@link WritableDataPoints} instance suitable for this TSDB.
* <p>
* If you want to add a single data-point, consider using {@link #addPoint}
* instead.
* @return The writable data points
*/
public WritableDataPoints newDataPoints();