本文整理汇总了Java中org.influxdb.dto.Point.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java Point.Builder方法的具体用法?Java Point.Builder怎么用?Java Point.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.influxdb.dto.Point
的用法示例。
在下文中一共展示了Point.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.influxdb.dto.Point; //导入方法依赖的package包/类
@Override
public void run() {
Point.Builder playersBuilder = AnalyticsType.WORLD_PLAYERS.newPoint();
Point.Builder chunksBuilder = AnalyticsType.WORLD_CHUNKS.newPoint();
Point.Builder entityBuilder = AnalyticsType.WORLD_ENTITIES.newPoint();
Point.Builder tileBuilder = AnalyticsType.WORLD_TILE_ENTITIES.newPoint();
for (W world : getWorlds()) {
String worldName = getName(world);
playersBuilder.addField(worldName, getPlayers(world));
chunksBuilder.addField(worldName, getChunks(world));
entityBuilder.addField(worldName, getEntities(world));
tileBuilder.addField(worldName, getTileEntities(world));
}
send(playersBuilder);
send(chunksBuilder);
send(entityBuilder);
send(tileBuilder);
}
示例2: processMeter
import org.influxdb.dto.Point; //导入方法依赖的package包/类
@Override
public void processMeter(MetricName metricName, Metered meter, Context context) throws Exception {
Point.Builder pointbuilder = super.buildMetricsPointByMetricName(metricName, context);
pointbuilder.tag("metric_type", "meter");
pointbuilder.tag("eventType", meter.eventType());
if (dimensions.contains(count))
pointbuilder.addField("count", meter.count());
if (dimensions.contains(meanRate))
pointbuilder.addField("meanRate", meter.meanRate());
if (dimensions.contains(rate1m))
pointbuilder.addField("1MinuteRate", meter.oneMinuteRate());
if (dimensions.contains(rate5m))
pointbuilder.addField("5MinuteRate", meter.fiveMinuteRate());
if (dimensions.contains(rate15m))
pointbuilder.addField("15MinuteRate", meter.fifteenMinuteRate());
addPoint(pointbuilder.build());
}
示例3: processGauge
import org.influxdb.dto.Point; //导入方法依赖的package包/类
public void processGauge(MetricName name, Gauge<?> gauge, Context context) throws Exception {
Point.Builder pointbuilder = buildMetricsPointByMetricName(name, context);
pointbuilder.tag("metric_type", "gague");
Object fieldValue = gauge.value();
String fieldName = "value";
// Long Interger transfer Float in case of schema conflict
if (fieldValue instanceof Float)
pointbuilder.addField(fieldName, (Float) fieldValue);
else if (fieldValue instanceof Double)
pointbuilder.addField(fieldName, (Double) fieldValue);
else if (fieldValue instanceof Long)
pointbuilder.addField(fieldName, Float.valueOf(((Long) fieldValue).toString()));
else if (fieldValue instanceof Integer)
pointbuilder.addField(fieldName, Float.valueOf(((Integer) fieldValue).toString()));
else if (fieldValue instanceof String)
pointbuilder.addField(fieldName, (String) fieldValue);
else
return;
addPoint(pointbuilder.build());
}
示例4: processHistogram
import org.influxdb.dto.Point; //导入方法依赖的package包/类
@Override
public void processHistogram(MetricName metricName, Histogram histogram, Context context) throws Exception {
final Snapshot snapshot = histogram.getSnapshot();
Point.Builder pointbuilder = buildMetricsPointByMetricName(metricName, context);
pointbuilder.tag("metric_type", "histogram");
pointbuilder.addField("max", histogram.max());
pointbuilder.addField("mean", histogram.mean());
pointbuilder.addField("min", histogram.min());
pointbuilder.addField("stddev", histogram.max());
pointbuilder.addField("sum", histogram.sum());
pointbuilder.addField("median", snapshot.getMedian());
pointbuilder.addField("p75", snapshot.get75thPercentile());
pointbuilder.addField("p95", snapshot.get95thPercentile());
pointbuilder.addField("p98", snapshot.get98thPercentile());
pointbuilder.addField("p99", snapshot.get99thPercentile());
pointbuilder.addField("p999", snapshot.get999thPercentile());
addPoint(pointbuilder.build());
}
示例5: buildMetricsPointByMetricName
import org.influxdb.dto.Point; //导入方法依赖的package包/类
Point.Builder buildMetricsPointByMetricName(MetricName metricName, Context context) {
Point.Builder pointbuilder = Point.measurement(metricName.getName())
.time(context.getTime(), TimeUnit.MILLISECONDS)
.tag(this.tags)
.tag("group", metricName.getGroup())
.tag("type", metricName.getType());
if (metricName.hasScope()) {
String scope = metricName.getScope();
List<String> scopes = Arrays.asList(scope.split("\\."));
if (scopes.size() % 2 == 0) {
Iterator<String> iterator = scopes.iterator();
while (iterator.hasNext()) {
pointbuilder.tag(iterator.next(), iterator.next());
}
} else pointbuilder.tag("scope", scope);
}
return pointbuilder;
}
示例6: createCalibrationPoint
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private Point createCalibrationPoint(Calibration record) {
Point.Builder builder = Point.measurement("calibration")
.time(record.timestamp, TimeUnit.MILLISECONDS)
.tag("device", "xDrip-" + prefs.getString("dex_collection_method", "BluetoothWixel"))
.tag("type", "cal");
if (record.check_in) {
builder.addField("slope", record.first_slope)
.addField("intercept", record.first_intercept)
.addField("scale", record.first_scale);
} else {
builder.addField("slope", (1000 / record.slope))
.addField("intercept", ((record.intercept * -1000) / record.slope))
.addField("scale", 1);
}
return builder.build();
}
示例7: invoke
import org.influxdb.dto.Point; //导入方法依赖的package包/类
/**
* Called when new data arrives to the sink, and forwards it to InfluxDB.
*
* @param dataPoint {@link InfluxDBPoint}
*/
@Override
public void invoke(InfluxDBPoint dataPoint) throws Exception {
if (StringUtils.isNullOrWhitespaceOnly(dataPoint.getMeasurement())) {
throw new RuntimeException("No measurement defined");
}
Point.Builder builder = Point.measurement(dataPoint.getMeasurement())
.time(dataPoint.getTimestamp(), TimeUnit.MILLISECONDS);
if (!CollectionUtil.isNullOrEmpty(dataPoint.getFields())) {
builder.fields(dataPoint.getFields());
}
if (!CollectionUtil.isNullOrEmpty(dataPoint.getTags())) {
builder.tag(dataPoint.getTags());
}
Point point = builder.build();
influxDBClient.write(point);
}
示例8: generateTestPoint
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private Point generateTestPoint(Test test) {
Point.Builder builder = buildPoint(measurementName("perfpublisher_test"), customPrefix, build)
.addField("test_name", test.getName())
.addField("successful", test.isSuccessfull())
.addField("executed", test.isExecuted());
if (test.getMessage() != null)
builder.addField("message", test.getMessage());
if (test.isCompileTime())
builder.addField("compile_time", test.getCompileTime().getMeasure());
if (test.isExecutionTime())
builder.addField("execution_time", test.getExecutionTime().getMeasure());
if (test.isPerformance())
builder.addField("performance", test.getPerformance().getMeasure());
return builder.build();
}
示例9: toDBPoint
import org.influxdb.dto.Point; //导入方法依赖的package包/类
/**
* Create an InfluxDB Point that can be saved into InfluxDB database
*
* @return point
*/
public Point toDBPoint() {
// get tags without nulls
Map tags = getObjectTags();
removeNullValues(tags);
// get fields without nulls
Map fields = getObjectFields();
removeNullValues(fields);
// start building DB Point
Point.Builder builder = Point.measurement(getMeasurementName());
Long time = getTime();
if (time != null && time > 0) {
builder = builder.time(time, TimeUnit.MILLISECONDS);
}
// finish up and return constructed DB point
return builder.tag(tags).fields(fields).build();
}
示例10: setValue
import org.influxdb.dto.Point; //导入方法依赖的package包/类
/**
* Set value with correct type for InfluxDB based on given Telegraf measure.
*
* @param builder The InfluxDB interface.
* @param measure The measure to store.
*/
private void setValue(Point.Builder builder, TelegrafMeasure measure) {
String value = measure.fieldValue;
String name = measure.fieldName;
if (value.startsWith("\"")) {
//its a string
builder.field(name, value);
return;
}
if (value.endsWith("i")) {
//its an integer
String substring = value.substring(0, value.length() - 1);
builder.field(name, Long.parseLong(substring));
return;
}
if (value.charAt(0) >= 48 && value.charAt(0) <= 57) {
//it starts with a number (ascii codes for 0-9), but did not end with 'i', so it is a float
builder.field(name, Float.parseFloat(value.substring(0, value.length())));
return;
}
//its a boolean..
boolean b = trueSet.contains(value);
builder.field(name, b);
}
示例11: getPoints
import org.influxdb.dto.Point; //导入方法依赖的package包/类
@Override
public List<Point> getPoints(Record record) throws OnRecordErrorException {
List<Point> points = new ArrayList<>();
verifyRequireFieldsPresent(record);
final String measurementName = record.get(conf.measurementField).getValueAsString();
for (String fieldPath : conf.valueFields) {
if (!record.has(fieldPath)) {
continue;
}
Point.Builder point = Point
.measurement(measurementName)
.tag(RecordConverterUtil.getTags(conf.tagFields, record))
.field(CollectdRecordConverter.stripPathPrefix(fieldPath), record.get(fieldPath).getValue());
if (!conf.timeField.isEmpty()) {
point.time(getTime(record), conf.timeUnit);
}
points.add(point.build());
}
return points;
}
示例12: report
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private <T extends Metric> void report(
SortedMap<String, T> counters,
SortedMap<String, Point.Builder> builders,
BiConsumer<Point.Builder, Map.Entry<String, T>>... funcs ) {
final Map<String, SortedMap<String, T>> ap = aggregate( counters );
ap.forEach( ( pointName, metrics ) -> {
Point.Builder builder = builders.computeIfAbsent( pointName, ( p ) -> {
final Point.Builder b = Point.measurement( pointName );
tags.forEach( b::tag );
return b;
} );
for( Map.Entry<String, T> entry : metrics.entrySet() ) {
Stream.of( funcs ).forEach( func -> func.accept( builder, entry ) );
}
} );
}
示例13: reportTimers
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private void reportTimers( SortedMap<String, Timer> timers, SortedMap<String, Point.Builder> builders ) {
report( timers, builders,
( b, e ) -> b.addField( e.getKey(), convertDuration( e.getValue().getSnapshot().getMean() ) ),
( b, e ) -> b.addField( e.getKey() + "_mean", convertDuration( e.getValue().getSnapshot().getMean() ) ),
( b, e ) -> b.addField( e.getKey() + "_75th", convertDuration( e.getValue().getSnapshot().get75thPercentile() ) ),
( b, e ) -> b.addField( e.getKey() + "_95th", convertDuration( e.getValue().getSnapshot().get95thPercentile() ) ),
( b, e ) -> b.addField( e.getKey() + "_98th", convertDuration( e.getValue().getSnapshot().get98thPercentile() ) ),
( b, e ) -> b.addField( e.getKey() + "_99th", convertDuration( e.getValue().getSnapshot().get99thPercentile() ) ),
( b, e ) -> b.addField( e.getKey() + "_999th", convertDuration( e.getValue().getSnapshot().get999thPercentile() ) ),
( b, e ) -> b.addField( e.getKey() + "_max", convertDuration( e.getValue().getSnapshot().getMax() ) ),
( b, e ) -> b.addField( e.getKey() + "_min", convertDuration( e.getValue().getSnapshot().getMin() ) ),
( b, e ) -> b.addField( e.getKey() + "_median", convertDuration( e.getValue().getSnapshot().getMedian() ) ),
( b, e ) -> b.addField( e.getKey() + "_stddev", convertDuration( e.getValue().getSnapshot().getStdDev() ) ),
( b, e ) -> b.addField( e.getKey() + "_count", e.getValue().getCount() ),
( b, e ) -> b.addField( e.getKey() + "_oneMinuteRate", convertRate( e.getValue().getOneMinuteRate() ) ),
( b, e ) -> b.addField( e.getKey() + "_fiveMinuteRate", convertRate( e.getValue().getFiveMinuteRate() ) ),
( b, e ) -> b.addField( e.getKey() + "_fifteenMinuteRate", convertRate( e.getValue().getFifteenMinuteRate() ) ),
( b, e ) -> b.addField( e.getKey() + "_meanRate", convertRate( e.getValue().getMeanRate() ) )
);
if( resetTimersAfterReport ) {
for( val timerName : timers.keySet() ) {
Metrics.registry.remove( timerName );
}
}
}
示例14: reportHistograms
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private void reportHistograms( SortedMap<String, Histogram> histograms, SortedMap<String, Point.Builder> builders ) {
report( histograms, builders,
( b, e ) -> b.addField( e.getKey(), e.getValue().getSnapshot().getMean() ),
( b, e ) -> b.addField( e.getKey() + "_mean", e.getValue().getSnapshot().getMean() ),
( b, e ) -> b.addField( e.getKey() + "_75th", e.getValue().getSnapshot().get75thPercentile() ),
( b, e ) -> b.addField( e.getKey() + "_95th", e.getValue().getSnapshot().get95thPercentile() ),
( b, e ) -> b.addField( e.getKey() + "_98th", e.getValue().getSnapshot().get98thPercentile() ),
( b, e ) -> b.addField( e.getKey() + "_99th", e.getValue().getSnapshot().get99thPercentile() ),
( b, e ) -> b.addField( e.getKey() + "_999th", e.getValue().getSnapshot().get999thPercentile() ),
( b, e ) -> b.addField( e.getKey() + "_max", convertDuration( e.getValue().getSnapshot().getMax() ) ),
( b, e ) -> b.addField( e.getKey() + "_min", convertDuration( e.getValue().getSnapshot().getMin() ) ),
( b, e ) -> b.addField( e.getKey() + "_median", convertDuration( e.getValue().getSnapshot().getMedian() ) ),
( b, e ) -> b.addField( e.getKey() + "_stddev", convertDuration( e.getValue().getSnapshot().getStdDev() ) ),
( b, e ) -> b.addField( e.getKey() + "_count", e.getValue().getCount() )
);
}
示例15: handleChangeBlock
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private void handleChangeBlock(String name, ChangeBlockEvent.Break.Post event, Player player) {
BatchPoints batch = newBatch();
for (Transaction<BlockSnapshot> transaction : event.getTransactions()) {
Point.Builder p = newPoint(name);
addPlayer(p, player);
BlockSnapshot original = transaction.getOriginal();
p.tag("block_original", original.getState().getId());
p.tag("block_final", transaction.getFinal().getState().getId());
original.getLocation().ifPresent(loc -> {
addLocation(p, loc);
});
batch.point(p.build());
}
connection.write(batch);
}