Skip to content

Commit

Permalink
[hotfix][metrics] Remove MetricRegistryConfiguration#createScopeConfig
Browse files Browse the repository at this point in the history
This method duplicates ScopeFormats#fromConfig
  • Loading branch information
zentol committed Oct 31, 2017
1 parent 3bf6ec9 commit 9c1a67d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public List<Tuple2<String, Configuration>> getReporterConfigurations() {
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) {
ScopeFormats scopeFormats;
try {
scopeFormats = createScopeConfig(configuration);
scopeFormats = ScopeFormats.fromConfig(configuration);
} catch (Exception e) {
LOG.warn("Failed to parse scope format, using default scope formats", e);
scopeFormats = new ScopeFormats();
Expand Down Expand Up @@ -130,23 +130,6 @@ public static MetricRegistryConfiguration fromConfiguration(Configuration config
return new MetricRegistryConfiguration(scopeFormats, delim, reporterConfigurations);
}

/**
* Create the scope formats from the given {@link Configuration}.
*
* @param configuration to extract the scope formats from
* @return Scope formats extracted from the given configuration
*/
static ScopeFormats createScopeConfig(Configuration configuration) {
String jmFormat = configuration.getString(MetricOptions.SCOPE_NAMING_JM);
String jmJobFormat = configuration.getString(MetricOptions.SCOPE_NAMING_JM_JOB);
String tmFormat = configuration.getString(MetricOptions.SCOPE_NAMING_TM);
String tmJobFormat = configuration.getString(MetricOptions.SCOPE_NAMING_TM_JOB);
String taskFormat = configuration.getString(MetricOptions.SCOPE_NAMING_TASK);
String operatorFormat = configuration.getString(MetricOptions.SCOPE_NAMING_OPERATOR);

return new ScopeFormats(jmFormat, jmJobFormat, tmFormat, tmJobFormat, taskFormat, operatorFormat);
}

public static MetricRegistryConfiguration defaultMetricRegistryConfiguration() {
// create the default metric registry configuration only once
if (defaultConfiguration == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public void testScopeConfig() {
config.setString(MetricOptions.SCOPE_NAMING_TASK, "C");
config.setString(MetricOptions.SCOPE_NAMING_OPERATOR, "D");

ScopeFormats scopeConfig = MetricRegistryConfiguration.createScopeConfig(config);
ScopeFormats scopeConfig = ScopeFormats.fromConfig(config);

assertEquals("A", scopeConfig.getTaskManagerFormat().format());
assertEquals("B", scopeConfig.getTaskManagerJobFormat().format());
Expand Down

0 comments on commit 9c1a67d

Please sign in to comment.