Github user harshach commented on a diff in the pull request:
https://github.com/apache/storm/pull/1881#discussion_r96769031
--- Diff:
storm-core/src/jvm/org/apache/storm/metric/ClusterMetricsConsumerExecutor.java
---
@@ -40,31 +39,49 @@ public ClusterMetricsConsumerExecutor(String
consumerClassName, Object registrat
public void prepare() {
try {
metricsConsumer =
(IClusterMetricsConsumer)Class.forName(consumerClassName).newInstance();
+ metricsConsumer.prepare(registrationArgument);
} catch (Exception e) {
- throw new RuntimeException("Could not instantiate a class
listed in config under section " +
- Config.STORM_CLUSTER_METRICS_CONSUMER_REGISTER + "
with fully qualified name " + consumerClassName, e);
- }
+ LOG.error("Could not instantiate or prepare Cluster Metrics
Consumer with fully qualified name " +
+ consumerClassName, e);
- metricsConsumer.prepare(registrationArgument);
+ if (metricsConsumer != null) {
+ metricsConsumer.cleanup();
+ }
+ metricsConsumer = null;
+ }
}
public void handleDataPoints(final IClusterMetricsConsumer.ClusterInfo
clusterInfo, final Collection<DataPoint> dataPoints) {
- try {
- metricsConsumer.handleDataPoints(clusterInfo, dataPoints);
- } catch (Throwable e) {
- LOG.error("Error while handling cluster data points, consumer
class: " + consumerClassName, e);
+ if (metricsConsumer == null) {
--- End diff --
@HeartSaVioR I am worried about the state where its badly configured and
its retrying every scheduled interval. I think we can move it to try
initializing only once and log an error if its fails to do so.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---