Skip to content

Conversation

@abmodi
Copy link
Collaborator

@abmodi abmodi commented Nov 19, 2018

…viders.

@abmodi abmodi requested review from ashvina and avflor November 19, 2018 07:01
Copy link
Contributor

@ashvina ashvina left a 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 {
Copy link
Contributor

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() {
Copy link
Contributor

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) {
Copy link
Contributor

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()) {
Copy link
Contributor

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?

Suggested change
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);
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants