Prometheus module.

class spicerack.prometheus.Prometheus[source]

Bases: object

Class to interact with the Prometheus server.

query(query: str, site: str, *, timeout: Union[float, int, None] = 10) → List[Dict][source]

Preform a generic query

  • query (str) -- a prometheus query

  • site (str) -- The site to use for queries. Must be one of spicerack.constants.ALL_DATACENTERS

  • timeout (float, int, None, optional) -- How many seconds to wait for the prometheus to send data before giving up, as a float or int. Alternatively None to indicate an infinite timeout.


returns an empty list if there are no results otherwise return a list of results of the form: {'metric': {}, 'value': [$timestamp, $value]}

Return type



spicerack.prometheus.PrometheusError -- on error

exception spicerack.prometheus.PrometheusError[source]

Bases: spicerack.exceptions.SpicerackError

Custom exception class for errors of this module.