Skip to content

Commit

Permalink
added query to the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Avi-Robusta committed Jul 30, 2024
1 parent 2429918 commit 6001462
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,18 @@ async def gather_data(
async def query_and_validate(self, prom_query) -> Any:
result = await self.query(prom_query)
if len(result) != 1:
logger.warning("Error: Expected exactly one result from Prometheus query.")
logger.warning(f"Error: Expected exactly one result from Prometheus query. {prom_query}")
return None

result_value = result[0].get("value")

# Verify that the "value" list has exactly two elements (timestamp and value)
if not result_value:
logger.warning("Error: Missing value in Prometheus result.")
logger.warning(f"Error: Missing value in Prometheus result. {prom_query}")
return None

if len(result_value) != 2:
logger.warning("Error: Prometheus result values are not of expected size.")
logger.warning(f"Error: Prometheus result values are not of expected size. {prom_query}")
return None

return result_value[1]
Expand Down

0 comments on commit 6001462

Please sign in to comment.