Skip to content

refactor(query-engine): extract asap-adapters crate - #936

Draft
milindsrivastava1997 wants to merge 2 commits into
mainfrom
refactor/asap-adapters-crate
Draft

milindsrivastava1997 wants to merge 2 commits into
mainfrom
refactor/asap-adapters-crate

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Contributor

Plan step 1 of .design_docs/asapplanner-engine-boundaries.md (decision 46): extract asap-adapters as a pure move.

What moved to asap-adapters

  • drivers/query/ (protocol adapters, fallback clients, HttpServer) and drivers/ingest/otel.rs (OtlpReceiver)
  • query_tracker/, planner_client.rs (with the asap-planner-rs dependency)
  • main.rs, engine_config.rs (only used by main.rs) and every src/bin/* binary. Binary names are unchanged.
  • The unit tests that drive HttpServer: rqe_query_tests, {prometheus,clickhouse,elastic}_forwarding_tests

asap-query-engine is now a library and no longer depends on asap-planner-rs.

Deviations from the plan

  • The remote-write decoders stay in the engine crate (drivers/ingest/{prometheus_remote_write,victoriametrics_remote_write}.rs). precompute_engine/{ingest_source,csv_ingest,json_ingest,ingest_handler}.rs use DecodedSample and the decoders, and they also use precompute internals (SeriesRouter, pub(crate) route_decoded_samples). Moving the decoders would create a crate cycle, and moving the ingest sources would require visibility changes. Both move together in the wiring step, as the plan already says for the ingest sources.
  • tests/sql_query_support.rs and tests/e2e_precompute_equivalence.rs move to asap-adapters/tests/. The alternative was to keep asap-planner-rs as an engine dev-dependency. Moving them keeps the engine crate free of any planner dependency, as decision 46 requires. Both tests use only public engine APIs.
  • asap-adapters/src/bin/run.sh gets a shebang so shellcheck passes on the moved file. It refers to a binary that no longer exists, so it is dead either way.

Other changes (build config only)

  • Workspace Cargo.toml: new member, plus a query_engine_rust workspace dependency.
  • Crate-specific dependencies used only by moved code move from the engine manifest to the adapters manifest. Unused ones (rusqlite, uuid, structopt) stay in the engine manifest untouched.
  • asap-adapters forwards native_query_legacy_test_support to the engine. The default jemalloc feature stays on the engine library.
  • asap-query-engine/Dockerfile builds from asap-adapters with stubs for the new layout. asap-planner-rs/Dockerfile stubs the new member.
  • asap-query-engine/installation/install.sh: -p query_engine_rust → -p asap-adapters.
  • CI path filters include asap-adapters/**.
  • asap-quickstart/Dockerfile.queryengine-local is unchanged: it copies a prebuilt query_engine_rust binary, and that name is the same.

No logic changes. Imports were rewritten from crate:: to query_engine_rust::/asap_adapters::, and cargo fmt reordered them.

Verification

  • cargo fmt --all -- --check and cargo clippy --workspace --all-targets --all-features --locked -- -D warnings pass.
  • cargo test --workspace --locked: 1529 passed, 0 failed, the same count as main.
  • docker build -f asap-query-engine/Dockerfile . and -f asap-planner-rs/Dockerfile . both succeed. The image contains /usr/local/bin/query_engine_rust and --help runs.

Follow-ups (not in this PR)

  • asap-query-engine/docs/adding-{protocol-adapter,protocol-server,fallback-backend}.md and docs/README.md still give src/drivers/... paths relative to the engine crate.
  • Optional: narrow engine internals with pub(crate).

🤖 Generated with Claude Code

milindsrivastava1997 and others added 2 commits November 24, 2026 09:58
Move protocol adapters, fallback clients, the OTLP receiver, the query
tracker, planner client and every binary into a new workspace crate that
depends on the engine crate. The engine crate becomes a library and no
longer depends on asap-planner-rs.

The Prometheus and VictoriaMetrics remote-write decoders stay in the
engine crate: precompute_engine's ingest sources use DecodedSample and
the decoders, and those sources use precompute internals.

Imports, manifests, Dockerfiles, install script and CI path filters only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aths

Remove reqwest, rusqlite, uuid and structopt from the engine manifest;
nothing in the crate uses them. Point asap-tools build/edit instructions
at asap-adapters and the manual-stack docs at the workspace target dir.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant