corgy-w commented on code in PR #7265:
URL: https://github.com/apache/seatunnel/pull/7265#discussion_r1750608285
##########
docs/zh/connector-v2/source/Prometheus.md:
##########
@@ -0,0 +1,149 @@
+# Prometheus
+
+> Prometheus 数据源连接器
+
+## 描述
+
+用于读取prometheus数据。
+
+## 主要特性
+
+- [x] [批处理](../../concept/connector-v2-features.md)
+- [ ] [流处理](../../concept/connector-v2-features.md)
+- [ ] [并行](../../concept/connector-v2-features.md)
+
+## 源选项
+
+| name | type | required |
default value |
+|-----------------------------|---------|----------|--------------------------------------------------------|
+| url | String | Yes | Http 请求链接
|
+| query | String | Yes | prometheus查询语句
|
+| query_type | String | Yes | Instant/Range 查询
|
+| content_field | String | Yes | $.data.result.*
|
+| schema.fields | Config | Yes | 上游数据的模式字段。
|
+| format | String | No | 序列化方式
|
+| params | Map | Yes | 查询参数
|
+| poll_interval_millis | int | No | -
|
+| retry | int | No |
如果请求http返回`IOException`的最大重试次数 |
+| retry_backoff_multiplier_ms | int | No | http请求失败,重试回退次数(毫秒)乘数
|
+| retry_backoff_max_ms | int | No | http请求失败,最大重试回退时间(毫秒)
|
+| enable_multi_lines | boolean | No | false
|
+| common-options | config | No | Source插件常用参数,请参考
[Source常用选项 ](../source-common-options.md) 了解详情 |
+
+### url [String]
+
+http 请求路径。
+
+### query [String]
+
+Prometheus 表达式查询字符串
+
+### query_type [String]
+
+Instant/Range
+
+1. Instant : 简单指标的即席查询。
Review Comment:
should be `即时`?
##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-prometheus-e2e/src/test/java/org/apache/seatunnel/e2e/connector/prometheus/PrometheusIT.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.seatunnel.e2e.connector.prometheus;
+
+import org.apache.seatunnel.e2e.common.TestResource;
+import org.apache.seatunnel.e2e.common.TestSuiteBase;
+import org.apache.seatunnel.e2e.common.container.EngineType;
+import org.apache.seatunnel.e2e.common.container.TestContainer;
+import org.apache.seatunnel.e2e.common.junit.DisabledOnContainer;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestTemplate;
+import org.testcontainers.containers.Container;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
+import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerImageName;
+import org.testcontainers.utility.DockerLoggerFactory;
+
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.util.stream.Stream;
+
+@Slf4j
+public class PrometheusIT extends TestSuiteBase implements TestResource {
+
+ private static final String IMAGE = "bitnami/prometheus:2.53.0";
+
+ private GenericContainer<?> prometheusContainer;
+
+ private static final String HOST = "prometheus-host";
+
+ @BeforeAll
+ @Override
+ public void startUp() {
+ this.prometheusContainer =
+ new GenericContainer<>(DockerImageName.parse(IMAGE))
+ .withNetwork(NETWORK)
+ .withNetworkAliases(HOST)
+ .withEnv("TZ", "Asia/Shanghai")
+ .withExposedPorts(9090)
+ .withCommand(
+
"--config.file=/opt/bitnami/prometheus/conf/prometheus.yml",
+ "--web.enable-remote-write-receiver")
+ .withLogConsumer(new
Slf4jLogConsumer(DockerLoggerFactory.getLogger(IMAGE)))
+ .waitingFor(
+ new HostPortWaitStrategy()
+
.withStartupTimeout(Duration.ofMinutes(2)));
+
prometheusContainer.setPortBindings(Lists.newArrayList(String.format("%s:9090",
"9090")));
+ Startables.deepStart(Stream.of(prometheusContainer)).join();
+ log.info("Mongodb container started");
+ }
+
+ @AfterAll
+ @Override
+ public void tearDown() {
+ if (prometheusContainer != null) {
+ prometheusContainer.stop();
+ }
+ }
+
+ @TestTemplate
+ @DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason = "Currently protobuf version is conflict")
+ public void testPrometheusSinkAndSource(TestContainer container)
+ throws IOException, InterruptedException {
+ //
+ // http prometheus
Review Comment:
`disabledReason` Is there any related info, want to take a look. One more
small detail, extra '//'
##########
docs/zh/connector-v2/sink/Prometheus.md:
##########
@@ -0,0 +1,101 @@
+# Prometheus
+
+> Prometheus 数据接收器
+
+## 引擎支持
+
+> Flink<br/>
+> SeaTunnel Zeta<br/>
+
+## 主要特性
+
+- [ ] [exactly-once](../../concept/connector-v2-features.md)
+- [ ] [cdc](../../concept/connector-v2-features.md)
+- [x] [support multiple table write](../../concept/connector-v2-features.md)
+
+## 描述
+
+接收Source端传入的数据,利用数据触发 web hooks。
+
+> 例如,来自上游的数据为 [`label: {"__name__": "test1"}, value:
1.2.3,time:2024-08-15T17:00:00`], 则body内容如下: `{"label":{"__name__": "test1"},
"value":"1.23","time":"2024-08-15T17:00:00"}`
+
+**Tips: Prometheus 数据接收器 仅支持 `post json` 类型的 web hook,source 数据将被视为 webhook 中的
body 内容。并且不支持传递过去太久的数据**
+
+## 支持的数据源信息
+
+想使用 Prometheus 连接器,需要安装以下必要的依赖。可以通过运行 install-plugin.sh 脚本或者从 Maven 中央仓库下载这些依赖
+
+| 数据源 | 支持版本 | 依赖
|
+|------|-----------|------------------------------------------------------------------------------------------------------------------|
+| Http | universal |
[Download](https://mvnrepository.com/artifact/org.apache.seatunnel/seatunnel-connectors-v2/connector-prometheus)
|
+
+## 接收器选项
+
+| Name | Type | Required | Default | Description
|
+|-----------------------------|--------|----------|---------|-------------------------------------------------------------------|
+| url | String | Yes | - | Http 请求链接
|
+| headers | Map | No | - | Http 标头
|
+| retry | Int | No | - |
如果请求http返回`IOException`的最大重试次数 |
+| retry_backoff_multiplier_ms | Int | No | 100 |
http请求失败,重试回退次数(毫秒)乘数 |
+| retry_backoff_max_ms | Int | No | 10000 |
http请求失败,最大重试回退时间(毫秒) |
+| connect_timeout_ms | Int | No | 12000 | 连接超时设置,默认12s
|
+| socket_timeout_ms | Int | No | 60000 | 套接字超时设置,默认为60s
|
+| key_timestamp | Int | NO | - |
prometheus时间戳的key. |
+| key_label | String | yes | - | prometheus标签的key
|
+| key_value | Double | yes | - | prometheus值的key
|
Review Comment:
repeat
##########
docs/en/connector-v2/source/Prometheus.md:
##########
@@ -0,0 +1,149 @@
+# Prometheus
+
+> Prometheus source connector
+
+## Description
+
+Used to read data from Prometheus.
+
+## Key features
+
+- [x] [batch](../../concept/connector-v2-features.md)
+- [ ] [stream](../../concept/connector-v2-features.md)
+- [ ] [parallelism](../../concept/connector-v2-features.md)
+
+## Options
+
+| name | type | required | default value |
+|-----------------------------|---------|----------|-----------------|
+| url | String | Yes | - |
+| query | String | Yes | - |
+| query_type | String | Yes | Instant |
+| content_field | String | Yes | $.data.result.* |
+| schema.fields | Config | Yes | - |
+| format | String | No | json |
+| params | Map | Yes | - |
+| poll_interval_millis | int | No | - |
+| retry | int | No | - |
+| retry_backoff_multiplier_ms | int | No | 100 |
+| retry_backoff_max_ms | int | No | 10000 |
+| enable_multi_lines | boolean | No | false |
+| common-options | config | No | - |
+
+### url [String]
+
+http request url
+
+### query [String]
+
+Prometheus expression query string
+
+### query_type [String]
+
+Instant/Range
+
+1. Instant : The following endpoint evaluates an instant query at a single
point in time
+2. Range : The following endpoint evaluates an expression query over a range
of time
+
+https://prometheus.io/docs/prometheus/latest/querying/api/
+
+### params [Map]
+
+http params
Review Comment:
sugges:Http request params
zh ditto
##########
docs/zh/connector-v2/source/Prometheus.md:
##########
@@ -0,0 +1,149 @@
+# Prometheus
+
+> Prometheus 数据源连接器
+
+## 描述
+
+用于读取prometheus数据。
+
+## 主要特性
+
+- [x] [批处理](../../concept/connector-v2-features.md)
+- [ ] [流处理](../../concept/connector-v2-features.md)
+- [ ] [并行](../../concept/connector-v2-features.md)
+
+## 源选项
+
+| name | type | required |
default value |
+|-----------------------------|---------|----------|--------------------------------------------------------|
+| url | String | Yes | Http 请求链接
|
+| query | String | Yes | prometheus查询语句
|
+| query_type | String | Yes | Instant/Range 查询
|
+| content_field | String | Yes | $.data.result.*
|
+| schema.fields | Config | Yes | 上游数据的模式字段。
|
+| format | String | No | 序列化方式
|
+| params | Map | Yes | 查询参数
|
+| poll_interval_millis | int | No | -
|
+| retry | int | No |
如果请求http返回`IOException`的最大重试次数 |
+| retry_backoff_multiplier_ms | int | No | http请求失败,重试回退次数(毫秒)乘数
|
+| retry_backoff_max_ms | int | No | http请求失败,最大重试回退时间(毫秒)
|
+| enable_multi_lines | boolean | No | false
|
+| common-options | config | No | Source插件常用参数,请参考
[Source常用选项 ](../source-common-options.md) 了解详情 |
+
Review Comment:
default value, not 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]