Skip to content

Commit

Permalink
Update prometheus_url.py
Browse files Browse the repository at this point in the history
fixed the errorRatioQuery
  • Loading branch information
v-aparna authored Mar 20, 2023
1 parent f78b1e6 commit a0c2f04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/autometrics/prometheus_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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
return url

0 comments on commit a0c2f04

Please sign in to comment.