Skip to main content

Prometheus ExecModule

Overview​

PrometheusModule runs read-only PromQL queries against a Prometheus HTTPS endpoint. Use an instant query to check a current condition or a range query to collect evidence across a rollout or incident. Pass the result to a decision, summary, or approval step and handle empty results separately from provider failures.

Usage​

  1. Have an administrator approve the Prometheus destination. Use your operator's existing verification process to test a dedicated read-only credential against that approved query endpoint.
  2. In the full Integration Account Console, create a READY account using the Prometheus template or the account fields below.
  3. Add Prometheus to a workflow and select the saved account in the prometheusAccount connection control.
  4. Choose an operation, write a PromQL expression scoped to the service or job, and set an evaluation time or range as needed.
  5. Check the result status and type before using the returned samples. A successful query can return an empty vector or matrix.

Inputs​

InputTypePurpose
operationstringChoose instant_query or range_query.
querystringRequired PromQL expression, up to 4,096 characters.
timeEpochSecondsintegerOptional positive Unix timestamp for an instant query. When omitted, Prometheus evaluates at the server's current time.
startEpochSeconds, endEpochSecondsintegerRequired positive Unix timestamps for a range query. The end can equal the start for a single evaluation. The span can be at most seven days.
stepSecondsintegerRange query interval in seconds. Defaults to 60 and accepts up to 86,400. Adjust the window or step to stay within 1,000 evaluations.
seriesLimitintegerMaximum series per vector or matrix response. Defaults to 100 and accepts up to 500.
timeoutSecondsintegerPrometheus query evaluation timeout in seconds. Defaults to 10 and accepts up to 15.
maxAttemptsintegerSaved module configuration for total attempts. Defaults to two and accepts one to three.

Outputs​

OutputTypeMeaning
statusstringsuccess or error.
operationstringSelected operation, when known.
httpStatusintegerHTTP status when Prometheus responded.
attemptsintegerNumber of provider request attempts.
resultTypestringOn success, the Prometheus result type. An instant query can return vector, matrix, scalar, or string. A range query returns a matrix.
resultarrayPrometheus data in its native response shape, including label sets, sample pairs, and histogram structures where present.
countintegerNumber of returned vector or matrix series, or one for a scalar or string result.
warnings, infosarraySanitized advisory messages when returned. Review them before relying on the result.
errorobjectSafe code, message, and retryable fields, with httpStatus when available.

Each sample pair contains a Unix timestamp in seconds and a value. Prometheus represents ordinary sample values as strings, including special values such as NaN. Check the sample shape and parse only the values needed by your workflow. Preserve series labels when they identify the affected service or instance.

IntegrationAccount Requirements​

Use a READY IntegrationAccount with a descriptive name such as Prometheus Production. Set its accountId to the exact HTTPS origin, such as https://metrics.example.com. Put the HTTP Basic credentials in the account's username and encrypted password fields. The password is encrypted at rest. Use a dedicated identity that can access only the query endpoints and metrics the workflow needs. Configure access on Prometheus or its authenticating gateway. Keep credentials out of PromQL, workflow inputs, and downstream results.

Configuration​

A saved operation takes precedence over a mapped operation. Mapped query, timing, series limit, and timeout values override their saved defaults. Set the attempt limit in the saved module configuration. API-authored configurations can use retryPolicy.maxAttempts or a saved module parameter.

Use the root of an HTTPS host on port 443. The account origin accepts an optional trailing slash. Use a hostname that resolves only to public addresses. An administrator must add that exact hostname to the outbound allowlist via valkyrai.security.network.allowed-destinations or VALKYRAI_SECURITY_NETWORK_ALLOWED_DESTINATIONS. The connector uses the platform’s guarded outbound routing and standard TLS certificate validation, with redirects disabled. A wildcard entry alone does not approve the host. If Prometheus is private or serves under a URL subpath, expose the query endpoints through a dedicated approved HTTPS gateway at the root of a hostname.

Operations​

OperationRequestTypical use
instant_queryPOST /api/v1/queryRead the current scrape health of a known job or evaluate a signal at a specific time.
range_queryPOST /api/v1/query_rangeInspect a metric before and after a deployment or assemble a short incident timeline.

The module submits URL-encoded form data. The operation determines the endpoint and applicable time fields.

Errors and Failure Modes​

Invalid inputs, an unready connection, or an unapproved endpoint fail before a Prometheus request. If Prometheus denies access, verify the Basic credentials and gateway permissions. PromQL syntax and evaluation errors require adjusting the query or window. Errors exclude the submitted query, provider response body, and account credentials.

Transient connection failures and HTTP 429, 502, 503, and 504 can retry within the configured attempt limit. Each HTTP attempt has a timeout five seconds longer than the requested Prometheus evaluation timeout, up to 20 seconds. A provider retry delay over five seconds is returned to the workflow as a retryable failure. If the response exceeds 5 MiB or contains more series than requested, the query fails. Narrow the label selectors, aggregate the result, or increase the range step before retrying. An empty result is a separate outcome that can indicate missing instrumentation or an unmatched selector.

Example​

A deployment workflow queries the scrape status of the checkout job at three one-minute intervals. In a live workflow, map the start and end to the rollout window.

{
"operation": "range_query",
"query": "up{job=\"checkout\"}",
"startEpochSeconds": 1794009600,
"endEpochSeconds": 1794009720,
"stepSeconds": 60,
"seriesLimit": 20
}

A selected successful response for one target could contain:

{
"status": "success",
"operation": "range_query",
"resultType": "matrix",
"count": 1,
"result": [
{
"metric": {"__name__": "up", "job": "checkout", "instance": "checkout-1:8080"},
"values": [[1794009600, "1"], [1794009660, "0"], [1794009720, "1"]]
}
]
}

For this metric, a zero indicates a failed scrape. The workflow can capture the target label and timestamp for review. Compare the same query and step over a matching pre-deployment window to add context.

Notes​

  • Pagination. Both endpoints return one result per request. Prometheus may truncate vector or matrix results to the series limit and provides no continuation cursor.
  • Rate limits. Gateway limits and Prometheus query capacity vary by deployment. Scope label selectors and time windows before increasing concurrency or retrying broad queries.
  • API limits. The module supports instant and range PromQL evaluation. Scrape configuration, alert management, and remote write require separate interfaces.
  • Idempotency and destructive behavior. Both operations read data and leave Prometheus resources unchanged. Repeated queries can produce different values when new samples arrive or the evaluation time changes.

See the Prometheus HTTP API reference for query semantics and result formats.