Package org.tailormap.api.prometheus
Class PrometheusService
java.lang.Object
org.tailormap.api.prometheus.PrometheusService
Service for managing Prometheus-related operations. This service can be used to manage Prometheus-related operations
such as querying and managing metrics stored in the Prometheus instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes a Prometheus tombstone query.void
deleteMetric
(String metricName) Executes a Prometheus delete query.com.fasterxml.jackson.databind.JsonNode
executeQuery
(String promQuery) Executes a Prometheus query and returns the result.boolean
Check if the Prometheus server is available by sending a simple query.
-
Constructor Details
-
PrometheusService
public PrometheusService(org.springframework.web.client.RestTemplate template)
-
-
Method Details
-
isPrometheusAvailable
public boolean isPrometheusAvailable()Check if the Prometheus server is available by sending a simple query. -
executeQuery
public com.fasterxml.jackson.databind.JsonNode executeQuery(String promQuery) throws com.fasterxml.jackson.core.JsonProcessingException, IOException Executes a Prometheus query and returns the result.- Parameters:
promQuery
- the Prometheus query to execute- Returns:
- the result of the query as a JSON node
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- if there is an error processing the JSON responseIOException
- if there is an error executing the query- See Also:
-
deleteMetric
Executes a Prometheus delete query.- Parameters:
metricName
- the Prometheus metric to be deleted- Throws:
IOException
- if there is an error executing the delete query
-
cleanTombstones
Executes a Prometheus tombstone query.- Throws:
IOException
- if there is an error executing the delete query
-