當前位置: 首頁>>代碼示例>>Java>>正文


Java DataPoint類代碼示例

本文整理匯總了Java中backtype.storm.metric.api.IMetricsConsumer.DataPoint的典型用法代碼示例。如果您正苦於以下問題:Java DataPoint類的具體用法?Java DataPoint怎麽用?Java DataPoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataPoint類屬於backtype.storm.metric.api.IMetricsConsumer包,在下文中一共展示了DataPoint類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: monitorStatus

import backtype.storm.metric.api.IMetricsConsumer.DataPoint; //導入依賴的package包/類
public void monitorStatus(String stormId, TaskInfo taskInfo, DataPoint p) {
    SpoutCounter counter = spoutCounterMap.get(taskInfo.srcTaskId);
    if(counter == null){
        counter = new SpoutCounter();
        spoutCounterMap.put(taskInfo.srcTaskId, counter);
    }
    counter.incrRepeatCounter();
    String value = String.valueOf(p.value);
    long increment = Long.parseLong(value);
    counter.incrTupleCounter(increment);
    //連續1分鍾
    if(counter.getRepeatCounter() >= 12){
        //數據量少於某個記錄
        LOGGER.info("last minute tuple = " + counter.getTupleCounter());
         if(counter.getTupleCounter() <= 10000){
            LOGGER.error("spout has problem, restar topology....");
            //restartTopology(stormId);
        }
        spoutCounterMap.clear();
    }
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:22,代碼來源:TopologyMonitor.java

示例2: testDataPointsToMetrics

import backtype.storm.metric.api.IMetricsConsumer.DataPoint; //導入依賴的package包/類
public void testDataPointsToMetrics() {
	TaskInfo taskInfo = new TaskInfo("host1", 6701, "myBolt7", 12,
			123456789000L, 60);
	List<DataPoint> dataPoints = new LinkedList<>();

	dataPoints.add(new DataPoint("my.int", 57));
	dataPoints.add(new DataPoint("my.long", 57L));
	dataPoints.add(new DataPoint("my/float", 222f));
	dataPoints.add(new DataPoint("my_double", 56.0d));
	dataPoints.add(new DataPoint("ignored", "not a num"));
	dataPoints.add(new DataPoint("points", ImmutableMap
			.<String, Object> of("count", 123, "time", 2342234, "ignored",
					"not a num")));

	undertest.topologyName = "testTop";
	undertest.statsdPrefix = "testPrefix";

	// topology and prefix are used when creating statsd, and statsd client
	// handles adding them
	// they should not show up here

	List<Metric> expected = ImmutableList.<Metric> of(new Metric(
			"host1.6701.myBolt7.my_int", 57), new Metric(
			"host1.6701.myBolt7.my_long", 57), new Metric(
			"host1.6701.myBolt7.my_float", 222), new Metric(
			"host1.6701.myBolt7.my_double", 56), new Metric(
			"host1.6701.myBolt7.points.count", 123), new Metric(
			"host1.6701.myBolt7.points.time", 2342234));

	assertEquals(expected,
			undertest.dataPointsToMetrics(taskInfo, dataPoints));

}
 
開發者ID:endgameinc,項目名稱:storm-metrics-statsd,代碼行數:34,代碼來源:StatsdMetricConsumerTest.java


注:本文中的backtype.storm.metric.api.IMetricsConsumer.DataPoint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。