本文整理汇总了Java中org.influxdb.dto.Point.measurement方法的典型用法代码示例。如果您正苦于以下问题:Java Point.measurement方法的具体用法?Java Point.measurement怎么用?Java Point.measurement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.influxdb.dto.Point
的用法示例。
在下文中一共展示了Point.measurement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: process
import org.influxdb.dto.Point; //导入方法依赖的package包/类
/**
* Procses a Telegraf message received over Kafka.
*
* @param msg The msg to process.
*/
public void process(String msg) {
TelegrafMeasure measure = parse(msg);
Point.Builder builder = Point.measurement(measure.name);
for (Map.Entry<String, String> entry : measure.tags.entrySet()) {
builder.tag(entry.getKey(), entry.getValue());
}
setValue(builder, measure);
Point point = builder.build();
// log.trace("Writing to InFlux:"+point);
db.write(dbName, "default", point);
count++;
if (count % 100 == 0) System.out.print(count + ",");
if (count % 1000 == 0) System.out.println();
}
示例3: multiPoint
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private void multiPoint(long time, JsonObject header, JsonObject body) {
for (JsonObject.Member member : body) {
String name = member.getName();
Point.Builder builder = Point.measurement(name);
builder.time(time, TimeUnit.MILLISECONDS);
setTags(header, builder);
setField("value", builder, member.getValue());
Point point = builder.build();
db.write(dbName, "default", point);
}
}
示例4: singlePoint
import org.influxdb.dto.Point; //导入方法依赖的package包/类
private void singlePoint(String type, long time, JsonObject header, JsonObject body) {
Point.Builder builder = Point.measurement(type);
builder.time(time, TimeUnit.MILLISECONDS);
setTags(header, builder);
createFields(body, builder);
Point point = builder.build();
System.out.println("writing point:" + point);
db.write(dbName, "default", point);
}