Skip to content

Commit

Permalink
Add ES stats only when they are available in vector query stats
Browse files Browse the repository at this point in the history
Change-Id: I3bc86901333b165a7b4d315a741a0a6b64cd5fcc
Reviewed-on: https://review.couchbase.org/c/TAF/+/222669
Reviewed-by: Pierre Regazzoni <[email protected]>
Tested-by: Build Bot <[email protected]>
  • Loading branch information
ritalrw committed Jan 30, 2025
1 parent ae94155 commit 7a5ca7e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pytests/aGoodDoctor/opd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,10 +1150,11 @@ def check_query_stats():
"Avg Execution Time(ms)",
"Latest 1K - Avg Execution Time(ms)",
"Avg Accuracy",
"Avg Recall",
"ES Avg Execution Time(ms)",
"ES Avg Recall"
"Avg Recall"
])
if ql.esClient is not None:
self.query_table.headers.extend(["ES Avg Execution Time(ms)",
"ES Avg Recall"])
try:
for query, _ in sorted(ql.bucket.query_map.items(), key=lambda x: x[1]["identifier"]):
with ql.query_stats[query][5]:
Expand All @@ -1167,10 +1168,15 @@ def check_query_stats():
round(ql.query_stats[query][0]/ql.query_stats[query][1], 2),
round(sum(ql.query_stats[query][8][-1000:])/min(1000,len(ql.query_stats[query][8][-1000:])), 2),
round(ql.query_stats[query][2]/ql.query_stats[query][1], 2),
round(ql.query_stats[query][3]/ql.query_stats[query][1], 2),
round(ql.query_stats[query][6]/ql.query_stats[query][1], 2),
round(ql.query_stats[query][7]/ql.query_stats[query][1], 2)
])
round(ql.query_stats[query][3]/ql.query_stats[query][1], 2)
]
)
if ql.esClient is not None:
self.query_table.rows[-1].extend(
[str(round(ql.query_stats[query][6]/ql.query_stats[query][1], 2)),
str(round(ql.query_stats[query][7]/ql.query_stats[query][1], 2))
]
)
except Exception as e:
print(e)
self.table.add_row([
Expand Down

0 comments on commit 7a5ca7e

Please sign in to comment.