[
https://issues.apache.org/jira/browse/FLINK-4695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15526109#comment-15526109
]
ASF GitHub Bot commented on FLINK-4695:
---------------------------------------
Github user StephanEwen commented on a diff in the pull request:
https://github.com/apache/flink/pull/2555#discussion_r80688384
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
---
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.metrics;
+
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.ConfigConstants;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.DelegatingConfiguration;
+import org.apache.flink.runtime.metrics.scope.ScopeFormat;
+import org.apache.flink.runtime.metrics.scope.ScopeFormats;
+import org.apache.flink.util.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * Configuration object for {@link MetricRegistry}.
+ */
+public class MetricRegistryConfiguration {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(MetricRegistryConfiguration.class);
+
+ private static MetricRegistryConfiguration DEFAULT_CONFIGURATION;
--- End diff --
The double-check-locking trick will not be safe unless this field is
volatile.
If no strictly "only once" initialization is needed, then there is probably
no need for locking anyways.
> Separate configuration parsing from MetricRegistry
> --------------------------------------------------
>
> Key: FLINK-4695
> URL: https://issues.apache.org/jira/browse/FLINK-4695
> Project: Flink
> Issue Type: Improvement
> Components: Metrics
> Affects Versions: 1.2.0
> Reporter: Till Rohrmann
> Assignee: Till Rohrmann
> Priority: Minor
>
> In order to decouple the {{MetricRegistry}} object instantiation from the
> global configuration, we could introduce a {{MetricRegistryConfiguration}}
> object which encapsulates all necessary information for the
> {{MetricRegistry}}. The {{MetricRegistryConfiguration}} could have a static
> method to be generated from a {{Configuration}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)