本文整理汇总了Java中backtype.storm.task.IErrorReporter类的典型用法代码示例。如果您正苦于以下问题:Java IErrorReporter类的具体用法?Java IErrorReporter怎么用?Java IErrorReporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IErrorReporter类属于backtype.storm.task包,在下文中一共展示了IErrorReporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map map, Object conf, TopologyContext topologyContext, IErrorReporter iErrorReporter) {
Map<String, Object> config = (Map<String, Object>) conf;
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
client = CuratorFrameworkFactory.newClient(config.get("zookeeper").toString(), retryPolicy);
client.start();
try {
if (client.checkExists().forPath("/consumers/rb-storm") == null) {
client.create().creatingParentsIfNeeded().forPath("/consumers/rb-storm");
System.out.println("Creating /consumers/rb-storm path ...");
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, Object registrationArgument, TopologyContext context,
final IErrorReporter errorReporter) {
LOG.info("Initializing the " + getClass().getCanonicalName());
this.graphitePath = getConfiguredGraphitBasePath(stormConf);
if (!stormConf.containsKey(CONF_MONITORING_GRAPHITE_SERVER)) {
throw new RuntimeException("Missing graphite configuration. You need to specify the server and the port" +
"under which the graphite server can be reached. Example: " + CONF_MONITORING_GRAPHITE_SERVER
+ "=graphite.yourdomain.com:2003");
}
this.graphiteConnection = (String) stormConf.get(CONF_MONITORING_GRAPHITE_SERVER);
getGraphiteWriter();
this.metricsToProcess = new HashMap<>();
this.metricsToProcess.put(MonitoringMetricsCollectionHook.METRIC_COMPLETE_LATENCY, new AverageAggregator());
this.metricsToProcess.put(MonitoringMetricsCollectionHook.METRIC_THROUGHPUT, new SumAggregator());
this.metricsToProcess.put(MonitoringMetricsCollectionHook.METRIC_WORKER_CPU_LOAD, new SumAggregator());
this.metricsToProcess.put(MonitoringMetricsCollectionHook.METRIC_WORKER_NETWORK_BYTES, new SumAggregator());
}
示例3: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的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;
}
示例4: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, Object registrationArgument,
TopologyContext context, IErrorReporter errorReporter) {
this.errorReporter = errorReporter;
this.metrics = new ConcurrentHashMap<String, Number>();
this.metrics_metadata = new ConcurrentHashMap<String, Map<String, Object>>();
try {
// TODO Config file not tested
final String PORT_CONFIG_STRING = "topology.metrics.consumers.debug.servlet.port";
Integer port = (Integer) stormConf.get(PORT_CONFIG_STRING);
if (port == null) {
log.warn("Metrics debug servlet's port not specified, defaulting to 7070. You can specify it via "
+ PORT_CONFIG_STRING + " in storm.yaml");
port = 7070;
}
server = startServlet(port);
} catch (Exception e) {
log.error("Failed to start metrics server", e);
throw new AssertionError(e);
}
}
示例5: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, Object registrationArgument,
TopologyContext context, IErrorReporter errorReporter) {
indexName = ConfUtils.getString(stormConf, ESMetricsIndexNameParamName,
"metrics");
docType = ConfUtils.getString(stormConf, ESmetricsDocTypeParamName,
"datapoint");
ttl = ConfUtils.getLong(stormConf, ESmetricsTTLParamName, -1);
try {
connection = ElasticSearchConnection.getConnection(stormConf,
ESBoltType);
} catch (Exception e1) {
LOG.error("Can't connect to ElasticSearch", e1);
throw new RuntimeException(e1);
}
}
示例6: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, Object arg, TopologyContext context, IErrorReporter errorReporter) {
List<String> metricNames = (List<String>) stormConf.get(APPROVED_METRIC_NAMES);
if (metricNames != null) {
metricNames.stream().forEach((line) -> {
line = line.trim();
if (line.isEmpty()) {
return;
}
String[] tmp = line.split("\\s+");
if (tmp.length == 1) {
addApprovedMetirc(tmp[0]);
} else {
addApprovedMetirc(tmp[0], tmp[1]);
}
});
}
}
示例7: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
public void prepare(Map stormConf, Object registrationArgument,
TopologyContext context, IErrorReporter errorReporter) {
LOG.trace("preparing grapite metrics consumer");
String graphiteHostFromConf = (String) stormConf.get(GRAPHITE_HOST);
String graphitePortFromConf = (String) stormConf.get(GRAPHITE_PORT);
String formatFromConf = (String) stormConf.get(GRAPHITE_OUTPUT_FORMAT);
String formatSingleFromConf = (String) stormConf.get(GRAPHITE_OUTPUT_FORMAT_SINGLE);
if (null != graphiteHostFromConf) {
graphiteHost = graphiteHostFromConf;
}
if (null != graphitePortFromConf) {
try {
graphitePort = Integer.valueOf(graphitePortFromConf);
} catch(NumberFormatException e) {
LOG.error(String.format("port must be an Integer, got: %s", graphitePortFromConf));
throw e;
}
}
if(null != formatFromConf) {
this.format = formatFromConf;
}
if(null != formatSingleFromConf) {
this.formatSingle = formatSingleFromConf;
}
}
示例8: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf,
Object registrationArgument,
TopologyContext context,
IErrorReporter errorReporter) {
this.stormId = context.getStormId();
this.extemptMetrics = new HashSet<>();
this.extemptMetrics.add(SchedulingMetricsCollectionHook.METRIC_EMITTED_MESSAGES);
}
示例9: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的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;
}
示例10: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, Object registrationArgument, TopologyContext context, IErrorReporter errorReporter) {
String[] parts = ((String) registrationArgument).split(":", 2);
host = parts[0];
port = Integer.valueOf(parts[1]);
try {
socket = new Socket(host, port);
out = socket.getOutputStream();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例11: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map stormConf, Object registrationArgument, TopologyContext context,
IErrorReporter errorReporter) {
super.prepare(stormConf, registrationArgument, context, errorReporter);
jedisHost = (String) stormConf.get(REDIS_HOST);
jedisPort = ((Number) stormConf.get(REDIS_PORT)).intValue();
queueName = (String) stormConf.get(REDIS_QUEUE_NAME);
// queue name is not exist, use topology id as default
if (queueName == null) {
queueName = context.getStormId() + "-metrics";
}
LOG.info("Write metrics to redis server " + jedisHost + ":" + jedisPort);
}
示例12: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@Override
public void prepare(Map conf, Object arg, TopologyContext context, IErrorReporter errorReporter) {
super.prepare(conf, arg, context, errorReporter);
this.conf = conf;
this.topologyName = (String) conf.get(Config.TOPOLOGY_NAME);
// connected to nimbus
nimbus = NimbusClient.getConfiguredClient(conf).getClient();
topologyId = TopologyHelper.getTopologyId(nimbus, topologyName);
// add approved metric name
addApprovedMetirc("__sendqueue", MetricNames.SEND_QUEUE);
addApprovedMetirc("__receive", MetricNames.RECV_QUEUE);
addApprovedMetirc(MetricNames.COMPLETE_LATENCY);
addApprovedMetirc(MetricNames.TASK_EXECUTE);
addApprovedMetirc(MetricNames.EMIT_COUNT);
addApprovedMetirc(MetricNames.DURATION);
metricSendThread = createMetricsSendThread();
metricSendThread.start();
LOG.info("Metrics send thread started");
ctx = new ContainerContextImpl(context.getRawTopology(), conf);
// topology optimizer will start its own thread
// if more services required to start, maybe we need to extract a new interface here
resourceScheduler.init(ctx);
resourceScheduler.start();
outputTopologyInfo(context);
if ((Boolean) conf.getOrDefault(METRIC_OUTPUT, Boolean.FALSE)) {
outputMetric();
}
}
示例13: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的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;
}
示例14: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void prepare(Map stormConf, Object registrationArgument,
TopologyContext context, IErrorReporter errorReporter) {
parseConfig(stormConf);
if (registrationArgument instanceof Map) {
parseConfig((Map) registrationArgument);
}
statsd = new NonBlockingStatsDClient(statsdPrefix + clean(topologyName), statsdHost, statsdPort);
}
示例15: prepare
import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
void prepare(Map stormConf, Object registrationArgument,
TopologyContext context, IErrorReporter errorReporter);