From a0c2f04d668ffc11be80176fbdf3bfb1c43b8d16 Mon Sep 17 00:00:00 2001 From: Aparna Valsala Date: Mon, 20 Mar 2023 11:32:14 +0000 Subject: [PATCH] Update prometheus_url.py fixed the errorRatioQuery --- src/autometrics/prometheus_url.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/autometrics/prometheus_url.py b/src/autometrics/prometheus_url.py index d4579bd..8a927a9 100644 --- a/src/autometrics/prometheus_url.py +++ b/src/autometrics/prometheus_url.py @@ -15,7 +15,7 @@ def __init__(self, functionName, moduleName): def createURLs(self): requestRateQuery =f'sum by (function, module) (rate (function_calls_count_total{{function="{self.functionName}",module="{self.moduleName}"}}[5m]))' latencyQuery= f'sum by (le, function, module) (rate(function_calls_duration_bucket{{function="{self.functionName}",module="{self.moduleName}"}}[5m]))' - errorRatioQuery = f'sum by (function, module) (rate (function_calls_count{{function="{self.functionName}",module="{self.moduleName}", result="error"}}[5m])) / {requestRateQuery}' + errorRatioQuery = f'sum by (function, module) (rate (function_calls_count_total{{function="{self.functionName}",module="{self.moduleName}", result="error"}}[5m])) / {requestRateQuery}' queries = [requestRateQuery,latencyQuery, errorRatioQuery] names =["Request rate URL", "Latency URL", "Error Ratio URL"] @@ -32,4 +32,4 @@ def createURLs(self): def createPrometheusUrl(self, query): urlEncode = urllib.parse.quote(query) url =f'{self.baseUrl}graph?g0.expr={urlEncode}&g0.tab=0' - return url \ No newline at end of file + return url