Script Development / Connector Object DFF.CONN / Prometheus
The Prometheus connector operation object mainly provides some methods for operating Prometheus.
This connector accesses Prometheus via the HTTP protocol
The parameters for DFF.CONN(...) are as follows:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
connector_id |
str | Required | Connector ID |
timeout |
int/float | 10 |
Default HTTP request timeout of the current operation object, in seconds |
.query(...)
The parameters for sending an HTTP request to Prometheus are as follows:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
method |
str | Required | Request method, such as GET, POST; can also be written as "GET /path" |
path |
str | None |
Request path; if omitted, it is split from method |
query |
dict | None |
URL query parameters |
body |
dict | None |
JSON request body |
timeout |
int/float | None |
Timeout for this request; if omitted, the operation object's default is used |
| Example | |
|---|---|
1 2 3 4 5 6 | |
When query contains both start and end, the connector tries to convert them both to times, sorts them in chronological order, and outputs them as ISO 8601 strings. Other parameters are passed directly to the Prometheus HTTP API.
If the response is JSON or XML, the parsed object is returned; otherwise, raw bytes are returned. When the HTTP status code is greater than or equal to 400, an exception is thrown.
For the Prometheus HTTP API, please refer to the Prometheus official documentation / Querying / HTTP API