Skip to content

Prometheus ​

The Prometheus Source connects an AI System to a Prometheus server. Metric Tests read the value of one Prometheus metric and compare it with a threshold.

Used byMetric Tests
ModePull
CredentialsServer URL and an API key that the server accepts as a Bearer token
Metric selectionType the metric name

Scout, Agent Tests, and the Risk Agent cannot read a Prometheus Source. An Agent Test that has a Prometheus Source in its Sources ends with an error.

Where in Modulos ​

  • AI System → Settings → Sources → Add Source → Prometheus adds the Source.

Before you start ​

  • An Organization Admin makes Prometheus available. See Source & Connectors.
  • Get the URL of the Prometheus server, for example https://prometheus.example.com:9090.
  • Get a read-only token that the server, or a proxy in front of it, accepts in the header Authorization: Bearer <token>.

How to connect Prometheus ​

  1. Open AI System → Settings → Sources.
  2. Select Add Source.
  3. Select Prometheus.
  4. Type a Source Name.
  5. Type the URL of the server in Server URL.
  6. Paste the token into API Key.
  7. Select Save.
Add Source dialog with Prometheus selected: the connection instructions on the left, the fields on the right.
Add a Prometheus Source.
  1. 1
    Server URL
    The URL of the Prometheus server.
  2. 2
    API Key
    A token that the server accepts as a Bearer token.

When you save, Modulos sends the query up to the server with the token. If the server does not answer or rejects the token, the Source is not saved.

Metrics for Metric Tests ​

A Metric Test on a Prometheus Source reads one metric:

  1. In the test dialog, type the metric name, for example http_requests_total.
  2. Select Check.

Modulos reads the current value of the metric and the help text that Prometheus gives for it. If the metric has no current value, the dialog shows "Metric not found". A value that is a number makes a number metric. Other values make a text metric.

Before each run, Modulos does the Check again. If the metric has no current value at that time, the run ends with an error. Then Modulos sends last_over_time(<metric>[<window>]). The window is the schedule period of the test, or 1 day if the test has no schedule. If the metric has more than one series, Modulos uses the first series.

Important considerations ​

  • Type a metric name, not a PromQL expression.
  • The Check step also reads /api/v1/metadata from the server. If that endpoint fails, the check fails.
  • Give the token read access only.