当前位置: 首页>>代码示例>>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;未经允许,请勿转载。