feat(multi-search): add metrics recording to multi-search endpoint (P5.11 §13.11)
Add missing Prometheus metrics to the /multi-search endpoint: - miroir_multisearch_queries_per_batch: histogram tracking query count per batch - miroir_multisearch_batches_total: counter for total batches processed - miroir_multisearch_partial_failures_total: counter for batches with >=1 failed query The core MultiSearchExecutor and HTTP endpoint were already implemented. This commit completes the observability requirements from plan §13.11. All acceptance criteria covered by existing tests: - 5-query batch: test_five_query_batch_all_complete - Parallel execution: test_slow_query_doesnt_block_fast_queries - 100-query batch: test_large_batch_completes - Partial failure: test_partial_failure_one_error Closes: miroir-uhj.11 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
baa484b61e
commit
c8bc21bc71
1 changed files with 13 additions and 0 deletions
|
|
@ -173,6 +173,13 @@ where
|
|||
return Err(StatusCode::BAD_REQUEST);
|
||||
}
|
||||
|
||||
// Record multi-search metrics (plan §13.11)
|
||||
let query_count = body.queries.len() as u64;
|
||||
state
|
||||
.metrics
|
||||
.observe_multisearch_queries_per_batch(query_count);
|
||||
state.metrics.inc_multisearch_batches_total();
|
||||
|
||||
let executor = MultiSearchExecutor::new(state.config.multi_search.clone());
|
||||
|
||||
// Get topology and policy once for all queries
|
||||
|
|
@ -421,6 +428,12 @@ where
|
|||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})?;
|
||||
|
||||
// Record partial failures metric (plan §13.11)
|
||||
let has_failures = response.results.iter().any(|r| !r.is_success());
|
||||
if has_failures {
|
||||
state.metrics.inc_multisearch_partial_failures();
|
||||
}
|
||||
|
||||
Ok(Json(response))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue