当前位置: 首页>>代码示例>>Java>>正文


Java Point类代码示例

本文整理汇总了Java中org.influxdb.dto.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Point类属于org.influxdb.dto包,在下文中一共展示了Point类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeToInflux

import org.influxdb.dto.Point; //导入依赖的package包/类
private void writeToInflux(Target target, InfluxDB influxDB, List<Point> pointsToWrite) {
    /**
     * build batchpoints for a single write.
     */
    try {
        BatchPoints batchPoints = BatchPoints
                 .database(target.getDatabase())
                .points(pointsToWrite.toArray(new Point[0]))
                .retentionPolicy(target.getRetentionPolicy())
                .consistency(ConsistencyLevel.ANY)
                .build();
        influxDB.write(batchPoints);
    } catch (Exception e) {
        if (target.isExposeExceptions()) {
            throw new InfluxReportException(e);
        } else {
            //Exceptions not exposed by configuration. Just log and ignore.
            logger.log(Level.WARNING, "Could not report to InfluxDB. Ignoring Exception.", e);
        }
    }
}
 
开发者ID:jenkinsci,项目名称:influxdb-plugin,代码行数:22,代码来源:InfluxDbPublisher.java

示例2: main

import org.influxdb.dto.Point; //导入依赖的package包/类
public static void main(String[] args) {
    String dbName = "centos_test_db";

    InfluxDB influxDB = InfluxDBFactory.connect("http://192.168.0.71:18086", "influxdbUser", "influxdbPsw");

    // Flush every 2000 Points, at least every 100ms
    influxDB.enableBatch(2000, 100, TimeUnit.MILLISECONDS);

    for (int i = 0; i < 50; i++) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        Point point2 = Point.measurement("disk")
                .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
                .addField("used", Math.random() * 80L)
                .addField("free", Math.random() * 30L)
                .build();
        influxDB.write(dbName, "autogen", point2);
    }

    System.out.println();
}
 
开发者ID:ogcs,项目名称:Okra,代码行数:25,代码来源:InfluxLogger.java

示例3: toLegacyInflux

import org.influxdb.dto.Point; //导入依赖的package包/类
public static BatchPoints toLegacyInflux(RuuviMeasurement measurement) {
    List<Point> points = new ArrayList<>();
    createAndAddLegacyFormatPointIfNotNull(points, "temperature", measurement.temperature, null, null);
    createAndAddLegacyFormatPointIfNotNull(points, "humidity", measurement.humidity, null, null);
    createAndAddLegacyFormatPointIfNotNull(points, "pressure", measurement.pressure, null, null);
    createAndAddLegacyFormatPointIfNotNull(points, "acceleration", measurement.accelerationX, "axis", "x");
    createAndAddLegacyFormatPointIfNotNull(points, "acceleration", measurement.accelerationY, "axis", "y");
    createAndAddLegacyFormatPointIfNotNull(points, "acceleration", measurement.accelerationZ, "axis", "z");
    createAndAddLegacyFormatPointIfNotNull(points, "acceleration", measurement.accelerationTotal, "axis", "total");
    createAndAddLegacyFormatPointIfNotNull(points, "batteryVoltage", measurement.batteryVoltage, null, null);
    createAndAddLegacyFormatPointIfNotNull(points, "rssi", measurement.rssi, null, null);
    return BatchPoints
            .database(Config.getInfluxDatabase())
            .tag("protocolVersion", String.valueOf(measurement.dataFormat))
            .tag("mac", measurement.mac)
            .points(points.toArray(new Point[points.size()]))
            .build();
}
 
开发者ID:Scrin,项目名称:RuuviCollector,代码行数:19,代码来源:InfluxDBConverter.java

示例4: insert

import org.influxdb.dto.Point; //导入依赖的package包/类
@Override
    public void insert() {
        InfluxDB influxDB = null;
        try {
            influxDB = InfluxDBFactory.connect(influxDBUrl);
            if (!influxDB.databaseExists(dbName)) {
                influxDB.createDatabase(dbName);
            }
            for (OffsetInfo offsetInfo : offsetInfoList) {
                String group = offsetInfo.getGroup();
                String topic = offsetInfo.getTopic();
                Long logSize = offsetInfo.getLogSize();
                Long offsets = offsetInfo.getCommittedOffset();
                Long lag = offsetInfo.getLag();
                Long timestamp = offsetInfo.getTimestamp();

                BatchPoints batchPoints = BatchPoints
                        .database(dbName)
                        .tag("group", group)
                        .tag("topic", topic)
                        .build();
                Point point = Point.measurement("offsetsConsumer")
                        .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
//                        .time(timestamp, TimeUnit.MILLISECONDS)
                        .addField("logSize", logSize)
                        .addField("offsets", offsets)
                        .addField("lag", lag)
                        .build();
                batchPoints.point(point);
                influxDB.write(batchPoints);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (influxDB != null) {
                influxDB.close();
            }
        }

    }
 
开发者ID:dubin555,项目名称:Kafka-Insight,代码行数:41,代码来源:OffsetsInfluxDBDaoImpl.java

示例5: 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);
}
 
开发者ID:games647,项目名称:Minefana,代码行数:21,代码来源:WorldCollector.java

示例6: 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());
}
 
开发者ID:jasper-zhang,项目名称:kafka-influxdb,代码行数:21,代码来源:FilteredInfluxDBReporter.java

示例7: 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());
    }
 
开发者ID:jasper-zhang,项目名称:kafka-influxdb,代码行数:23,代码来源:InfluxDBReporter.java

示例8: 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());

}
 
开发者ID:jasper-zhang,项目名称:kafka-influxdb,代码行数:24,代码来源:InfluxDBReporter.java

示例9: 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;
    }
 
开发者ID:jasper-zhang,项目名称:kafka-influxdb,代码行数:21,代码来源:InfluxDBReporter.java

示例10: run

import org.influxdb.dto.Point; //导入依赖的package包/类
@Override
public void run(final String... args) throws Exception
{
  // Create database...
  influxDBTemplate.createDatabase();

  // Create some data...
  final Point p1 = Point.measurement("cpu")
    .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
    .tag("tenant", "default")
    .addField("idle", 90L)
    .addField("user", 9L)
    .addField("system", 1L)
    .build();
  final Point p2 = Point.measurement("disk")
    .time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
    .tag("tenant", "default")
    .addField("used", 80L)
    .addField("free", 1L)
    .build();
  influxDBTemplate.write(p1, p2);

  // ... and query the latest data
  final Query q = new Query("SELECT * FROM cpu GROUP BY tenant", influxDBTemplate.getDatabase());
  influxDBTemplate.getConnection().query(q, 2, queryResult -> logger.info(queryResult.toString()));
}
 
开发者ID:miwurster,项目名称:spring-data-influxdb,代码行数:27,代码来源:Application.java

示例11: setupTest

import org.influxdb.dto.Point; //导入依赖的package包/类
@Override
public void setupTest(BackendListenerContext context) throws Exception {
	testName = context.getParameter(KEY_TEST_NAME, "Test");
	randomNumberGenerator = new Random();
	nodeName = context.getParameter(KEY_NODE_NAME, "Test-Node");


	setupInfluxClient(context);
	influxDB.write(
			influxDBConfig.getInfluxDatabase(),
			influxDBConfig.getInfluxRetentionPolicy(),
			Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
					.tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.STARTED)
					.tag(TestStartEndMeasurement.Tags.NODE_NAME, nodeName)
					.addField(TestStartEndMeasurement.Fields.TEST_NAME, testName)
					.build());

	parseSamplers(context);
	scheduler = Executors.newScheduledThreadPool(1);

	scheduler.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS);

	// Indicates whether to write sub sample records to the database
	recordSubSamples = Boolean.parseBoolean(context.getParameter(KEY_RECORD_SUB_SAMPLES, "false"));
}
 
开发者ID:NovaTecConsulting,项目名称:JMeter-InfluxDB-Writer,代码行数:26,代码来源:JMeterInfluxDBBackendListenerClient.java

示例12: teardownTest

import org.influxdb.dto.Point; //导入依赖的package包/类
@Override
public void teardownTest(BackendListenerContext context) throws Exception {
	LOGGER.info("Shutting down influxDB scheduler...");
	scheduler.shutdown();

	addVirtualUsersMetrics(0,0,0,0,JMeterContextService.getThreadCounts().finishedThreads);
	influxDB.write(
			influxDBConfig.getInfluxDatabase(),
			influxDBConfig.getInfluxRetentionPolicy(),
			Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
					.tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.FINISHED)
					.tag(TestStartEndMeasurement.Tags.NODE_NAME, nodeName)
					.addField(TestStartEndMeasurement.Fields.TEST_NAME, testName)
					.build());

	influxDB.disableBatch();
	try {
		scheduler.awaitTermination(30, TimeUnit.SECONDS);
		LOGGER.info("influxDB scheduler terminated!");
	} catch (InterruptedException e) {
		LOGGER.error("Error waiting for end of scheduler");
	}

	samplersToFilter.clear();
	super.teardownTest(context);
}
 
开发者ID:NovaTecConsulting,项目名称:JMeter-InfluxDB-Writer,代码行数:27,代码来源:JMeterInfluxDBBackendListenerClient.java

示例13: handleSampleResults

import org.influxdb.dto.Point; //导入依赖的package包/类
/**
 * 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);
			}
		}
	}
}
 
开发者ID:NovaTecConsulting,项目名称:JMeter-InfluxDB-Writer,代码行数:21,代码来源:JMeterInfluxDBImportFileClient.java

示例14: teardownTest

import org.influxdb.dto.Point; //导入依赖的package包/类
@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).addField(TestStartEndMeasurement.Fields.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);
}
 
开发者ID:NovaTecConsulting,项目名称:JMeter-InfluxDB-Writer,代码行数:24,代码来源:JMeterInfluxDBImportFileClient.java

示例15: createGlucosePoint

import org.influxdb.dto.Point; //导入依赖的package包/类
private Point createGlucosePoint(BgReading record) {
    // TODO DisplayGlucose option
    final BigDecimal delta = new BigDecimal(record.calculated_value_slope * 5 * 60 * 1000)
            .setScale(3, BigDecimal.ROUND_HALF_UP);

    return Point.measurement("glucose")
            .time(record.getEpochTimestamp(), TimeUnit.MILLISECONDS)
            .addField("value_mmol", record.calculated_value_mmol())
            .addField("value_mgdl", record.getMgdlValue())
            .addField("direction", record.slopeName())
            .addField("filtered", record.ageAdjustedFiltered() * 1000)
            .addField("unfiltered", record.usedRaw() * 1000)
            .addField("rssi", 100)
            .addField("noise", record.noiseValue())
            .addField("delta", delta)
            .build();
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:18,代码来源:InfluxDBUploader.java


注:本文中的org.influxdb.dto.Point类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。