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


Java IErrorReporter类代码示例

本文整理汇总了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();
    }

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:19,代码来源:KafkaConsumerMonitorMetrics.java

示例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());
}
 
开发者ID:uzh,项目名称:storm-scheduler,代码行数:23,代码来源:MonitoringMetricsToGraphiteWriter.java

示例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;
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:18,代码来源:MetricsConsumerBolt.java

示例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);
    }
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:23,代码来源:DebugMetricsConsumer.java

示例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);
    }
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:20,代码来源:MetricsConsumer.java

示例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]);
            }
        });
    }
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:19,代码来源:FilteredMetricsCollector.java

示例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;
	}
}
 
开发者ID:Aloomaio,项目名称:storm-graphite-metrics,代码行数:26,代码来源:GraphiteMetricsConsumer.java

示例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);
}
 
开发者ID:uzh,项目名称:storm-scheduler,代码行数:11,代码来源:LoggingMetricsConsumer.java

示例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;
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:12,代码来源:MetricsConsumerBolt.java

示例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);
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:13,代码来源:ForwardingMetricsConsumer.java

示例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);
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:14,代码来源:RedisMetricsCollector.java

示例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();
    }
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:31,代码来源:ResaContainer.java

示例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;
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:12,代码来源:MetricsConsumerBolt.java

示例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);
}
 
开发者ID:endgameinc,项目名称:storm-metrics-statsd,代码行数:13,代码来源:StatsdMetricConsumer.java

示例15: prepare

import backtype.storm.task.IErrorReporter; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
void prepare(Map stormConf, Object registrationArgument,
		TopologyContext context, IErrorReporter errorReporter);
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:4,代码来源:IMetricsConsumer.java


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