本文整理汇总了Java中backtype.storm.metric.api.IMetricsConsumer类的典型用法代码示例。如果您正苦于以下问题:Java IMetricsConsumer类的具体用法?Java IMetricsConsumer怎么用?Java IMetricsConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMetricsConsumer类属于backtype.storm.metric.api包,在下文中一共展示了IMetricsConsumer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, TopologyContext context,
OutputCollector collector) {
try {
_metricsConsumer = (IMetricsConsumer) Class.forName(
_consumerClassName).newInstance();
} catch (Exception e) {
throw new RuntimeException(
"Could not instantiate a class listed in config under section "
+ Config.TOPOLOGY_METRICS_CONSUMER_REGISTER
+ " with fully qualified name "
+ _consumerClassName, e);
}
_metricsConsumer.prepare(stormConf, _registrationArgument, context,
collector);
_collector = collector;
}
示例2: prepare
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, TopologyContext context,
OutputCollector collector) {
try {
_metricsConsumer = (IMetricsConsumer) Class.forName(
_consumerClassName).newInstance();
} catch (Exception e) {
throw new RuntimeException(
"Could not instantiate a class listed in config under section "
+ Config.TOPOLOGY_METRICS_CONSUMER_REGISTER
+ " with fully qualified name "
+ _consumerClassName, e);
}
_metricsConsumer.prepare(stormConf, _registrationArgument, context,
(IErrorReporter) collector);
_collector = collector;
}
示例3: handleSelectedDataPoints
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
protected void handleSelectedDataPoints(IMetricsConsumer.TaskInfo taskInfo,
Collection<DataPoint> dataPoints) {
List<QueueElement> data = dataPoints2QueueElement(taskInfo, dataPoints);
if (data == null) {
return;
}
// LOG.debug("data size is " + data.size());
// push to redis
for (QueueElement e : data) {
try {
getJedisInstance().rpush(e.queueName, e.data);
} catch (Exception e1) {
LOG.info("push data to redis failed", e1);
closeJedis();
}
}
}
示例4: execute
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
_metricsConsumer.handleDataPoints(
(IMetricsConsumer.TaskInfo) input.getValue(0),
(Collection) input.getValue(1));
_collector.ack(input);
}
示例5: prepare
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
try {
_metricsConsumer = (IMetricsConsumer) Class.forName(_consumerClassName).newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not instantiate a class listed in config under section " + Config.TOPOLOGY_METRICS_CONSUMER_REGISTER
+ " with fully qualified name " + _consumerClassName, e);
}
_metricsConsumer.prepare(stormConf, _registrationArgument, context, (IErrorReporter) collector);
_collector = collector;
}
示例6: dataPoints2QueueElement
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
protected List<QueueElement> dataPoints2QueueElement(IMetricsConsumer.TaskInfo taskInfo,
Collection<DataPoint> dataPoints) {
Map<String, Object> ret = dataPoints.stream().collect(Collectors.toMap(p -> p.name, p -> p.value));
//data format is "srcComponentId:taskId:timestamp->data point json"
String data = taskInfo.srcComponentId + ':' + taskInfo.srcTaskId + ':' + taskInfo.timestamp
+ "->" + object2Json(ret);
return Arrays.asList(createDefaultQueueElement(data));
}
示例7: handleSelectedDataPoints
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
protected void handleSelectedDataPoints(IMetricsConsumer.TaskInfo taskInfo,
Collection<IMetricsConsumer.DataPoint> dataPoints) {
Map<String, Object> ret = dataPoints.stream().collect(Collectors.toMap(p -> p.name, p -> p.value));
MeasuredData measuredData = new MeasuredData(taskInfo.srcComponentId, taskInfo.srcTaskId,
taskInfo.timestamp, ret);
ctx.getListeners().forEach(l -> l.measuredDataReceived(measuredData));
}
示例8: prepare
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
try {
_metricsConsumer = (IMetricsConsumer)Class.forName(_consumerClassName).newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not instantiate a class listed in config under section " +
Config.TOPOLOGY_METRICS_CONSUMER_REGISTER + " with fully qualified name " + _consumerClassName, e);
}
_metricsConsumer.prepare(stormConf, _registrationArgument, context, (IErrorReporter)collector);
_collector = collector;
}
示例9: prepare
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
try {
_metricsConsumer = (IMetricsConsumer) Class.forName(_consumerClassName).newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not instantiate a class listed in config under section " +
Config.TOPOLOGY_METRICS_CONSUMER_REGISTER
+ " with fully qualified name " + _consumerClassName, e);
}
_metricsConsumer.prepare(stormConf, _registrationArgument, context, collector);
_collector = collector;
}
示例10: execute
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
_metricsConsumer.handleDataPoints((IMetricsConsumer.TaskInfo) input.getValue(0), (Collection) input.getValue(1));
_collector.ack(input);
}
示例11: execute
import backtype.storm.metric.api.IMetricsConsumer; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
_metricsConsumer.handleDataPoints((IMetricsConsumer.TaskInfo)input.getValue(0), (Collection)input.getValue(1));
_collector.ack(input);
}