Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions asap-query-engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,11 @@ async fn main() -> Result<()> {
schemas,
store.clone(),
hot_reload_config.clone(),
query_engine_rust::stores::sketch_db::noop_reader_factory(),
query_engine_rust::stores::sketch_db::default_reader_factory(),
query_engine_rust::stores::sketch_db::BackfillServiceConfig::default(),
);
info!(
"Spawning BackfillService drain loop (reader factory: noopjobs will fail fast until a real factory is wired)"
"Spawning BackfillService drain loop (reader factory: defaultPrometheus sources wired, S3/ClickHouse/OtherSketch fail fast)"
);
Some(service.spawn())
} else {
Expand Down
27 changes: 27 additions & 0 deletions asap-query-engine/src/stores/sketch_db/backfill_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,33 @@ pub fn noop_reader_factory() -> ReaderFactory {
})
}

/// Production-ready `ReaderFactory` covering the source variants
/// whose readers ship in-tree as of Phase 5h:
///
/// * [`BackfillSource::Prometheus`] — routed to
/// [`super::prometheus_reader::PrometheusReader`].
///
/// All other variants (`S3Gorilla`, `ClickHouse`, `OtherSketch`)
/// return a clear "not yet implemented" error, which the worker
/// surfaces on `BackfillJob::error_message` so the controller
/// / operator sees exactly which reader is missing.
pub fn default_reader_factory() -> ReaderFactory {
Arc::new(|source| {
match source {
BackfillSource::Prometheus { url } => {
let reader = super::prometheus_reader::PrometheusReader::new(url.clone());
Ok(Arc::new(reader) as Arc<dyn RawSampleReader>)
}
BackfillSource::S3Gorilla { .. }
| BackfillSource::ClickHouse { .. }
| BackfillSource::OtherSketch { .. } => Err(format!(
"reader for {source:?} not yet implemented; only Prometheus is wired in-tree as of Phase 5h"
)
.into()),
}
})
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
6 changes: 4 additions & 2 deletions asap-query-engine/src/stores/sketch_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub mod backfill_processor;
pub mod backfill_service;
pub mod backfill_window_builder;
pub mod backfill_worker;
pub mod prometheus_reader;
pub mod raw_sample_reader;
pub mod schema;
pub mod simple_map_store;
Expand All @@ -42,11 +43,12 @@ pub use backfill::{
};
pub use backfill_processor::BackfillWindowProcessor;
pub use backfill_service::{
noop_reader_factory, BackfillService, BackfillServiceConfig, BackfillServiceHandle,
ReaderFactory,
default_reader_factory, noop_reader_factory, BackfillService, BackfillServiceConfig,
BackfillServiceHandle, ReaderFactory,
};
pub use backfill_window_builder::build_backfilled_accumulator;
pub use backfill_worker::{BackfillWorker, BackfillWorkerError, WindowProcessor};
pub use prometheus_reader::PrometheusReader;
pub use raw_sample_reader::{
LabelFilter, MockRawSampleReader, RawSample, RawSampleReader, RawSampleReaderError,
};
Expand Down
Loading