Skip to content

Commit 730710c

Browse files
bug fixes
1. update metrics call for listing queries 2. fix delete on retention
1 parent 3bf5673 commit 730710c

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/catalog/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,9 @@ pub async fn remove_manifest_from_snapshot(
537537
let stream_name_clone = stream_name.to_string();
538538
let dates_clone = dates.clone();
539539

540-
for_each_live_node(tenant_id, move |ingestor| {
540+
// only ingestors' snapshots contain the manifest paths, so we need to send the retention cleanup request to all ingestors
541+
// querier does not have /retention/cleanup endpoint, but it does not need to receive the request since it does not have the manifest paths in its snapshot
542+
let _ = for_each_live_node(tenant_id, move |ingestor| {
541543
let stream_name = stream_name_clone.clone();
542544
let dates = dates_clone.clone();
543545
async move {
@@ -552,7 +554,8 @@ pub async fn remove_manifest_from_snapshot(
552554
Ok::<(), ObjectStorageError>(())
553555
}
554556
})
555-
.await?;
557+
.await
558+
.map_err(|e| tracing::error!("{e}"));
556559
}
557560

558561
Ok(())

src/storage/metrics_layer.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ impl<T: ObjectStore> ObjectStore for MetricLayer<T> {
293293
let inner = self.inner.list(prefix);
294294
let res = StreamMetricWrapper {
295295
time,
296-
labels: ["LIST", "200"],
296+
provider: self.provider.clone(),
297+
method: "LIST",
298+
status: "200",
297299
inner,
298300
};
299301
Box::pin(res)
@@ -308,7 +310,9 @@ impl<T: ObjectStore> ObjectStore for MetricLayer<T> {
308310
let inner = self.inner.list_with_offset(prefix, offset);
309311
let res = StreamMetricWrapper {
310312
time,
311-
labels: ["LIST_OFFSET", "200"],
313+
provider: self.provider.clone(),
314+
method: "LIST_OFFSET",
315+
status: "200",
312316
inner,
313317
};
314318

@@ -396,13 +400,15 @@ impl<T: ObjectStore> ObjectStore for MetricLayer<T> {
396400
}
397401
}
398402

399-
struct StreamMetricWrapper<'a, const N: usize, T> {
403+
struct StreamMetricWrapper<'a, T> {
400404
time: time::Instant,
401-
labels: [&'static str; N],
405+
provider: String,
406+
method: &'static str,
407+
status: &'static str,
402408
inner: BoxStream<'a, T>,
403409
}
404410

405-
impl<T, const N: usize> Stream for StreamMetricWrapper<'_, N, T> {
411+
impl<T> Stream for StreamMetricWrapper<'_, T> {
406412
type Item = T;
407413

408414
fn poll_next(
@@ -412,7 +418,7 @@ impl<T, const N: usize> Stream for StreamMetricWrapper<'_, N, T> {
412418
match self.inner.poll_next_unpin(cx) {
413419
t @ Poll::Ready(None) => {
414420
STORAGE_REQUEST_RESPONSE_TIME
415-
.with_label_values(&self.labels)
421+
.with_label_values(&[&self.provider, self.method, self.status])
416422
.observe(self.time.elapsed().as_secs_f64());
417423
t
418424
}

0 commit comments

Comments
 (0)