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:
@@ -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());
|
||||
|
@@ -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; }
|
||||
|
Reference in New Issue
Block a user