org.influxdb.InfluxDB.write()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(226)

本文整理了Java中org.influxdb.InfluxDB.write()方法的一些代码示例,展示了InfluxDB.write()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InfluxDB.write()方法的具体详情如下:
包路径:org.influxdb.InfluxDB
类名称:InfluxDB
方法名:write

InfluxDB.write介绍

[英]Write a set of Points to the influxdb database with the string records through UDP.
[中]通过UDP使用字符串记录向XDB数据库写入一组点。

代码示例

代码示例来源:origin: apache/nifi

protected void writeToInfluxDB(ProcessContext context, String consistencyLevel, String database, String retentionPolicy, String records) {
  getInfluxDB(context).write(database, retentionPolicy, InfluxDB.ConsistencyLevel.valueOf(consistencyLevel), records);
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * Push multiple points at once.
 * @param points list of {@link Point}s to report
 */
public void push(List<Point> points) {
 BatchPoints.Builder batchPointsBuilder = BatchPoints.database(database).retentionPolicy(DEFAULT_RETENTION_POLICY);
 for (Point point : points) {
  batchPointsBuilder.point(point);
 }
 influxDB.write(batchPointsBuilder.build());
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * Push a single Point
 * @param point the {@link Point} to report
 */
public void push(Point point) {
 BatchPoints.Builder batchPointsBuilder = BatchPoints.database(database).retentionPolicy(DEFAULT_RETENTION_POLICY);
 batchPointsBuilder.point(point);
 influxDB.write(batchPointsBuilder.build());
}

代码示例来源:origin: jmxtrans/jmxtrans

influxDB.write(batchPoints);

代码示例来源:origin: influxdata/influxdb-java

@Override
public void write(final Collection<BatchPoints> batchPointsCollection) {
 for (BatchPoints batchPoints : batchPointsCollection) {
  influxDB.write(batchPoints);
 }
}

代码示例来源:origin: testcontainers/testcontainers-java

@Test
  public void queryForWriteAndRead() {
    InfluxDB influxDB = influxDBContainer.getNewInfluxDB();

    Point point = Point.measurement("cpu")
      .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
      .addField("idle", 90L)
      .addField("user", 9L)
      .addField("system", 1L)
      .build();
    influxDB.write(point);

    Query query = new Query("SELECT idle FROM cpu", DATABASE);
    QueryResult actual = influxDB.query(query);

    assertThat(actual, notNullValue());
    assertThat(actual.getError(), nullValue());
    assertThat(actual.getResults(), notNullValue());
    assertThat(actual.getResults().size(), is(1));

  }
}

代码示例来源:origin: influxdata/influxdb-java

private WriteResult tryToWrite(final BatchPoints batchPoints) {
 try {
  influxDB.write(batchPoints);
  return WriteResult.WRITTEN;
 } catch (InfluxDBException e) {
  return new WriteResult(e);
 } catch (Exception e) {
  return new WriteResult(WriteResultOutcome.FAILED_RETRY_POSSIBLE, e);
 }
}

代码示例来源:origin: apache/cloudstack

/**
 * Writes batches of InfluxDB database points into a given database.
 */
protected void writeBatches(InfluxDB influxDbConnection, String dbName, List<Point> points) {
  BatchPoints batchPoints = BatchPoints.database(dbName).build();
  for (Point point : points) {
    batchPoints.point(point);
  }
  influxDbConnection.write(batchPoints);
}

代码示例来源:origin: influxdata/influxdb-java

influxDB.write(point);
} else {
 influxDB.write(database, retentionPolicy, point);

代码示例来源:origin: org.influxdb/influxdb-java

@Override
public void write(final Collection<BatchPoints> batchPointsCollection) {
 for (BatchPoints batchPoints : batchPointsCollection) {
  influxDB.write(batchPoints);
 }
}

代码示例来源:origin: org.apereo.cas/cas-server-support-influxdb-core

/**
 * Write measurement point.
 *
 * @param point  the point
 * @param dbName the db name
 */
public void write(final Point point, final String dbName) {
  this.influxDb.write(dbName, "autogen", point);
}

代码示例来源:origin: com.remondis.limbus/limbus-monitoring-influx

@Override
protected void writePoint(Point point) {
 try {
  influxDB.write(database, retentionPolicy, point);
 } catch (Exception e) {
  logError(e);
 }
}

代码示例来源:origin: tzolov/geode-dashboard

@Override
protected void doCompleteMeasurementLoad() {
  // Write the remaining measurements in the batch
  if (measurementBatch.getPoints().size() > 0) {
    influxDB.write(measurementBatch);
  }
  measurementBatch = null;
  System.out.println();
}

代码示例来源:origin: Scrin/RuuviCollector

@Override
public void save(RuuviMeasurement measurement) {
  Point point = InfluxDBConverter.toInflux(measurement);
  influxDB.write(point);
}

代码示例来源:origin: org.influxdb/influxdb-java

private WriteResult tryToWrite(final BatchPoints batchPoints) {
 try {
  influxDB.write(batchPoints);
  return WriteResult.WRITTEN;
 } catch (InfluxDBException e) {
  return new WriteResult(e);
 } catch (Exception e) {
  return new WriteResult(WriteResultOutcome.FAILED_RETRY_POSSIBLE, e);
 }
}

代码示例来源:origin: org.apereo.cas/cas-server-support-influxdb-core

/**
 * Write measurement point.
 *
 * @param point the point
 */
public void write(final Point point) {
  this.influxDb.write(influxDbProperties.getDatabase(), influxDbProperties.getRetentionPolicy(), point);
}

代码示例来源:origin: org.apache.gobblin/gobblin-metrics-influxdb

/**
 * Push multiple points at once.
 * @param points list of {@link Point}s to report
 */
public void push(List<Point> points) {
 BatchPoints.Builder batchPointsBuilder = BatchPoints.database(database).retentionPolicy(DEFAULT_RETENTION_POLICY);
 for (Point point : points) {
  batchPointsBuilder.point(point);
 }
 influxDB.write(batchPointsBuilder.build());
}

代码示例来源:origin: org.apache.gobblin/gobblin-metrics-influxdb

/**
 * Push a single Point
 * @param point the {@link Point} to report
 */
public void push(Point point) {
 BatchPoints.Builder batchPointsBuilder = BatchPoints.database(database).retentionPolicy(DEFAULT_RETENTION_POLICY);
 batchPointsBuilder.point(point);
 influxDB.write(batchPointsBuilder.build());
}

代码示例来源:origin: miwurster/spring-data-influxdb

@Override
public void write(final List<T> payload)
{
 final String database = getDatabase();
 final String retentionPolicy = getConnectionFactory().getProperties().getRetentionPolicy();
 final BatchPoints ops = BatchPoints.database(database)
  .retentionPolicy(retentionPolicy)
  .consistency(InfluxDB.ConsistencyLevel.ALL)
  .build();
 payload.forEach(t -> converter.convert(t).forEach(ops::point));
 getConnection().write(ops);
}

代码示例来源:origin: dataArtisans/flink-training-exercises

@Override
  public void invoke(T dataPoint, SinkFunction.Context context) throws Exception {
    Point.Builder builder = Point.measurement(measurement)
        .time(dataPoint.getTimeStampMs(), TimeUnit.MILLISECONDS)
        .addField(this.fieldName, dataPoint.getValue());

    if(dataPoint instanceof KeyedDataPoint){
      builder.tag("key", ((KeyedDataPoint) dataPoint).getKey());
    }

    Point p = builder.build();

    influxDB.write(DEFAULT_DATABASE_NAME, "autogen", p);
  }
}

相关文章