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