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
37 changes: 37 additions & 0 deletions asap-query-engine/src/utils/file_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,43 @@ mod tests {
use std::io::Write;
use tempfile::NamedTempFile;

/// The PromQL compliance roll-up suite ships hand-written planner output;
/// parse it the way the engine does so it can't drift from the format.
#[test]
fn compliance_rollup_planner_output_loads_as_engine_config() {
let directory = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../promql-compliance/suites/rollup-planner-output"
);
let inference = read_inference_config(
&format!("{directory}/inference_config.yaml"),
QueryLanguage::promql,
)
.unwrap();
let streaming =
read_streaming_config(&format!("{directory}/streaming_config.yaml"), &inference)
.unwrap();

assert!(!inference.query_configs.is_empty());
for query_config in &inference.query_configs {
assert!(
!query_config.aggregations.is_empty(),
"{}",
query_config.query
);
for reference in &query_config.aggregations {
assert!(
streaming
.get_aggregation_config(reference.aggregation_id)
.is_some(),
"{} names missing aggregation {}",
query_config.query,
reference.aggregation_id
);
}
}
}

#[test]
fn test_read_streaming_config() {
let streaming_yaml_content = r#"
Expand Down
4 changes: 3 additions & 1 deletion promql-compliance/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ The runner performs these stages:
are relative to this timestamp.
3. Generate temporary planner and engine configuration.
4. Start Prometheus and wait for its health check.
5. Run the planner. Its output is placed in a named shared volume.
5. Run the planner. Its output is placed in a named shared volume. A suite
with `planner_output_dir` skips the planner and mounts that directory
instead.
6. Start the ASAPQuery query engine after the planner completes.
7. Send the same encoded remote-write batches to Prometheus and ASAPQuery.
8. Wait for both query APIs to be ready and for the first probe query to return
Expand Down
21 changes: 21 additions & 0 deletions promql-compliance/HOW_TO.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ To change the five-minute cap or one-second ingestion assumption, change the
runner’s generated-config logic in `runner/run.go`. Do not edit the generated
configuration: it is temporary and is deleted after the run.

## Use fixed planner output

By default the planner generates the engine's streaming and inference
configs from the suite. To test configs the planner does not produce, such as
roll-ups from a finer grouping, check the configs in next to the suite and
point the suite at their directory:

```yaml
name: rollup
planner_output_dir: rollup-planner-output
```

The path is relative to the suite file. The directory must contain
`streaming_config.yaml` and `inference_config.yaml` in the planner's output
format; the runner fails at load time if either is missing. The planner
service then does not run, and the query engine reads the directory in place
of the planner's output volume. This needs Docker Compose v2.24.4 or later
(for `!override`); the runner checks the version first. With
already-running targets the field has no effect, and the planner input is
generated and validated as usual. `suites/rollup.yaml` is an example.

## Configure tolerance

Set a suite-wide default:
Expand Down
Loading
Loading