You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2017/10/31 12:37:01 UTC

[05/10] flink git commit: [hotfix][metrics] Remove MetricRegistryConfiguration#createScopeConfig

[hotfix][metrics] Remove MetricRegistryConfiguration#createScopeConfig

This method duplicates ScopeFormats#fromConfig


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/9c1a67d9
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/9c1a67d9
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/9c1a67d9

Branch: refs/heads/master
Commit: 9c1a67d9f6fbb766b50fe74b2713484bf3bd070e
Parents: 3bf6ec9
Author: zentol <ch...@apache.org>
Authored: Mon Oct 30 15:07:52 2017 +0100
Committer: zentol <ch...@apache.org>
Committed: Tue Oct 31 11:53:45 2017 +0100

----------------------------------------------------------------------
 .../metrics/MetricRegistryConfiguration.java     | 19 +------------------
 .../runtime/metrics/MetricRegistryTest.java      |  2 +-
 2 files changed, 2 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/9c1a67d9/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java b/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
index 6f6db86..b61ec5d 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
@@ -94,7 +94,7 @@ public class MetricRegistryConfiguration {
 	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();
@@ -130,23 +130,6 @@ public class MetricRegistryConfiguration {
 		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) {

http://git-wip-us.apache.org/repos/asf/flink/blob/9c1a67d9/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/MetricRegistryTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/MetricRegistryTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/MetricRegistryTest.java
index ccbb4f4..284b86a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/MetricRegistryTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/MetricRegistryTest.java
@@ -331,7 +331,7 @@ public class MetricRegistryTest extends TestLogger {
 		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());