import ChangeLog from ‘../changelog/connector-prometheus.md’;
Prometheus 数据源连接器
用于读取prometheus数据。
| 名称 | 类型 | 是否必填 | 默认值 |
|---|---|---|---|
| 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 |
http 请求路径。
Prometheus 表达式查询字符串
Instant/Range
https://prometheus.io/docs/prometheus/latest/querying/api/
http 请求参数
流模式下请求HTTP API间隔(毫秒)
The max retry times if request http return to IOException
请求http返回到' IOException '的最大重试次数
http请求失败,最大重试回退时间(毫秒)
上游数据的格式,默认为json。
按照如下填写一个固定值
schema = { fields { metric = "map<string, string>" value = double time = long } }
上游数据的模式字段
源插件常用参数,请参考Source Common Options 了解详细信息
source { Prometheus { plugin_output = "http" url = "http://mockserver:1080" query = "up" query_type = "Instant" content_field = "$.data.result.*" format = "json" schema = { fields { metric = "map<string, string>" value = double time = long } } } }
source { Prometheus { plugin_output = "http" url = "http://mockserver:1080" query = "up" query_type = "Range" content_field = "$.data.result.*" format = "json" start = "2024-07-22T20:10:30.781Z" end = "2024-07-22T20:11:00.781Z" step = "15s" schema = { fields { metric = "map<string, string>" value = double time = long } } } }