-
Notifications
You must be signed in to change notification settings - Fork 26
Adding support for Dhalion to fetch metrics from multiple metrics pro… #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Dhalion, we have been using 120 column size lines instead of the hadoop style of 80 column lines. Could you please reformat accordingly.
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| public class CompositeMetricsProvider implements MetricsProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class needs some a javadoc to help users know the behavior of this implementation
|
|
||
| @VisibleForTesting | ||
| protected void instantiateMetricsProviders() throws ClassNotFoundException { | ||
| Injector injector = Guice.createInjector(new AbstractModule() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating an injector here does not seem correct. This injector can only be used for instantiating metrics providers that need sysconfig. This may not be sufficient. If at all there needs to be a way to pass the injector in the constructor and use it.
| } | ||
| } | ||
|
|
||
| protected void addMetricsProvider(MetricsProvider provider) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this protected for testing?
| metricsProvider.initialize(); | ||
| Set<String> metricTypes = metricsProvider.getMetricTypes(); | ||
| if (metricTypes != null) { | ||
| for (String metricType : metricsProvider.getMetricTypes()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse the metric type set above?
| for (String metricType : metricsProvider.getMetricTypes()) { | |
| for (String metricType : metricTypes) { |
| Set<String> metricTypes = metricsProvider.getMetricTypes(); | ||
| if (metricTypes != null) { | ||
| for (String metricType : metricsProvider.getMetricTypes()) { | ||
| metricsProviderMap.put(metricType, metricsProvider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should an exception be thrown if more than one metrics provider supports a metric type?
…viders.