1
1
mirror of https://github.com/MarginaliaSearch/MarginaliaSearch.git synced 2025-10-05 21:22:39 +02:00

(index) Make metrics make more sense by normalizing them by query budget

This commit is contained in:
Viktor Lofgren
2025-08-15 03:11:57 +02:00
parent d711ee75b5
commit 50ac926060
2 changed files with 3 additions and 1 deletions

View File

@@ -136,7 +136,7 @@ public class IndexQueryExecution {
metric_index_documents_ranked
.labels(nodeName)
.inc(resultHeap.getItemsProcessed());
.inc(1000. * resultHeap.getItemsProcessed() / budget.timeLeft());
// Final result selection
return rankingService.selectBestResults(limitByDomain, limitTotal, rankingContext, resultHeap.toList());

View File

@@ -4,9 +4,11 @@ package nu.marginalia.index.query;
/** An execution time budget for index search operations. */
public class IndexSearchBudget {
private final long timeout;
private final long limitTime;
public IndexSearchBudget(long limitTime) {
this.timeout = System.currentTimeMillis() + limitTime;
this.limitTime = limitTime;
}
public boolean hasTimeLeft() { return System.currentTimeMillis() < timeout; }