From 69eed2c3fab5409aa7f9005f06a9e576908a43db Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Mon, 25 Aug 2025 23:04:42 +0800 Subject: [PATCH] feat: only show prometheus logical tables for __name__ values query (#6814) feat: only show prometheus logical tables for __name__ query Signed-off-by: Ning Sun --- src/servers/src/http/prometheus.rs | 7 ++++--- tests-integration/tests/http.rs | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/servers/src/http/prometheus.rs b/src/servers/src/http/prometheus.rs index 32042b5409..5d74be1458 100644 --- a/src/servers/src/http/prometheus.rs +++ b/src/servers/src/http/prometheus.rs @@ -47,7 +47,7 @@ use serde_json::Value; use session::context::{QueryContext, QueryContextRef}; use snafu::{Location, OptionExt, ResultExt}; use store_api::metric_engine_consts::{ - DATA_SCHEMA_TABLE_ID_COLUMN_NAME, DATA_SCHEMA_TSID_COLUMN_NAME, PHYSICAL_TABLE_METADATA_KEY, + DATA_SCHEMA_TABLE_ID_COLUMN_NAME, DATA_SCHEMA_TSID_COLUMN_NAME, LOGICAL_TABLE_METADATA_KEY, }; pub use super::result::prometheus_resp::PrometheusJsonResponse; @@ -1143,13 +1143,14 @@ async fn retrieve_table_names( while let Some(table) = tables_stream.next().await { let table = table.context(CatalogSnafu)?; - if table + if !table .table_info() .meta .options .extra_options - .contains_key(PHYSICAL_TABLE_METADATA_KEY) + .contains_key(LOGICAL_TABLE_METADATA_KEY) { + // skip non-prometheus (non-metricengine) tables for __name__ query continue; } diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index 39e199b81e..822c88031f 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -1109,9 +1109,7 @@ pub async fn test_prom_http_api(store_type: StorageType) { "demo_metrics", "demo_metrics_with_nanos", "logic_table", - "mito", "multi_labels", - "numbers" ])) .unwrap() );