mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-01 10:58:30 +02:00
Rename fields
This commit is contained in:
parent
4d26e9c6f2
commit
44d6430bae
@ -32,7 +32,7 @@ pub struct BatchStatsView {
|
||||
#[serde(flatten)]
|
||||
pub stats: BatchStats,
|
||||
#[serde(skip_serializing_if = "EmbedderStatsView::skip_serializing", default)]
|
||||
pub embedder: EmbedderStatsView,
|
||||
pub embedder_requests: EmbedderStatsView,
|
||||
}
|
||||
|
||||
impl BatchView {
|
||||
@ -43,7 +43,7 @@ impl BatchView {
|
||||
details: batch.details.clone(),
|
||||
stats: BatchStatsView {
|
||||
stats: batch.stats.clone(),
|
||||
embedder: batch.embedder_stats.clone(),
|
||||
embedder_requests: batch.embedder_stats.clone(),
|
||||
},
|
||||
duration: batch.finished_at.map(|finished_at| finished_at - batch.started_at),
|
||||
started_at: batch.started_at,
|
||||
|
@ -92,8 +92,8 @@ pub struct BatchStats {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[schema(rename_all = "camelCase")]
|
||||
pub struct EmbedderStatsView {
|
||||
pub total_count: usize,
|
||||
pub error_count: usize,
|
||||
pub total: usize,
|
||||
pub failed: usize,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub last_error: Option<String>,
|
||||
}
|
||||
@ -102,8 +102,8 @@ impl From<&EmbedderStats> for EmbedderStatsView {
|
||||
fn from(stats: &EmbedderStats) -> Self {
|
||||
let errors = stats.errors.read().unwrap_or_else(|p| p.into_inner());
|
||||
Self {
|
||||
total_count: stats.total_count.load(std::sync::atomic::Ordering::Relaxed),
|
||||
error_count: errors.1 as usize,
|
||||
total: stats.total_count.load(std::sync::atomic::Ordering::Relaxed),
|
||||
failed: errors.1 as usize,
|
||||
last_error: errors.0.clone(),
|
||||
}
|
||||
}
|
||||
@ -111,6 +111,6 @@ impl From<&EmbedderStats> for EmbedderStatsView {
|
||||
|
||||
impl EmbedderStatsView {
|
||||
pub fn skip_serializing(&self) -> bool {
|
||||
self.total_count == 0 && self.error_count == 0 && self.last_error.is_none()
|
||||
self.total == 0 && self.failed == 0 && self.last_error.is_none()
|
||||
}
|
||||
}
|
||||
|
@ -2182,7 +2182,7 @@ async fn last_error_stats() {
|
||||
let (response, _code) = index.filtered_batches(&[], &[], &[]).await;
|
||||
snapshot!(json_string!(response["results"][0], {
|
||||
".progress" => "[ignored]",
|
||||
".stats.embedder.totalCount" => "[ignored]",
|
||||
".stats.embedderRequests.total" => "[ignored]",
|
||||
".startedAt" => "[ignored]"
|
||||
}), @r#"
|
||||
{
|
||||
@ -2203,9 +2203,9 @@ async fn last_error_stats() {
|
||||
"indexUids": {
|
||||
"doggo": 1
|
||||
},
|
||||
"embedder": {
|
||||
"totalCount": "[ignored]",
|
||||
"errorCount": 5,
|
||||
"embedderRequests": {
|
||||
"total": "[ignored]",
|
||||
"failed": 5,
|
||||
"lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `Service Unavailable`"
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user