wuchong commented on code in PR #2317:
URL: https://github.com/apache/fluss/pull/2317#discussion_r2712108412


##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/AbstractPrometheusReporter.java:
##########
@@ -0,0 +1,431 @@
+/*
+ * 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.fluss.metrics.prometheus;
+
+import org.apache.fluss.annotation.VisibleForTesting;
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.metrics.CharacterFilter;
+import org.apache.fluss.metrics.Counter;
+import org.apache.fluss.metrics.Gauge;
+import org.apache.fluss.metrics.Histogram;
+import org.apache.fluss.metrics.HistogramStatistics;
+import org.apache.fluss.metrics.Meter;
+import org.apache.fluss.metrics.Metric;
+import org.apache.fluss.metrics.groups.MetricGroup;
+
+import io.prometheus.client.Collector;
+import io.prometheus.client.CollectorRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/* This file is based on source code of Apache Flink Project 
(https://flink.apache.org/), licensed by the Apache
+ * Software Foundation (ASF) under the Apache License, Version 2.0. See the 
NOTICE file distributed with this work for
+ * additional information regarding copyright ownership. */
+
+/**
+ * Base class for Prometheus metric reporters. Contains common logic for 
metric registration and
+ * collector management.
+ */
+public abstract class AbstractPrometheusReporter {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(AbstractPrometheusReporter.class);
+
+    protected static final Pattern UNALLOWED_CHAR_PATTERN = 
Pattern.compile("[^a-zA-Z0-9:_]");
+
+    @VisibleForTesting
+    protected static final CharacterFilter CHARACTER_FILTER =
+            AbstractPrometheusReporter::replaceInvalidChars;
+
+    @VisibleForTesting protected static final char SCOPE_SEPARATOR = '_';
+
+    @VisibleForTesting protected static final String SCOPE_PREFIX = "fluss" + 
SCOPE_SEPARATOR;
+
+    protected final Map<String, AbstractMap.SimpleImmutableEntry<Collector, 
Integer>>
+            collectorsWithCountByMetricName = new HashMap<>();
+
+    @VisibleForTesting protected final CollectorRegistry registry = new 
CollectorRegistry(true);
+
+    protected static String replaceInvalidChars(final String input) {
+        // https://prometheus.io/docs/instrumenting/writing_exporters/
+        // Only [a-zA-Z0-9:_] are valid in metric names, any other characters 
should be sanitized to
+        // an underscore.
+        return UNALLOWED_CHAR_PATTERN.matcher(input).replaceAll("_");
+    }
+
+    /**
+     * Configures the reporter. Subclasses should override this to add their 
own configuration.
+     *
+     * @param config the configuration
+     */
+    public void open(Configuration config) {

Review Comment:
   Add `@Override` to all the implemented interface methods. 



##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/PrometheusPushGatewayReporter.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.fluss.metrics.prometheus;
+
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.metrics.Metric;
+import org.apache.fluss.metrics.groups.MetricGroup;
+import org.apache.fluss.metrics.reporter.ScheduledMetricReporter;
+
+import io.prometheus.client.exporter.PushGateway;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Random;
+
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_GROUPING_KEY;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX;
+
+/** {@link ScheduledMetricReporter} that pushes {@link Metric Metrics} to 
Prometheus PushGateway. */
+public class PrometheusPushGatewayReporter extends AbstractPrometheusReporter
+        implements ScheduledMetricReporter {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(PrometheusPushGatewayReporter.class);
+
+    private static final Random RANDOM = new Random();
+
+    private PushGateway pushGateway;
+    private String jobName;
+    private String groupingKey;
+    private boolean deleteOnShutdown;
+    private boolean filterLabelValueCharacters;
+
+    @Override
+    public void open(Configuration config) {
+        String hostUrl = 
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL);
+        this.jobName = 
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME);
+        this.deleteOnShutdown =
+                
config.getBoolean(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN);
+        this.filterLabelValueCharacters =
+                config.getBoolean(
+                        
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS);
+
+        if 
(config.getBoolean(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX))
 {
+            this.jobName = jobName + "_" + RANDOM.nextLong();
+        }
+
+        String configuredGroupingKey =
+                
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_GROUPING_KEY);
+        if (configuredGroupingKey != null) {
+            this.groupingKey = configuredGroupingKey;
+        }
+
+        this.pushGateway = new PushGateway(hostUrl);
+    }
+
+    @Override
+    public void close() {
+        if (deleteOnShutdown) {
+            try {
+                pushGateway.delete(jobName, groupingKey);
+                LOG.info("Deleted metrics from PushGateway.");
+            } catch (IOException e) {
+                LOG.warn("Could not delete metrics from PushGateway.", e);
+            }
+        }
+        super.close();
+    }
+
+    @Override
+    public Duration scheduleInterval() {
+        return Duration.ofSeconds(60);

Review Comment:
   Make this configureable? Most cases, 60s is too late. In Flink, the default 
interval is 10s.



##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/PrometheusPushGatewayReporter.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.fluss.metrics.prometheus;
+
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.metrics.Metric;
+import org.apache.fluss.metrics.groups.MetricGroup;
+import org.apache.fluss.metrics.reporter.ScheduledMetricReporter;
+
+import io.prometheus.client.exporter.PushGateway;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Random;
+
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_GROUPING_KEY;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX;
+
+/** {@link ScheduledMetricReporter} that pushes {@link Metric Metrics} to 
Prometheus PushGateway. */
+public class PrometheusPushGatewayReporter extends AbstractPrometheusReporter
+        implements ScheduledMetricReporter {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(PrometheusPushGatewayReporter.class);
+
+    private static final Random RANDOM = new Random();
+
+    private PushGateway pushGateway;
+    private String jobName;
+    private String groupingKey;
+    private boolean deleteOnShutdown;
+    private boolean filterLabelValueCharacters;
+
+    @Override
+    public void open(Configuration config) {
+        String hostUrl = 
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL);
+        this.jobName = 
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME);
+        this.deleteOnShutdown =
+                
config.getBoolean(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN);
+        this.filterLabelValueCharacters =
+                config.getBoolean(
+                        
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS);

Review Comment:
   I don’t see a strong use case for this configuration, as it’s very difficult 
to guarantee that all characters in table, database, or user names will conform 
to an allowlist—especially in real-world environments with diverse naming 
conventions.  
   
   Can we remove this config for now? Doing so would simplify the 
implementation and avoid introducing an overloaded `notifyOfAddedMetric` method 
(e.g., with an extra `filterCharacters` boolean) and the corresponding override 
in `PrometheusPushGatewayReporter`.  
   
   If users later express a concrete need for character filtering, we can 
always reintroduce this capability with a well-scoped design at that time.



##########
fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java:
##########
@@ -1773,6 +1773,57 @@ public class ConfigOptions {
                                     + "the CoordinatorServer) it is advisable 
to use a port range "
                                     + "like 9250-9260.");
 
+    // ------------------------------------------------------------------------
+    //  ConfigOptions for prometheus push gateway reporter
+    // ------------------------------------------------------------------------
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL =
+            key("metrics.reporter.prometheus-pushgateway.hostUrl")

Review Comment:
   The configuration key is not aligned with Fluss format, I suggest to change 
them into 
   
   
   ```
   metrics.reporter.prometheus-push.url
   metrics.reporter.prometheus-push.job-name
   metrics.reporter.prometheus-push.random-job-name-suffix
   metrics.reporter.prometheus-push.delete-on-shutdown
   metrics.reporter.prometheus-push.filter-label-value-characters
   metrics.reporter.prometheus-push.grouping-key
   ```
   
   Use `prometheus-push` in the key as it is the identifier of 
`metric.reporters=prometheus-push`
   
   



##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/AbstractPrometheusReporter.java:
##########
@@ -0,0 +1,431 @@
+/*
+ * 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.fluss.metrics.prometheus;
+
+import org.apache.fluss.annotation.VisibleForTesting;
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.metrics.CharacterFilter;
+import org.apache.fluss.metrics.Counter;
+import org.apache.fluss.metrics.Gauge;
+import org.apache.fluss.metrics.Histogram;
+import org.apache.fluss.metrics.HistogramStatistics;
+import org.apache.fluss.metrics.Meter;
+import org.apache.fluss.metrics.Metric;
+import org.apache.fluss.metrics.groups.MetricGroup;
+
+import io.prometheus.client.Collector;
+import io.prometheus.client.CollectorRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/* This file is based on source code of Apache Flink Project 
(https://flink.apache.org/), licensed by the Apache
+ * Software Foundation (ASF) under the Apache License, Version 2.0. See the 
NOTICE file distributed with this work for
+ * additional information regarding copyright ownership. */
+
+/**
+ * Base class for Prometheus metric reporters. Contains common logic for 
metric registration and
+ * collector management.
+ */
+public abstract class AbstractPrometheusReporter {

Review Comment:
   `implements MetricReporter`



##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/PrometheusReporter.java:
##########
@@ -17,59 +17,23 @@
 
 package org.apache.fluss.metrics.prometheus;
 
-import org.apache.fluss.annotation.VisibleForTesting;
-import org.apache.fluss.config.Configuration;
-import org.apache.fluss.metrics.CharacterFilter;
-import org.apache.fluss.metrics.Counter;
-import org.apache.fluss.metrics.Gauge;
-import org.apache.fluss.metrics.Histogram;
-import org.apache.fluss.metrics.HistogramStatistics;
-import org.apache.fluss.metrics.Meter;
-import org.apache.fluss.metrics.Metric;
-import org.apache.fluss.metrics.groups.MetricGroup;
 import org.apache.fluss.metrics.reporter.MetricReporter;
 
-import io.prometheus.client.Collector;
-import io.prometheus.client.CollectorRegistry;
 import io.prometheus.client.exporter.HTTPServer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
 
 import static org.apache.fluss.utils.Preconditions.checkState;
 
-/* This file is based on source code of Apache Flink Project 
(https://flink.apache.org/), licensed by the Apache
- * Software Foundation (ASF) under the Apache License, Version 2.0. See the 
NOTICE file distributed with this work for
- * additional information regarding copyright ownership. */
-
-/** {@link MetricReporter} that exports {@link Metric Metrics} via Prometheus. 
*/
-public class PrometheusReporter implements MetricReporter {
+/** {@link MetricReporter} that exports {@link Metric Metrics} via Prometheus 
HTTP server. */

Review Comment:
   Add qualifier for the `Metric` class. 



##########
fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java:
##########
@@ -1773,6 +1773,57 @@ public class ConfigOptions {
                                     + "the CoordinatorServer) it is advisable 
to use a port range "
                                     + "like 9250-9260.");
 
+    // ------------------------------------------------------------------------
+    //  ConfigOptions for prometheus push gateway reporter
+    // ------------------------------------------------------------------------
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL =
+            key("metrics.reporter.prometheus-pushgateway.hostUrl")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription("The URL of the Prometheus PushGateway to 
push metrics to.");
+
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME =
+            key("metrics.reporter.prometheus-pushgateway.jobName")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription(
+                            "The job name under which to push metrics to 
Prometheus PushGateway.");
+
+    public static final ConfigOption<Boolean>
+            METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX =
+                    
key("metrics.reporter.prometheus-pushgateway.randomJobNameSuffix")
+                            .booleanType()
+                            .defaultValue(false)

Review Comment:
   Why not `true` like Flink?



##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/PrometheusPushGatewayReporter.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.fluss.metrics.prometheus;
+
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.metrics.Metric;
+import org.apache.fluss.metrics.groups.MetricGroup;
+import org.apache.fluss.metrics.reporter.ScheduledMetricReporter;
+
+import io.prometheus.client.exporter.PushGateway;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Random;
+
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_GROUPING_KEY;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME;
+import static 
org.apache.fluss.config.ConfigOptions.METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX;
+
+/** {@link ScheduledMetricReporter} that pushes {@link Metric Metrics} to 
Prometheus PushGateway. */
+public class PrometheusPushGatewayReporter extends AbstractPrometheusReporter
+        implements ScheduledMetricReporter {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(PrometheusPushGatewayReporter.class);
+
+    private static final Random RANDOM = new Random();
+
+    private PushGateway pushGateway;
+    private String jobName;
+    private String groupingKey;
+    private boolean deleteOnShutdown;
+    private boolean filterLabelValueCharacters;
+
+    @Override
+    public void open(Configuration config) {
+        String hostUrl = 
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL);
+        this.jobName = 
config.getString(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME);
+        this.deleteOnShutdown =
+                
config.getBoolean(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN);
+        this.filterLabelValueCharacters =
+                config.getBoolean(
+                        
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS);
+
+        if 
(config.getBoolean(METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX))
 {
+            this.jobName = jobName + "_" + RANDOM.nextLong();

Review Comment:
   Could you follow Flink `PrometheusPushGatewayReporterFactory` to initialize 
the `PrometheusPushGatewayReporter` in the 
`PrometheusPushGatewayReporterPlugin#createMetricReporter`? This can make all 
the member variables immutable (better for JVM). And we can print an 
information for the registered reporter in the 
`PrometheusPushGatewayReporterPlugin#createMetricReporter`.
   
   ```java
   LOG.info(
                   "Configured PrometheusPushGatewayReporter with {hostUrl:{}, 
jobName:{}, randomJobNameSuffix:{}, deleteOnShutdown:{}, groupingKey:{}}",
                   hostUrl,
                   jobName,
                   randomSuffix,
                   deleteOnShutdown,
                   groupingKey);
   ```



##########
fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java:
##########
@@ -1773,6 +1773,57 @@ public class ConfigOptions {
                                     + "the CoordinatorServer) it is advisable 
to use a port range "
                                     + "like 9250-9260.");
 
+    // ------------------------------------------------------------------------
+    //  ConfigOptions for prometheus push gateway reporter
+    // ------------------------------------------------------------------------
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL =
+            key("metrics.reporter.prometheus-pushgateway.hostUrl")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription("The URL of the Prometheus PushGateway to 
push metrics to.");
+
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME =
+            key("metrics.reporter.prometheus-pushgateway.jobName")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription(
+                            "The job name under which to push metrics to 
Prometheus PushGateway.");
+
+    public static final ConfigOption<Boolean>
+            METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX =
+                    
key("metrics.reporter.prometheus-pushgateway.randomJobNameSuffix")
+                            .booleanType()
+                            .defaultValue(false)
+                            .withDescription(
+                                    "Whether to append a random suffix to the 
job name. "
+                                            + "This is useful when multiple 
instances of the reporter "
+                                            + "are running on the same host.");
+
+    public static final ConfigOption<Boolean>
+            METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN =
+                    
key("metrics.reporter.prometheus-pushgateway.deleteOnShutdown")
+                            .booleanType()
+                            .defaultValue(false)
+                            .withDescription(
+                                    "Whether to delete metrics from 
PushGateway on shutdown.");

Review Comment:
   Flink sets the config to `true` by default, why do we use `false`?
   
   Besides, maybe we can add a note like Flink for this config? `Fluss will try 
its best to delete the metrics but this is not guaranteed.`



##########
fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java:
##########
@@ -1773,6 +1773,57 @@ public class ConfigOptions {
                                     + "the CoordinatorServer) it is advisable 
to use a port range "
                                     + "like 9250-9260.");
 
+    // ------------------------------------------------------------------------
+    //  ConfigOptions for prometheus push gateway reporter
+    // ------------------------------------------------------------------------
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_HOST_URL =
+            key("metrics.reporter.prometheus-pushgateway.hostUrl")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription("The URL of the Prometheus PushGateway to 
push metrics to.");
+
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_JOB_NAME =
+            key("metrics.reporter.prometheus-pushgateway.jobName")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription(
+                            "The job name under which to push metrics to 
Prometheus PushGateway.");
+
+    public static final ConfigOption<Boolean>
+            METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX =
+                    
key("metrics.reporter.prometheus-pushgateway.randomJobNameSuffix")
+                            .booleanType()
+                            .defaultValue(false)
+                            .withDescription(
+                                    "Whether to append a random suffix to the 
job name. "
+                                            + "This is useful when multiple 
instances of the reporter "
+                                            + "are running on the same host.");
+
+    public static final ConfigOption<Boolean>
+            METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_DELETE_ON_SHUTDOWN =
+                    
key("metrics.reporter.prometheus-pushgateway.deleteOnShutdown")
+                            .booleanType()
+                            .defaultValue(false)
+                            .withDescription(
+                                    "Whether to delete metrics from 
PushGateway on shutdown.");
+
+    public static final ConfigOption<Boolean>
+            
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_FILTER_LABEL_VALUE_CHARACTERS =
+                    
key("metrics.reporter.prometheus-pushgateway.filterLabelValueCharacters")
+                            .booleanType()
+                            .defaultValue(true)
+                            .withDescription(
+                                    "Whether to filter characters in label 
values to conform to the "
+                                            + "Prometheus character set 
([a-zA-Z0-9:_]).");
+
+    public static final ConfigOption<String> 
METRICS_REPORTER_PROMETHEUS_PUSHGATEWAY_GROUPING_KEY =
+            key("metrics.reporter.prometheus-pushgateway.groupingKey")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription(
+                            "The grouping key to use when pushing metrics to 
Prometheus PushGateway. "
+                                    + "The format should be k1=v1;k2=v2.");

Review Comment:
   Could you update **all the option description** like Flink?
   
   
https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/metric_reporters/#prometheuspushgateway



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to