本文整理了Java中org.influxdb.dto.Point.lineProtocol()
方法的一些代码示例,展示了Point.lineProtocol()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.lineProtocol()
方法的具体详情如下:
包路径:org.influxdb.dto.Point
类名称:Point
方法名:lineProtocol
[英]calculate the lineprotocol entry for a single Point. Documentation is WIP : https://github.com/influxdb/influxdb/pull/2997 https://github.com/influxdb/influxdb/blob/master/tsdb/README.md
[中]计算单个点的lineprotocol条目。文件是WIP:https://github.com/influxdb/influxdb/pull/2997 https://github.com/influxdb/influxdb/blob/master/tsdb/README.md
代码示例来源:origin: apache/incubator-gobblin
@Override
public void write(BatchPoints batchPoints) {
for (Point point : batchPoints.getPoints()) {
write(point.lineProtocol());
}
}
代码示例来源:origin: influxdata/influxdb-java
/**
* calculate the lineprotocol entry for a single Point.
*
* Documentation is WIP : https://github.com/influxdb/influxdb/pull/2997
*
* https://github.com/influxdb/influxdb/blob/master/tsdb/README.md
*
* @return the String without newLine.
*/
public String lineProtocol() {
return lineProtocol(null);
}
代码示例来源:origin: influxdata/influxdb-java
/**
* calculate the lineprotocol for all Points.
*
* @return the String with newLines.
*/
public String lineProtocol() {
StringBuilder sb = new StringBuilder();
for (Point point : this.points) {
sb.append(point.lineProtocol(this.precision)).append("\n");
}
return sb.toString();
}
代码示例来源:origin: influxdata/influxdb-java
/**
* {@inheritDoc}
*/
@Override
public void write(final int udpPort, final Point point) {
if (this.batchEnabled.get()) {
UdpBatchEntry batchEntry = new UdpBatchEntry(point, udpPort);
this.batchProcessor.put(batchEntry);
} else {
this.write(udpPort, point.lineProtocol());
this.unBatchedCount.increment();
}
this.writeCount.increment();
}
代码示例来源:origin: influxdata/influxdb-java
udpPortToBatchPoints.put(udpPort, batchPoints);
udpPortToBatchPoints.get(udpPort).add(point.lineProtocol());
代码示例来源:origin: org.influxdb/influxdb-java
/**
* calculate the lineprotocol entry for a single Point.
*
* Documentation is WIP : https://github.com/influxdb/influxdb/pull/2997
*
* https://github.com/influxdb/influxdb/blob/master/tsdb/README.md
*
* @return the String without newLine.
*/
public String lineProtocol() {
return lineProtocol(null);
}
代码示例来源:origin: org.influxdb/influxdb-java
/**
* calculate the lineprotocol for all Points.
*
* @return the String with newLines.
*/
public String lineProtocol() {
StringBuilder sb = new StringBuilder();
for (Point point : this.points) {
sb.append(point.lineProtocol(this.precision)).append("\n");
}
return sb.toString();
}
代码示例来源:origin: com.remondis.limbus/limbus-monitoring-influx
public static void sendData(Point point, InetAddress host, int port) throws IOException {
sendData(point.lineProtocol(), host, port);
}
代码示例来源:origin: org.influxdb/influxdb-java
/**
* {@inheritDoc}
*/
@Override
public void write(final int udpPort, final Point point) {
if (this.batchEnabled.get()) {
UdpBatchEntry batchEntry = new UdpBatchEntry(point, udpPort);
this.batchProcessor.put(batchEntry);
} else {
this.write(udpPort, point.lineProtocol());
this.unBatchedCount.increment();
}
this.writeCount.increment();
}
代码示例来源:origin: NovatecConsulting/JMeter-InfluxDB-Writer
@Override
public void setupTest(BackendListenerContext context) throws Exception {
testName = context.getParameter(KEY_TEST_NAME, "Test");
File exportFile = new File(context.getParameter(KEY_FILE_PATH, "influxDBExport.txt"));
if (exportFile.getParentFile() != null && !exportFile.getParentFile().exists()) {
exportFile.getParentFile().mkdirs();
}
if (exportFile.exists()) {
exportFile.delete();
boolean created = exportFile.createNewFile();
if (!created) {
throw new RuntimeException("Export file could not be created!");
}
}
exportFileWriter = new BufferedWriter(new FileWriter(exportFile));
Point startPoint = Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.STARTED).tag(TestStartEndMeasurement.Tags.TEST_NAME, testName).build();
exportFileWriter.append(startPoint.lineProtocol());
exportFileWriter.newLine();
parseSamplers(context);
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS);
}
代码示例来源:origin: org.influxdb/influxdb-java
udpPortToBatchPoints.put(udpPort, batchPoints);
udpPortToBatchPoints.get(udpPort).add(point.lineProtocol());
代码示例来源:origin: NovatecConsulting/JMeter-InfluxDB-Writer
@Override
public void teardownTest(BackendListenerContext context) throws Exception {
LOGGER.info("Shutting down influxDB scheduler...");
scheduler.shutdown();
addVirtualUsersMetrics(0, 0, 0, 0, JMeterContextService.getThreadCounts().finishedThreads);
Point endPoint = Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.FINISHED).tag(TestStartEndMeasurement.Tags.TEST_NAME, testName).build();
exportFileWriter.append(endPoint.lineProtocol());
exportFileWriter.newLine();
try {
scheduler.awaitTermination(30, TimeUnit.SECONDS);
LOGGER.info("influxDB scheduler terminated!");
} catch (InterruptedException e) {
LOGGER.error("Error waiting for end of scheduler");
}
samplersToFilter.clear();
exportFileWriter.close();
super.teardownTest(context);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void mustToCallToInsertDBDao() {
Builder builder = Point.measurement("test").addField("test", 1).time(1, TimeUnit.MILLISECONDS);
when(diagnosisCmrConfiguration.problemOccurrencePointBuilder.getBuilder(problemOccurrence)).thenReturn(builder);
diagnosisCmrConfiguration.accept(problemOccurrence);
ArgumentCaptor<Point> pointCaptor = ArgumentCaptor.forClass(Point.class);
verify(diagnosisCmrConfiguration.influxDBDao).insert(pointCaptor.capture());
assertThat(pointCaptor.getValue().lineProtocol(), is(builder.build().lineProtocol()));
}
}
代码示例来源:origin: NovatecConsulting/JMeter-InfluxDB-Writer
/**
* Write thread metrics.
*/
private void addVirtualUsersMetrics(int minActiveThreads, int meanActiveThreads, int maxActiveThreads, int startedThreads, int finishedThreads) {
Builder builder = Point.measurement(VirtualUsersMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
builder.addField(VirtualUsersMeasurement.Fields.MIN_ACTIVE_THREADS, minActiveThreads);
builder.addField(VirtualUsersMeasurement.Fields.MAX_ACTIVE_THREADS, maxActiveThreads);
builder.addField(VirtualUsersMeasurement.Fields.MEAN_ACTIVE_THREADS, meanActiveThreads);
builder.addField(VirtualUsersMeasurement.Fields.STARTED_THREADS, startedThreads);
builder.addField(VirtualUsersMeasurement.Fields.FINISHED_THREADS, finishedThreads);
try {
exportFileWriter.append(builder.build().lineProtocol());
exportFileWriter.newLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void jmxNumeric() {
JmxSensorValueData data = new JmxSensorValueData();
data.setValue("1");
when(influxDBDao.isConnected()).thenReturn(true);
doReturn(Collections.singleton(JmxSensorValueData.class)).when(pointBuilder).getDataClasses();
when(pointBuilder.createBuilders(data)).thenReturn(Collections.singleton(builder));
processor = new InfluxProcessor(influxDBDao, Collections.<IPointBuilder<DefaultData>> singletonList(pointBuilder));
processor.process(data, entityManager);
verify(influxDBDao).isConnected();
ArgumentCaptor<Point> pointCaptor = ArgumentCaptor.forClass(Point.class);
verify(influxDBDao).insert(pointCaptor.capture());
assertThat(pointCaptor.getValue().lineProtocol(), is(builder.build().lineProtocol()));
verifyZeroInteractions(entityManager);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void processed() {
InvocationSequenceData invocationData = new InvocationSequenceData();
when(influxDBDao.isConnected()).thenReturn(true);
doReturn(Collections.singleton(InvocationSequenceData.class)).when(pointBuilder).getDataClasses();
when(pointBuilder.createBuilders(invocationData)).thenReturn(Collections.singleton(builder));
processor = new InfluxProcessor(influxDBDao, Collections.<IPointBuilder<DefaultData>> singletonList(pointBuilder));
processor.process(invocationData, entityManager);
verify(influxDBDao).isConnected();
ArgumentCaptor<Point> pointCaptor = ArgumentCaptor.forClass(Point.class);
verify(influxDBDao).insert(pointCaptor.capture());
assertThat(pointCaptor.getValue().lineProtocol(), is(builder.build().lineProtocol()));
verifyZeroInteractions(entityManager);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void timerCharting() {
TimerData data = new TimerData();
data.setCharting(true);
when(influxDBDao.isConnected()).thenReturn(true);
doReturn(Collections.singleton(TimerData.class)).when(pointBuilder).getDataClasses();
when(pointBuilder.createBuilders(data)).thenReturn(Collections.singleton(builder));
processor = new InfluxProcessor(influxDBDao, Collections.<IPointBuilder<DefaultData>> singletonList(pointBuilder));
processor.process(data, entityManager);
verify(influxDBDao).isConnected();
ArgumentCaptor<Point> pointCaptor = ArgumentCaptor.forClass(Point.class);
verify(influxDBDao).insert(pointCaptor.capture());
assertThat(pointCaptor.getValue().lineProtocol(), is(builder.build().lineProtocol()));
verifyZeroInteractions(entityManager);
}
代码示例来源:origin: smartcat-labs/cassandra-diagnostics
private ByteBuffer lineProtocol(Measurement measurement) {
try {
final Point.Builder builder = Point.measurement(measurement.name());
builder.time(measurement.time(), measurement.timeUnit());
builder.tag(measurement.tags());
builder.tag("type", measurement.type().toString());
if (measurement.isSimple()) {
builder.addField("value", measurement.getValue());
}
for (Map.Entry<String, String> field : measurement.fields().entrySet()) {
builder.addField(field.getKey(), field.getValue());
}
Charset charset = StandardCharsets.UTF_8;
CharsetEncoder encoder = charset.newEncoder();
return encoder.encode(CharBuffer.wrap(builder.build().lineProtocol().concat("\r\n").toCharArray()));
} catch (Exception e) {
logger.warn("Failed to send report to influx", e);
return null;
}
}
}
代码示例来源:origin: NovatecConsulting/JMeter-InfluxDB-Writer
/**
* Processes sampler results.
*/
public void handleSampleResults(List<SampleResult> sampleResults, BackendListenerContext context) {
for (SampleResult sampleResult : sampleResults) {
getUserMetrics().add(sampleResult);
if ((null != regexForSamplerList && sampleResult.getSampleLabel().matches(regexForSamplerList)) || samplersToFilter.contains(sampleResult.getSampleLabel())) {
Point point = Point.measurement(RequestMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
.tag(RequestMeasurement.Tags.REQUEST_NAME, sampleResult.getSampleLabel()).addField(RequestMeasurement.Fields.ERROR_COUNT, sampleResult.getErrorCount())
.addField(RequestMeasurement.Fields.RESPONSE_TIME, sampleResult.getTime()).build();
try {
exportFileWriter.append(point.lineProtocol());
exportFileWriter.newLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
代码示例来源:origin: org.apache.camel/camel-influxdb
private void doInsert(Exchange exchange, String dataBaseName, String retentionPolicy) throws InvalidPayloadException {
if (!endpoint.isBatch()) {
Point p = exchange.getIn().getMandatoryBody(Point.class);
try {
LOG.debug("Writing point {}", p.lineProtocol());
if (!connection.databaseExists(dataBaseName)) {
LOG.debug("Database {} doesn't exist. Creating it...", dataBaseName);
connection.createDatabase(dataBaseName);
}
connection.write(dataBaseName, retentionPolicy, p);
} catch (Exception ex) {
exchange.setException(new CamelInfluxDbException(ex));
}
} else {
BatchPoints batchPoints = exchange.getIn().getMandatoryBody(BatchPoints.class);
try {
LOG.debug("Writing BatchPoints {}", batchPoints.lineProtocol());
connection.write(batchPoints);
} catch (Exception ex) {
exchange.setException(new CamelInfluxDbException(ex));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!