Prometheus
eventmesh-connector-prometheus is a source connector. It runs a PromQL range query against Prometheus on a sliding time window and publishes each series result to EventMesh. This module has no sink (sinkEnable stays false).
PrometheusSourceConnector: From Prometheus to EventMesh
- Start Prometheus and EventMesh Runtime.
- Enable sourceConnector (
sourceEnable: trueinserver-config.yml) and checksource-config.yml. - Start
PrometheusConnectServer. It queries Prometheus and sends each result topubSubConfig.subjectin EventMesh Runtime.
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: prometheusSource
appId: 5032
userName: prometheusSourceUser
passWord: prometheusPassWord
connectorConfig:
connectorName: prometheusSource
connectorId: prometheusSourceId
address: https://127.0.0.1:9090
api: /api/v1/query_range
initTime: 1237507200
query: up
interval: 60
step: 1s
Configuration
pubSubConfig is the EventMesh TCP client used to publish into Runtime. connectorConfig fields:
connectorName: name of the connector.connectorId: id of this connector instance.address: Prometheus base URL (scheme://host:port).api: HTTP path, typically/api/v1/query_range.initTime: Unix timestamp in seconds for the first window start. If omitted, the connector uses the current time.query: PromQL expression (for exampleup).interval: window size and poll period, in seconds. After a successful commit the next window starts atstart + interval.step: Prometheus range-query resolution (for example1s,15s).
Precautions
- Source only. The bundled
server-config.ymlsetssourceEnable: trueandsinkEnable: false. There is no Prometheus sink in this connector. - Each poll POSTs JSON
{query, start, end, step}to{address}/{api}.endisstart + interval. Times are Unix seconds. - If the next window would end in the future, poll sleeps for
intervalseconds. - HTTP calls retry up to 3 times with a 1 second wait. Failed polls log an error and return no records.
- Prometheus must be reachable from the connector process. The sample
addressuses HTTPS on localhost.