Github user HeartSaVioR commented on a diff in the pull request:
https://github.com/apache/storm/pull/1881#discussion_r96588990
--- 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 --
Some modules (at least what I've reported) could throw error on
initialization phase when backend storage is not working properly. This could
be intermittent so I thought it might be better to retry when needed, but I'm
also OK to remove retry logic and leave error log if we don't want to retry
automatically.
---
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.
---