darenwkt commented on code in PR #22: URL: https://github.com/apache/flink-connector-prometheus/pull/22#discussion_r2055383768
########## flink-connector-prometheus/src/main/java/org/apache/flink/connector/prometheus/table/PrometheusConfig.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.connector.prometheus.table; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.configuration.ReadableConfig; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.AWS_REGION; +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.METRIC_LABEL_KEYS; +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.METRIC_NAME; +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.METRIC_REMOTE_WRITE_URL; +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.METRIC_REQUEST_SIGNER; +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.METRIC_SAMPLE_KEY; +import static org.apache.flink.connector.prometheus.table.PrometheusConnectorOption.METRIC_SAMPLE_TIMESTAMP; + +/** Prometheus specific configuration. */ +@Internal +public class PrometheusConfig implements Serializable { + private final ReadableConfig options; + + private static final String DELIMITER = ","; + + public PrometheusConfig(ReadableConfig options) { + this.options = options; + } + + public String getMetricName() { + return options.get(METRIC_NAME); + } + + public List<String> getLabelKeys() { Review Comment: Thanks, this is a good shout, I have updated it to a set ########## flink-connector-prometheus/src/main/java/org/apache/flink/connector/prometheus/table/PrometheusConnectorOption.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.connector.prometheus.table; + +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.ConfigOptions; + +public class PrometheusConnectorOption { + + // ----------------------------------------------------------------------------------------- + // Prometheus connector specific options + // ----------------------------------------------------------------------------------------- + + public static final ConfigOption<String> METRIC_NAME = + ConfigOptions.key("metric.name") + .stringType() + .noDefaultValue() + .withDescription("Prometheus metric name."); + + public static final ConfigOption<String> METRIC_LABEL_KEYS = Review Comment: > Related to previous comment, ConfigOption has native support for CSVs Thanks, this is a great suggestion, have updated PR with it > I would also consider rewording the description to make it clear there can be more than one key name provided. Updated description -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org